-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exit arm scopes correctly in the HIR CFG
When a match evaluates to false we jump to the next arm, when we do so we need to make sure that we exit the scope for that arm.
- Loading branch information
1 parent
db6f77f
commit de5c6ec
Showing
3 changed files
with
28 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fn main() { | ||
let e: i32; | ||
match e { | ||
//~^ ERROR use of possibly uninitialized variable | ||
ref u if true => {} | ||
ref v if true => { | ||
let tx = 0; | ||
&tx; | ||
} | ||
_ => (), | ||
} | ||
} |
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,9 @@ | ||
error[E0381]: use of possibly uninitialized variable: `e` | ||
--> $DIR/issue-62107-match-arm-scopes.rs:3:11 | ||
| | ||
LL | match e { | ||
| ^ use of possibly uninitialized `e` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0381`. |