@@ -11,7 +11,7 @@ use rustc_middle::ty::{
1111 fold_regions,
1212} ;
1313use rustc_span:: DUMMY_SP ;
14- use rustc_span:: def_id:: { CRATE_DEF_ID , DefId , LocalDefId } ;
14+ use rustc_span:: def_id:: { DefId , LocalDefId } ;
1515use rustc_trait_selection:: traits;
1616use tracing:: instrument;
1717
@@ -119,7 +119,7 @@ fn adt_sized_constraint<'tcx>(
119119}
120120
121121/// See `ParamEnv` struct definition for details.
122- fn param_env ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> ty:: ParamEnv < ' _ > {
122+ fn param_env ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> ty:: ParamEnv < ' _ > {
123123 // Compute the bounds on Self and the type parameters.
124124 let ty:: InstantiatedPredicates { mut predicates, .. } =
125125 tcx. predicates_of ( def_id) . instantiate_identity ( tcx) ;
@@ -145,7 +145,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
145145 // We accounted for the binder of the fn sig, so skip the binder.
146146 sig. skip_binder ( ) . visit_with ( & mut ImplTraitInTraitFinder {
147147 tcx,
148- fn_def_id : def_id,
148+ fn_def_id : def_id. to_def_id ( ) ,
149149 bound_vars : sig. bound_vars ( ) ,
150150 predicates : & mut predicates,
151151 seen : FxHashSet :: default ( ) ,
@@ -163,12 +163,9 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
163163 ) ;
164164 }
165165
166- let local_did = def_id. as_local ( ) ;
167-
168166 let unnormalized_env = ty:: ParamEnv :: new ( tcx. mk_clauses ( & predicates) ) ;
169167
170- let body_id = local_did. unwrap_or ( CRATE_DEF_ID ) ;
171- let cause = traits:: ObligationCause :: misc ( tcx. def_span ( def_id) , body_id) ;
168+ let cause = traits:: ObligationCause :: misc ( tcx. def_span ( def_id) , def_id) ;
172169 traits:: normalize_param_env_or_error ( tcx, unnormalized_env, cause)
173170}
174171
0 commit comments