diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-08-30 13:51:09 +0000 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2023-08-30 13:51:09 +0000 |
| commit | a725436c292c8a2b379b9b1d328af88585ab9a30 (patch) | |
| tree | f582016214146ccad576fcbc444fb24c66b82239 | |
| parent | 7659abc63d33223fa366c8781c81698e28a21e6c (diff) | |
| download | rust-a725436c292c8a2b379b9b1d328af88585ab9a30.tar.gz rust-a725436c292c8a2b379b9b1d328af88585ab9a30.zip | |
return default `UniverseInfo` cause in `RegionInferenceContext`
Query canonicalization can create local super-universes without causes, creating ICEs when accessed during diagnostics.
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/mod.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index b8cd94e5422..1049e7a8bbe 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -2249,7 +2249,14 @@ impl<'tcx> RegionInferenceContext<'tcx> { } pub(crate) fn universe_info(&self, universe: ty::UniverseIndex) -> UniverseInfo<'tcx> { - self.universe_causes[&universe].clone() + // Query canonicalization can create local superuniverses (for example in + // `InferCtx::query_response_substitution_guess`), but they don't have an associated + // `UniverseInfo` explaining why they were created. + // This can cause ICEs if these causes are accessed in diagnostics, for example in issue + // #114907 where this happens via liveness and dropck outlives results. + // Therefore, we return a default value in case that happens, which should at worst emit a + // suboptimal error, instead of the ICE. + self.universe_causes.get(&universe).cloned().unwrap_or_else(|| UniverseInfo::other()) } /// Tries to find the terminator of the loop in which the region 'r' resides. |
