diff options
| author | lcnr <rust@lcnr.de> | 2024-12-04 17:12:57 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-12-04 17:18:11 +0100 |
| commit | 1228b38cbd1dfd2252fd89eb5badb1e123f0849a (patch) | |
| tree | 86fc0bf1c321d267b54f954944d7d804a2f573cd | |
| parent | baf4bb7100e770fb4cf052c07d408a9dd97d6e96 (diff) | |
| download | rust-1228b38cbd1dfd2252fd89eb5badb1e123f0849a.tar.gz rust-1228b38cbd1dfd2252fd89eb5badb1e123f0849a.zip | |
add assert
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index fd58de6497d..035c5210107 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -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); @@ -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 } |
