@@ -266,17 +266,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
266266 } else {
267267 bug ! ( "unexpected builtin trait {:?}" , trait_def)
268268 } ;
269- let BuiltinImplConditions :: Where ( nested ) = conditions else {
269+ let BuiltinImplConditions :: Where ( types ) = conditions else {
270270 bug ! ( "obligation {:?} had matched a builtin impl but now doesn't" , obligation) ;
271271 } ;
272+ let types = self . infcx . enter_forall_and_leak_universe ( types) ;
272273
273274 let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
274275 self . collect_predicates_for_types (
275276 obligation. param_env ,
276277 cause,
277278 obligation. recursion_depth + 1 ,
278279 trait_def,
279- nested ,
280+ types ,
280281 )
281282 } else {
282283 PredicateObligations :: new ( )
@@ -444,37 +445,25 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
444445 & mut self ,
445446 obligation : & PolyTraitObligation < ' tcx > ,
446447 ) -> 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" ) ;
462448 ensure_sufficient_stack ( || {
463- let cause = obligation. derived_cause ( ObligationCauseCode :: BuiltinDerived ) ;
464-
465449 assert_eq ! ( obligation. predicate. polarity( ) , ty:: PredicatePolarity :: Positive ) ;
466450
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 ) ;
467458 let obligations = self . collect_predicates_for_types (
468459 obligation. param_env ,
469460 cause,
470461 obligation. recursion_depth + 1 ,
471- trait_def_id ,
472- nested ,
462+ obligation . predicate . def_id ( ) ,
463+ types ,
473464 ) ;
474465
475- debug ! ( ?obligations, "vtable_auto_impl" ) ;
476-
477- obligations
466+ Ok ( obligations)
478467 } )
479468 }
480469
0 commit comments