Skip to content

Commit 7418fa9

Browse files
committed
resolve: Add one more test case for "binding is available in a different scope" help
1 parent 4c4c3d5 commit 7418fa9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tests/ui/resolve/issue-104700-inner_scope.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ fn main() {
77
if bar == 2 { //~ ERROR cannot find value
88
println!("yes");
99
}
10+
{
11+
let baz = 3;
12+
struct S;
13+
}
14+
if baz == 3 { //~ ERROR cannot find value
15+
println!("yes");
16+
}
1017
test_func(1); //~ ERROR cannot find function
1118
}

tests/ui/resolve/issue-104700-inner_scope.stderr

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@ help: the binding `bar` is available in a different scope in the same function
1010
LL | let bar = 2;
1111
| ^^^
1212

13+
error[E0425]: cannot find value `baz` in this scope
14+
--> $DIR/issue-104700-inner_scope.rs:14:8
15+
|
16+
LL | if baz == 3 {
17+
| ^^^
18+
|
19+
help: the binding `baz` is available in a different scope in the same function
20+
--> $DIR/issue-104700-inner_scope.rs:11:13
21+
|
22+
LL | let baz = 3;
23+
| ^^^
24+
1325
error[E0425]: cannot find function `test_func` in this scope
14-
--> $DIR/issue-104700-inner_scope.rs:10:5
26+
--> $DIR/issue-104700-inner_scope.rs:17:5
1527
|
1628
LL | test_func(1);
1729
| ^^^^^^^^^ not found in this scope
1830

19-
error: aborting due to 2 previous errors
31+
error: aborting due to 3 previous errors
2032

2133
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)