@@ -973,25 +973,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
973
973
propagated_outlives_requirements : & mut Vec < ClosureOutlivesRequirement < ' tcx > > ,
974
974
) -> bool {
975
975
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;
978
977
979
978
let generic_ty = generic_kind. to_ty ( tcx) ;
980
979
let Some ( subject) = self . try_promote_type_test_subject ( infcx, generic_ty) else {
981
980
return false ;
982
981
} ;
983
982
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) ;
988
984
debug ! (
989
985
"lower_bound = {:?} r_scc={:?} universe={:?}" ,
990
986
lower_bound,
991
987
r_scc,
992
988
self . constraint_sccs. annotation( r_scc) . min_universe( )
993
989
) ;
994
-
995
990
// If the type test requires that `T: 'a` where `'a` is a
996
991
// placeholder from another universe, that effectively requires
997
992
// `T: 'static`, so we have to propagate that requirement.
@@ -1004,7 +999,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1004
999
propagated_outlives_requirements. push ( ClosureOutlivesRequirement {
1005
1000
subject,
1006
1001
outlived_free_region : static_r,
1007
- blame_span : type_test . span ,
1002
+ blame_span,
1008
1003
category : ConstraintCategory :: Boring ,
1009
1004
} ) ;
1010
1005
@@ -1031,12 +1026,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1031
1026
// where `ur` is a local bound -- we are sometimes in a
1032
1027
// position to prove things that our caller cannot. See
1033
1028
// #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) {
1035
1030
continue ;
1036
1031
}
1037
1032
1038
1033
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) ;
1040
1035
1041
1036
// This is slightly too conservative. To show T: '1, given `'2: '1`
1042
1037
// and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
@@ -1049,10 +1044,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1049
1044
let requirement = ClosureOutlivesRequirement {
1050
1045
subject,
1051
1046
outlived_free_region : upper_bound,
1052
- blame_span : type_test . span ,
1047
+ blame_span,
1053
1048
category : ConstraintCategory :: Boring ,
1054
1049
} ;
1055
- debug ! ( "try_promote_type_test: pushing {:#?}" , requirement) ;
1050
+ debug ! ( ?requirement , "adding closure requirement" ) ;
1056
1051
propagated_outlives_requirements. push ( requirement) ;
1057
1052
}
1058
1053
}
@@ -1063,44 +1058,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1063
1058
/// variables in the type `T` with an equal universal region from the
1064
1059
/// closure signature.
1065
1060
/// 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 ) ]
1067
1062
fn try_promote_type_test_subject (
1068
1063
& self ,
1069
1064
infcx : & InferCtxt < ' tcx > ,
1070
1065
ty : Ty < ' tcx > ,
1071
1066
) -> Option < ClosureOutlivesSubject < ' tcx > > {
1072
1067
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 } ) ;
1102
1068
let mut failed = false ;
1103
-
1104
1069
let ty = fold_regions ( tcx, ty, |r, _depth| {
1105
1070
let r_vid = self . to_region_vid ( r) ;
1106
1071
let r_scc = self . constraint_sccs . scc ( r_vid) ;
0 commit comments