Skip to content

Commit 1228b38

Browse files
committed
add assert
1 parent baf4bb7 commit 1228b38

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_borrowck/src/region_infer

1 file changed

+7
-0
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10111011
// For each region outlived by lower_bound find a non-local,
10121012
// universal region (it may be the same region) and add it to
10131013
// `ClosureOutlivesRequirement`.
1014+
let mut found_outlived_universal_region = false;
10141015
for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
1016+
found_outlived_universal_region = true;
10151017
debug!("universal_region_outlived_by ur={:?}", ur);
10161018
let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
10171019
debug!(?non_local_ub);
@@ -1034,6 +1036,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10341036
propagated_outlives_requirements.push(requirement);
10351037
}
10361038
}
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);
10371044
true
10381045
}
10391046

0 commit comments

Comments
 (0)