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