@@ -973,25 +973,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
973973 propagated_outlives_requirements : & mut Vec < ClosureOutlivesRequirement < ' tcx > > ,
974974 ) -> bool {
975975 let tcx = infcx. tcx ;
976-
977- let TypeTest { generic_kind, lower_bound, span : _, verify_bound : _ } = type_test;
976+ let TypeTest { generic_kind, lower_bound, span : blame_span, ref verify_bound } = * type_test;
978977
979978 let generic_ty = generic_kind. to_ty ( tcx) ;
980979 let Some ( subject) = self . try_promote_type_test_subject ( infcx, generic_ty) else {
981980 return false ;
982981 } ;
983982
984- debug ! ( "subject = {:?}" , subject) ;
985-
986- let r_scc = self . constraint_sccs . scc ( * lower_bound) ;
987-
983+ let r_scc = self . constraint_sccs . scc ( lower_bound) ;
988984 debug ! (
989985 "lower_bound = {:?} r_scc={:?} universe={:?}" ,
990986 lower_bound,
991987 r_scc,
992988 self . constraint_sccs. annotation( r_scc) . min_universe( )
993989 ) ;
994-
995990 // If the type test requires that `T: 'a` where `'a` is a
996991 // placeholder from another universe, that effectively requires
997992 // `T: 'static`, so we have to propagate that requirement.
@@ -1004,7 +999,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1004999 propagated_outlives_requirements. push ( ClosureOutlivesRequirement {
10051000 subject,
10061001 outlived_free_region : static_r,
1007- blame_span : type_test . span ,
1002+ blame_span,
10081003 category : ConstraintCategory :: Boring ,
10091004 } ) ;
10101005
@@ -1031,12 +1026,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10311026 // where `ur` is a local bound -- we are sometimes in a
10321027 // position to prove things that our caller cannot. See
10331028 // #53570 for an example.
1034- if self . eval_verify_bound ( infcx, generic_ty, ur, & type_test . verify_bound ) {
1029+ if self . eval_verify_bound ( infcx, generic_ty, ur, & verify_bound) {
10351030 continue ;
10361031 }
10371032
10381033 let non_local_ub = self . universal_region_relations . non_local_upper_bounds ( ur) ;
1039- debug ! ( "try_promote_type_test: non_local_ub={:?}" , non_local_ub) ;
1034+ debug ! ( ? non_local_ub) ;
10401035
10411036 // This is slightly too conservative. To show T: '1, given `'2: '1`
10421037 // and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
@@ -1049,10 +1044,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10491044 let requirement = ClosureOutlivesRequirement {
10501045 subject,
10511046 outlived_free_region : upper_bound,
1052- blame_span : type_test . span ,
1047+ blame_span,
10531048 category : ConstraintCategory :: Boring ,
10541049 } ;
1055- debug ! ( "try_promote_type_test: pushing {:#?}" , requirement) ;
1050+ debug ! ( ?requirement , "adding closure requirement" ) ;
10561051 propagated_outlives_requirements. push ( requirement) ;
10571052 }
10581053 }
@@ -1063,44 +1058,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10631058 /// variables in the type `T` with an equal universal region from the
10641059 /// closure signature.
10651060 /// This is not always possible, so this is a fallible process.
1066- #[ instrument( level = "debug" , skip( self , infcx) ) ]
1061+ #[ instrument( level = "debug" , skip( self , infcx) , ret ) ]
10671062 fn try_promote_type_test_subject (
10681063 & self ,
10691064 infcx : & InferCtxt < ' tcx > ,
10701065 ty : Ty < ' tcx > ,
10711066 ) -> Option < ClosureOutlivesSubject < ' tcx > > {
10721067 let tcx = infcx. tcx ;
1073-
1074- // Opaque types' args may include useless lifetimes.
1075- // We will replace them with ReStatic.
1076- struct OpaqueFolder < ' tcx > {
1077- tcx : TyCtxt < ' tcx > ,
1078- }
1079- impl < ' tcx > ty:: TypeFolder < TyCtxt < ' tcx > > for OpaqueFolder < ' tcx > {
1080- fn cx ( & self ) -> TyCtxt < ' tcx > {
1081- self . tcx
1082- }
1083- fn fold_ty ( & mut self , t : Ty < ' tcx > ) -> Ty < ' tcx > {
1084- use ty:: TypeSuperFoldable as _;
1085- let tcx = self . tcx ;
1086- let & ty:: Alias ( ty:: Opaque , ty:: AliasTy { args, def_id, .. } ) = t. kind ( ) else {
1087- return t. super_fold_with ( self ) ;
1088- } ;
1089- let args = std:: iter:: zip ( args, tcx. variances_of ( def_id) ) . map ( |( arg, v) | {
1090- match ( arg. unpack ( ) , v) {
1091- ( ty:: GenericArgKind :: Lifetime ( _) , ty:: Bivariant ) => {
1092- tcx. lifetimes . re_static . into ( )
1093- }
1094- _ => arg. fold_with ( self ) ,
1095- }
1096- } ) ;
1097- Ty :: new_opaque ( tcx, def_id, tcx. mk_args_from_iter ( args) )
1098- }
1099- }
1100-
1101- let ty = ty. fold_with ( & mut OpaqueFolder { tcx } ) ;
11021068 let mut failed = false ;
1103-
11041069 let ty = fold_regions ( tcx, ty, |r, _depth| {
11051070 let r_vid = self . to_region_vid ( r) ;
11061071 let r_scc = self . constraint_sccs . scc ( r_vid) ;
0 commit comments