@@ -12,11 +12,11 @@ use rustc_infer::traits::solve::Goal;
12
12
use rustc_middle:: traits:: query:: NoSolution ;
13
13
use rustc_middle:: traits:: solve:: Certainty ;
14
14
use rustc_middle:: ty:: {
15
- self , SizedTraitKind , Ty , TyCtxt , TypeFlags , TypeFoldable , TypeVisitableExt as _, TypingMode ,
15
+ self , Ty , TyCtxt , TypeFlags , TypeFoldable , TypeVisitableExt as _, TypingMode ,
16
16
} ;
17
17
use rustc_span:: { DUMMY_SP , ErrorGuaranteed , Span } ;
18
18
19
- use crate :: traits:: { EvaluateConstErr , ObligationCause , specialization_graph} ;
19
+ use crate :: traits:: { EvaluateConstErr , ObligationCause , sizedness_fast_path , specialization_graph} ;
20
20
21
21
#[ repr( transparent) ]
22
22
pub struct SolverDelegate < ' tcx > ( InferCtxt < ' tcx > ) ;
@@ -76,19 +76,11 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
76
76
77
77
if trait_pred. polarity ( ) == ty:: PredicatePolarity :: Positive {
78
78
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
+ }
92
84
}
93
85
Some ( LangItem :: Copy | LangItem :: Clone ) => {
94
86
let self_ty =
0 commit comments