about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorLenko Donchev <lenko.donchev@gmail.com>2023-02-26 12:51:49 -0600
committerLenko Donchev <lenko.donchev@gmail.com>2023-02-26 20:47:18 -0600
commit65e56616fc71744b20b02622200d42860561b20c (patch)
tree64af9790469e71758fb22a8d4e96214ca5b36da9 /compiler
parent58136ffa92c81ec9e6ac1f91773254914da2ca01 (diff)
downloadrust-65e56616fc71744b20b02622200d42860561b20c.tar.gz
rust-65e56616fc71744b20b02622200d42860561b20c.zip
Don't trigger ICE for ReError when the other region is empty.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
index 335eb4c5406..a499018d3a2 100644
--- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
+++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
@@ -438,7 +438,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             }
             (VarValue::Value(a), VarValue::Empty(_)) => {
                 match *a {
-                    ReLateBound(..) | ReErased | ReError(_) => {
+                    // this is always on an error path,
+                    // so it doesn't really matter if it's shorter or longer than an empty region
+                    ReError(_) => false,
+
+                    ReLateBound(..) | ReErased => {
                         bug!("cannot relate region: {:?}", a);
                     }
 
@@ -467,7 +471,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
             }
             (VarValue::Empty(a_ui), VarValue::Value(b)) => {
                 match *b {
-                    ReLateBound(..) | ReErased | ReError(_) => {
+                    // this is always on an error path,
+                    // so it doesn't really matter if it's shorter or longer than an empty region
+                    ReError(_) => false,
+
+                    ReLateBound(..) | ReErased => {
                         bug!("cannot relate region: {:?}", b);
                     }