about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2025-08-11 19:10:45 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2025-08-14 18:50:58 +0300
commitf369e066e697511063a2434dbd5bfdb82dc06794 (patch)
tree03498161b3cb28627e3a2a189cf01b5067aef2c9
parent16529158168ade04d0646524177e67c766c39e6c (diff)
resolve: Add one more test case for "binding is available in a different scope" help
-rw-r--r--tests/ui/resolve/issue-104700-inner_scope.rs7
-rw-r--r--tests/ui/resolve/issue-104700-inner_scope.stderr16
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/ui/resolve/issue-104700-inner_scope.rs b/tests/ui/resolve/issue-104700-inner_scope.rs
index e8f28c113e3..fb77ab2626b 100644
--- a/tests/ui/resolve/issue-104700-inner_scope.rs
+++ b/tests/ui/resolve/issue-104700-inner_scope.rs
@@ -7,5 +7,12 @@ fn main() {
     if bar == 2 { //~ ERROR cannot find value
         println!("yes");
     }
+    {
+        let baz = 3;
+        struct S;
+    }
+    if baz == 3 { //~ ERROR cannot find value
+        println!("yes");
+    }
     test_func(1); //~ ERROR cannot find function
 }
diff --git a/tests/ui/resolve/issue-104700-inner_scope.stderr b/tests/ui/resolve/issue-104700-inner_scope.stderr
index 051b234fc72..b579f8e76d9 100644
--- a/tests/ui/resolve/issue-104700-inner_scope.stderr
+++ b/tests/ui/resolve/issue-104700-inner_scope.stderr
@@ -10,12 +10,24 @@ help: the binding `bar` is available in a different scope in the same function
 LL |         let bar = 2;
    |             ^^^
 
+error[E0425]: cannot find value `baz` in this scope
+  --> $DIR/issue-104700-inner_scope.rs:14:8
+   |
+LL |     if baz == 3 {
+   |        ^^^
+   |
+help: the binding `baz` is available in a different scope in the same function
+  --> $DIR/issue-104700-inner_scope.rs:11:13
+   |
+LL |         let baz = 3;
+   |             ^^^
+
 error[E0425]: cannot find function `test_func` in this scope
-  --> $DIR/issue-104700-inner_scope.rs:10:5
+  --> $DIR/issue-104700-inner_scope.rs:17:5
    |
 LL |     test_func(1);
    |     ^^^^^^^^^ not found in this scope
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0425`.