Fix incorrect double assignment in MIR for while loops
This commit is contained in:
parent
5f9c0448dd
commit
62bec71446
2 changed files with 25 additions and 6 deletions
11
src/test/ui/nll/assign-while-to-immutable.rs
Normal file
11
src/test/ui/nll/assign-while-to-immutable.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// We used to incorrectly assign to `x` twice when generating MIR for this
|
||||
// function, preventing this from compiling.
|
||||
|
||||
// check-pass
|
||||
|
||||
fn main() {
|
||||
let x = while false {
|
||||
break;
|
||||
};
|
||||
let y = 'l: while break 'l {};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue