resolve: Add one more test case for "binding is available in a different scope" help

This commit is contained in:
Vadim Petrochenkov 2025-08-11 19:10:45 +03:00
parent 1652915816
commit f369e066e6
2 changed files with 21 additions and 2 deletions

View file

@ -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
}

View file

@ -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`.