File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
compiler/rustc_trait_selection/src/traits Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -548,6 +548,23 @@ pub fn sizedness_fast_path<'tcx>(
548
548
}
549
549
}
550
550
551
+ // Likewise, determining if a sizedness trait is implemented const-ly is a trivial
552
+ // determination that can happen in the fast path.
553
+ //
554
+ // NOTE: Keep this in sync with `evaluate_host_effect_for_sizedness_goal` in the old solver,
555
+ // `const_conditions_for_sizedness` in the new solver.
556
+ if let ty:: PredicateKind :: Clause ( ty:: ClauseKind :: HostEffect ( host_pred) ) =
557
+ predicate. kind ( ) . skip_binder ( )
558
+ {
559
+ let is_sizedness = tcx. is_lang_item ( host_pred. def_id ( ) , LangItem :: Sized )
560
+ || tcx. is_lang_item ( host_pred. def_id ( ) , LangItem :: MetaSized ) ;
561
+
562
+ if is_sizedness && !host_pred. self_ty ( ) . has_non_const_sizedness ( ) {
563
+ debug ! ( "fast path -- host effect" ) ;
564
+ return true ;
565
+ }
566
+ }
567
+
551
568
false
552
569
}
553
570
You can’t perform that action at this time.
0 commit comments