@@ -22,10 +22,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2222use rustc_errors:: Applicability ;
2323use rustc_hir:: { def_id:: DefId , Item , ItemKind } ;
2424use rustc_lint:: { LateContext , LateLintPass , LintStore } ;
25- use rustc_middle:: {
26- traits:: Reveal ,
27- ty:: { self , Upcast } ,
28- } ;
25+ use rustc_middle:: ty:: { self , Upcast } ;
2926use rustc_session:: { declare_lint, impl_lint_pass, Session } ;
3027use rustc_span:: { sym, ExpnKind , MacroKind , Symbol } ;
3128use serde:: Deserialize ;
@@ -353,24 +350,24 @@ fn implements_trait_with_bounds<'tcx>(
353350 generics. own_params. len( ) . saturating_sub( 1 )
354351 ] ;
355352 if let ty:: Adt ( adt_def, _) = ty. kind ( ) {
356- let param_env = param_env_with_bounds ( cx. tcx , adt_def. did ( ) , trait_id) ;
353+ let typing_env = typing_env_with_bounds ( cx. tcx , adt_def. did ( ) , trait_id) ;
357354 // smoelius: The decision to pass `adt_def.did()` as the `callee_id` argument is based on
358355 // the following, but I am not sure it is the correct choice:
359356 // https://github.com/rust-lang/rust-clippy/blob/782520088f9c5a0274459060a6fdcd41301f35e2/clippy_lints/src/derive.rs#L453
360357 // See also: https://github.com/rust-lang/rust/pull/118661#discussion_r1449013176
361358 // smoelius: `Some(adt_def.did())` was changed to `None`. See:
362359 // https://github.com/rust-lang/rust/pull/120000
363- implements_trait_with_env ( cx. tcx , param_env , ty, trait_id, None , & args)
360+ implements_trait_with_env ( cx. tcx , typing_env , ty, trait_id, None , & args)
364361 } else {
365362 implements_trait ( cx, ty, trait_id, & args)
366363 }
367364}
368365
369- // smoelius: `param_env_with_bounds ` is based on Clippy's `param_env_for_derived_eq`:
366+ // smoelius: `typing_env_with_bounds ` is based on Clippy's `param_env_for_derived_eq`:
370367// https://github.com/rust-lang/rust-clippy/blob/716c552632acb50a524e62284b9ca2446333a626/clippy_lints/src/derive.rs#L493-L529
371368
372369/// Creates the `ParamEnv` used for the give type's derived impl.
373- fn param_env_with_bounds ( tcx : ty:: TyCtxt < ' _ > , did : DefId , trait_id : DefId ) -> ty:: ParamEnv < ' _ > {
370+ fn typing_env_with_bounds ( tcx : ty:: TyCtxt < ' _ > , did : DefId , trait_id : DefId ) -> ty:: TypingEnv < ' _ > {
374371 // Initial map from generic index to param def.
375372 // Vec<(param_def, needs_bound)>
376373 let mut params = tcx
@@ -391,7 +388,7 @@ fn param_env_with_bounds(tcx: ty::TyCtxt<'_>, did: DefId, trait_id: DefId) -> ty
391388 }
392389 }
393390
394- ty:: ParamEnv :: new (
391+ let param_env = ty:: ParamEnv :: new (
395392 tcx. mk_clauses_from_iter (
396393 ty_predicates. iter ( ) . map ( |& ( p, _) | p) . chain (
397394 params
@@ -410,8 +407,11 @@ fn param_env_with_bounds(tcx: ty::TyCtxt<'_>, did: DefId, trait_id: DefId) -> ty
410407 } ) ,
411408 ) ,
412409 ) ,
413- Reveal :: UserFacing ,
414- )
410+ ) ;
411+ ty:: TypingEnv {
412+ typing_mode : ty:: TypingMode :: non_body_analysis ( ) ,
413+ param_env,
414+ }
415415}
416416
417417impl Macro {
0 commit comments