about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-27 06:11:55 +0100
committerGitHub <noreply@github.com>2023-02-27 06:11:55 +0100
commitbade5566daab631611ec7bb47cea7ddf154ee27b (patch)
tree3f985f8bcf10958a89e1d5e717240b5fb6915a80 /compiler
parent37338b8d996b05864d74d0a71b2c173bc41f890d (diff)
parent65e56616fc71744b20b02622200d42860561b20c (diff)
Rollup merge of #108502 - lenko-d:cannot_relate_region, r=compiler-errors
Don't trigger error for ReError when other region is empty.

Fixes [#107988](https://github.com/rust-lang/rust/issues/107988)
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);
                     }