@@ -12,11 +12,11 @@ use rustc_infer::traits::solve::Goal;
1212use rustc_middle:: traits:: query:: NoSolution ;
1313use rustc_middle:: traits:: solve:: Certainty ;
1414use rustc_middle:: ty:: {
15- self , SizedTraitKind , Ty , TyCtxt , TypeFlags , TypeFoldable , TypeVisitableExt as _, TypingMode ,
15+ self , Ty , TyCtxt , TypeFlags , TypeFoldable , TypeVisitableExt as _, TypingMode ,
1616} ;
1717use rustc_span:: { DUMMY_SP , ErrorGuaranteed , Span } ;
1818
19- use crate :: traits:: { EvaluateConstErr , ObligationCause , specialization_graph} ;
19+ use crate :: traits:: { EvaluateConstErr , ObligationCause , sizedness_fast_path , specialization_graph} ;
2020
2121#[ repr( transparent) ]
2222pub struct SolverDelegate < ' tcx > ( InferCtxt < ' tcx > ) ;
@@ -76,19 +76,11 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
7676
7777 if trait_pred. polarity ( ) == ty:: PredicatePolarity :: Positive {
7878 match self . 0 . tcx . as_lang_item ( trait_pred. def_id ( ) ) {
79- Some ( LangItem :: Sized )
80- if self
81- . resolve_vars_if_possible ( trait_pred. self_ty ( ) . skip_binder ( ) )
82- . has_trivial_sizedness ( self . 0 . tcx , SizedTraitKind :: Sized ) =>
83- {
84- return Some ( Certainty :: Yes ) ;
85- }
86- Some ( LangItem :: MetaSized )
87- if self
88- . resolve_vars_if_possible ( trait_pred. self_ty ( ) . skip_binder ( ) )
89- . has_trivial_sizedness ( self . 0 . tcx , SizedTraitKind :: MetaSized ) =>
90- {
91- return Some ( Certainty :: Yes ) ;
79+ Some ( LangItem :: Sized ) | Some ( LangItem :: MetaSized ) => {
80+ let predicate = self . resolve_vars_if_possible ( goal. predicate ) ;
81+ if sizedness_fast_path ( self . tcx , predicate, goal. param_env ) {
82+ return Some ( Certainty :: Yes ) ;
83+ }
9284 }
9385 Some ( LangItem :: Copy | LangItem :: Clone ) => {
9486 let self_ty =
0 commit comments