File tree 1 file changed +7
-0
lines changed
compiler/rustc_borrowck/src/region_infer
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1011,7 +1011,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1011
1011
// For each region outlived by lower_bound find a non-local,
1012
1012
// universal region (it may be the same region) and add it to
1013
1013
// `ClosureOutlivesRequirement`.
1014
+ let mut found_outlived_universal_region = false ;
1014
1015
for ur in self . scc_values . universal_regions_outlived_by ( r_scc) {
1016
+ found_outlived_universal_region = true ;
1015
1017
debug ! ( "universal_region_outlived_by ur={:?}" , ur) ;
1016
1018
let non_local_ub = self . universal_region_relations . non_local_upper_bounds ( ur) ;
1017
1019
debug ! ( ?non_local_ub) ;
@@ -1034,6 +1036,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1034
1036
propagated_outlives_requirements. push ( requirement) ;
1035
1037
}
1036
1038
}
1039
+ // If we succeed to promote the subject, i.e. it only contains non-local regions,
1040
+ // and fail to prove the type test inside of the closure, the `lower_bound` has to
1041
+ // also be at least as large as some universal region, as the type test is otherwise
1042
+ // trivial.
1043
+ assert ! ( found_outlived_universal_region) ;
1037
1044
true
1038
1045
}
1039
1046
You can’t perform that action at this time.
0 commit comments