@@ -177,35 +177,11 @@ where
177177 fn fast_reject_assumption (
178178 ecx : & mut EvalCtxt < ' _ , D > ,
179179 goal : Goal < I , Self > ,
180- goal_lang_item : Option < SolverTraitLangItem > ,
181180 assumption : I :: Clause ,
182181 ) -> Result < ( ) , NoSolution > {
183- fn trait_def_id_matches < I : Interner > (
184- cx : I ,
185- clause_def_id : I :: TraitId ,
186- goal_def_id : I :: TraitId ,
187- polarity : ClausePolarity ,
188- goal_lang_item : Option < SolverTraitLangItem > ,
189- ) -> bool {
190- clause_def_id == goal_def_id
191- // PERF(sized-hierarchy): Sizedness supertraits aren't elaborated to improve perf, so
192- // check for a `MetaSized` supertrait being matched against a `Sized` assumption.
193- //
194- // `PointeeSized` bounds are syntactic sugar for a lack of bounds so don't need this.
195- || ( polarity == ClausePolarity :: Positive
196- && goal_lang_item == Some ( SolverTraitLangItem :: MetaSized )
197- && cx. is_trait_lang_item ( clause_def_id, SolverTraitLangItem :: Sized ) )
198- }
199-
200182 if let Some ( trait_clause) = assumption. as_trait_clause ( )
201183 && trait_clause. polarity ( ) == goal. predicate . polarity
202- && trait_def_id_matches (
203- ecx. cx ( ) ,
204- trait_clause. def_id ( ) ,
205- goal. predicate . def_id ( ) ,
206- goal. predicate . polarity ,
207- goal_lang_item,
208- )
184+ && trait_clause. def_id ( ) == goal. predicate . def_id ( )
209185 && DeepRejectCtxt :: relate_rigid_rigid ( ecx. cx ( ) ) . args_may_unify (
210186 goal. predicate . trait_ref . args ,
211187 trait_clause. skip_binder ( ) . trait_ref . args ,
@@ -225,19 +201,6 @@ where
225201 ) -> QueryResultOrRerunNonErased < I > {
226202 let trait_clause = assumption. as_trait_clause ( ) . unwrap ( ) ;
227203
228- // PERF(sized-hierarchy): Sizedness supertraits aren't elaborated to improve perf, so
229- // check for a `Sized` subtrait when looking for `MetaSized`. `PointeeSized` bounds
230- // are syntactic sugar for a lack of bounds so don't need this.
231- // We don't need to check polarity, `fast_reject_assumption` already rejected non-`Positive`
232- // polarity `Sized` assumptions as matching non-`Positive` `MetaSized` goals.
233- if ecx. cx ( ) . is_trait_lang_item ( goal. predicate . def_id ( ) , SolverTraitLangItem :: MetaSized )
234- && ecx. cx ( ) . is_trait_lang_item ( trait_clause. def_id ( ) , SolverTraitLangItem :: Sized )
235- {
236- let meta_sized_clause =
237- trait_predicate_with_def_id ( ecx. cx ( ) , trait_clause, goal. predicate . def_id ( ) ) ;
238- return Self :: match_assumption ( ecx, goal, meta_sized_clause, then) ;
239- }
240-
241204 let assumption_trait_pred = ecx. instantiate_binder_with_infer ( trait_clause) ;
242205 ecx. eq ( goal. param_env , goal. predicate . trait_ref , assumption_trait_pred. trait_ref ) ?;
243206
@@ -1056,25 +1019,6 @@ where
10561019 }
10571020}
10581021
1059- /// Small helper function to change the `def_id` of a trait predicate - this is not normally
1060- /// something that you want to do, as different traits will require different args and so making
1061- /// it easy to change the trait is something of a footgun, but it is useful in the narrow
1062- /// circumstance of changing from `MetaSized` to `Sized`, which happens as part of the lazy
1063- /// elaboration of sizedness candidates.
1064- #[ inline( always) ]
1065- fn trait_predicate_with_def_id < I : Interner > (
1066- cx : I ,
1067- clause : ty:: Binder < I , ty:: TraitClause < I > > ,
1068- did : I :: TraitId ,
1069- ) -> I :: Clause {
1070- clause
1071- . map_bound ( |c| TraitClause {
1072- trait_ref : TraitRef :: new_from_args ( cx, did, c. trait_ref . args ) ,
1073- polarity : c. polarity ,
1074- } )
1075- . upcast ( cx)
1076- }
1077-
10781022impl < D , I > EvalCtxt < ' _ , D >
10791023where
10801024 D : SolverDelegate < Interner = I > ,
0 commit comments