-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=est…
…ebank Account for item-local in inner scope for E0425 Fixes #104700
- Loading branch information
Showing
4 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
fn main() { | ||
let foo = 1; | ||
{ | ||
let bar = 2; | ||
let test_func = |x| x > 3; | ||
} | ||
if bar == 2 { //~ ERROR cannot find value | ||
println!("yes"); | ||
} | ||
test_func(1); //~ ERROR cannot find function | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0425]: cannot find value `bar` in this scope | ||
--> $DIR/issue-104700-inner_scope.rs:7:8 | ||
| | ||
LL | if bar == 2 { | ||
| ^^^ | ||
| | ||
help: the binding `bar` is available in a different scope in the same function | ||
--> $DIR/issue-104700-inner_scope.rs:4:13 | ||
| | ||
LL | let bar = 2; | ||
| ^^^ | ||
|
||
error[E0425]: cannot find function `test_func` in this scope | ||
--> $DIR/issue-104700-inner_scope.rs:10:5 | ||
| | ||
LL | test_func(1); | ||
| ^^^^^^^^^ not found in this scope | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0425`. |