@@ -10,9 +10,9 @@ use rustc_type_ir::solve::{
1010 QueryResultOrRerunNonErased , RerunNonErased , RerunReason , RerunResultExt , SizedTraitKind ,
1111} ;
1212use rustc_type_ir:: {
13- self as ty, CallerBoundsIterator , ClausePolarity , ExistentialPredicate , FieldInfo ,
14- IncludeSizedImplicitBounds , Interner , MayBeErased , Movability , Region , TraitClause , TraitRef ,
15- TypeVisitableExt as _ , TypingMode , Unnormalized , Upcast as _, elaborate,
13+ self as ty, CallerBoundsIterator , ExistentialPredicate , FieldInfo , IncludeSizedImplicitBounds ,
14+ Interner , MayBeErased , Movability , Region , TraitClause , TraitRef , TypeVisitableExt as _ ,
15+ TypingMode , Unnormalized , Upcast as _, elaborate,
1616} ;
1717use tracing:: { debug, instrument, trace, warn} ;
1818
@@ -137,39 +137,17 @@ where
137137 ecx : & mut EvalCtxt < ' _ , D > ,
138138 goal : Goal < I , Self > ,
139139 ) -> impl Iterator < Item = I :: Clause > {
140- fn trait_def_id_matches < I : Interner > (
141- cx : I ,
142- clause_def_id : I :: TraitId ,
143- goal_def_id : I :: TraitId ,
144- polarity : ClausePolarity ,
145- ) -> bool {
146- clause_def_id == goal_def_id
147- // PERF(sized-hierarchy): Sizedness supertraits aren't elaborated to improve perf, so
148- // check for a `MetaSized` supertrait being matched against a `Sized` assumption.
149- //
150- // `PointeeSized` bounds are syntactic sugar for a lack of bounds so don't need this.
151- || ( polarity == ClausePolarity :: Positive
152- && cx. is_trait_lang_item ( clause_def_id, SolverTraitLangItem :: Sized )
153- && cx. is_trait_lang_item ( goal_def_id, SolverTraitLangItem :: MetaSized ) )
154- }
155-
156140 goal. param_env
157141 . caller_bounds ( )
158142 . trait_clauses ( ecx. cx ( ) )
159143 . with_polarity ( goal. predicate . polarity )
144+ . for_trait ( goal. predicate . def_id ( ) )
160145 . filter ( move |trait_clause| {
161- trait_def_id_matches (
162- ecx. cx ( ) ,
163- trait_clause. def_id ( ) ,
164- goal. predicate . def_id ( ) ,
165- goal. predicate . polarity ,
166- ) && DeepRejectCtxt :: relate_rigid_rigid ( ecx. cx ( ) ) . args_may_unify (
146+ DeepRejectCtxt :: relate_rigid_rigid ( ecx. cx ( ) ) . args_may_unify (
167147 goal. predicate . trait_ref . args ,
168148 trait_clause. skip_binder ( ) . trait_ref . args ,
169149 )
170150 } )
171- // TODO: allow using for_trait by elaborating the sized hierarchy
172- // .for_trait(goal.predicate.def_id())
173151 . interned ( )
174152 . iter ( )
175153 }
0 commit comments