@@ -342,23 +342,18 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
342342 let Some ( sized_def_id) = tcx. lang_items ( ) . sized_trait ( ) else {
343343 return Err ( NoSolution ) ;
344344 } ;
345+ // Check that the type implements all of the predicates of the def-id.
346+ // (i.e. the principal, all of the associated types match, and any auto traits)
345347 ecx. add_goals (
346- data. iter ( )
347- // Check that the type implements all of the predicates of the def-id.
348- // (i.e. the principal, all of the associated types match, and any auto traits)
349- . map ( |pred| goal. with ( tcx, pred. with_self_ty ( tcx, a_ty) ) )
350- . chain ( [
351- // The type must be Sized to be unsized.
352- goal. with (
353- tcx,
354- ty:: Binder :: dummy ( tcx. mk_trait_ref ( sized_def_id, [ a_ty] ) ) ,
355- ) ,
356- // The type must outlive the lifetime of the `dyn` we're unsizing into.
357- goal. with (
358- tcx,
359- ty:: Binder :: dummy ( ty:: OutlivesPredicate ( a_ty, region) ) ,
360- ) ,
361- ] ) ,
348+ data. iter ( ) . map ( |pred| goal. with ( tcx, pred. with_self_ty ( tcx, a_ty) ) ) ,
349+ ) ;
350+ // The type must be Sized to be unsized.
351+ ecx. add_goal (
352+ goal. with ( tcx, ty:: Binder :: dummy ( tcx. mk_trait_ref ( sized_def_id, [ a_ty] ) ) ) ,
353+ ) ;
354+ // The type must outlive the lifetime of the `dyn` we're unsizing into.
355+ ecx. add_goal (
356+ goal. with ( tcx, ty:: Binder :: dummy ( ty:: OutlivesPredicate ( a_ty, region) ) ) ,
362357 ) ;
363358 ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
364359 }
0 commit comments