@@ -3,8 +3,8 @@ use rustc_hir as hir;
33use rustc_hir:: def:: DefKind ;
44use rustc_index:: bit_set:: BitSet ;
55use rustc_middle:: ty:: {
6- self , Binder , EarlyBinder , Predicate , PredicateKind , ToPredicate , Ty , TyCtxt ,
7- TypeSuperVisitable , TypeVisitable , TypeVisitor ,
6+ self , Binder , EarlyBinder , ImplTraitInTraitData , Predicate , PredicateKind , ToPredicate , Ty ,
7+ TyCtxt , TypeSuperVisitable , TypeVisitable , TypeVisitor ,
88} ;
99use rustc_session:: config:: TraitSolver ;
1010use rustc_span:: def_id:: { DefId , CRATE_DEF_ID } ;
@@ -117,6 +117,13 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
117117
118118/// See `ParamEnv` struct definition for details.
119119fn param_env ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> ty:: ParamEnv < ' _ > {
120+ let def_id =
121+ if let Some ( ImplTraitInTraitData :: Trait { fn_def_id, .. } ) = tcx. opt_rpitit_info ( def_id) {
122+ fn_def_id
123+ } else {
124+ def_id
125+ } ;
126+
120127 // Compute the bounds on Self and the type parameters.
121128 let ty:: InstantiatedPredicates { mut predicates, .. } =
122129 tcx. predicates_of ( def_id) . instantiate_identity ( tcx) ;
0 commit comments