Skip to content

Commit

Permalink
add assert
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 4, 2024
1 parent baf4bb7 commit 1228b38
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// For each region outlived by lower_bound find a non-local,
// universal region (it may be the same region) and add it to
// `ClosureOutlivesRequirement`.
let mut found_outlived_universal_region = false;
for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
found_outlived_universal_region = true;
debug!("universal_region_outlived_by ur={:?}", ur);
let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
debug!(?non_local_ub);
Expand All @@ -1034,6 +1036,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
propagated_outlives_requirements.push(requirement);
}
}
// If we succeed to promote the subject, i.e. it only contains non-local regions,
// and fail to prove the type test inside of the closure, the `lower_bound` has to
// also be at least as large as some universal region, as the type test is otherwise
// trivial.
assert!(found_outlived_universal_region);
true
}

Expand Down

0 comments on commit 1228b38

Please sign in to comment.