@@ -266,17 +266,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
266
266
} else {
267
267
bug ! ( "unexpected builtin trait {:?}" , trait_def)
268
268
} ;
269
- let BuiltinImplConditions :: Where ( nested ) = conditions else {
269
+ let BuiltinImplConditions :: Where ( types ) = conditions else {
270
270
bug ! ( "obligation {:?} had matched a builtin impl but now doesn't" , obligation) ;
271
271
} ;
272
+ let types = self . infcx . enter_forall_and_leak_universe ( types) ;
272
273
273
274
let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
274
275
self . collect_predicates_for_types (
275
276
obligation. param_env ,
276
277
cause,
277
278
obligation. recursion_depth + 1 ,
278
279
trait_def,
279
- nested ,
280
+ types ,
280
281
)
281
282
} else {
282
283
PredicateObligations :: new ( )
@@ -444,37 +445,25 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
444
445
& mut self ,
445
446
obligation : & PolyTraitObligation < ' tcx > ,
446
447
) -> Result < PredicateObligations < ' tcx > , SelectionError < ' tcx > > {
447
- debug ! ( ?obligation, "confirm_auto_impl_candidate" ) ;
448
-
449
- let self_ty = obligation. predicate . self_ty ( ) . map_bound ( |ty| self . infcx . shallow_resolve ( ty) ) ;
450
- let types = self . constituent_types_for_ty ( self_ty) ?;
451
- Ok ( self . vtable_auto_impl ( obligation, obligation. predicate . def_id ( ) , types) )
452
- }
453
-
454
- /// See `confirm_auto_impl_candidate`.
455
- fn vtable_auto_impl (
456
- & mut self ,
457
- obligation : & PolyTraitObligation < ' tcx > ,
458
- trait_def_id : DefId ,
459
- nested : ty:: Binder < ' tcx , Vec < Ty < ' tcx > > > ,
460
- ) -> PredicateObligations < ' tcx > {
461
- debug ! ( ?nested, "vtable_auto_impl" ) ;
462
448
ensure_sufficient_stack ( || {
463
- let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
464
-
465
449
assert_eq ! ( obligation. predicate. polarity( ) , ty:: PredicatePolarity :: Positive ) ;
466
450
451
+ let self_ty =
452
+ obligation. predicate . self_ty ( ) . map_bound ( |ty| self . infcx . shallow_resolve ( ty) ) ;
453
+
454
+ let types = self . constituent_types_for_ty ( self_ty) ?;
455
+ let types = self . infcx . enter_forall_and_leak_universe ( types) ;
456
+
457
+ let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
467
458
let obligations = self . collect_predicates_for_types (
468
459
obligation. param_env ,
469
460
cause,
470
461
obligation. recursion_depth + 1 ,
471
- trait_def_id ,
472
- nested ,
462
+ obligation . predicate . def_id ( ) ,
463
+ types ,
473
464
) ;
474
465
475
- debug ! ( ?obligations, "vtable_auto_impl" ) ;
476
-
477
- obligations
466
+ Ok ( obligations)
478
467
} )
479
468
}
480
469
0 commit comments