With:
fn _f() {
let _x = 'label: while break 'label {};
}
we get:
warning[E0384]: cannot assign twice to immutable variable `_x`
--> src/lib.rs:2:14
|
2 | let _x = 'label: while break 'label {};
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
| |
| first assignment to `_x`
| help: make this binding mutable: `mut _x`
|
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
= note: for more information, try `rustc --explain E0729`
This seems wrong. At least from a source view, _x is assigned to once.
Current MIR dump:
fn _f() -> () {
let mut _0: (); // return place in scope 0 at src/lib.rs:1:9: 1:9
let _1: (); // "_x" in scope 0 at src/lib.rs:2:9: 2:11
scope 1 {
}
bb0: {
StorageLive(_1); // bb0[0]: scope 0 at src/lib.rs:2:9: 2:11
StorageDead(_1); // bb0[1]: scope 0 at src/lib.rs:3:1: 3:2
return; // bb0[2]: scope 0 at src/lib.rs:3:2: 3:2
}
}
This might possibly be fixed by #61988.
cc @eddyb @pnkfelix @matthewjasper
With:
we get:
This seems wrong. At least from a source view,
_xis assigned to once.Current MIR dump:
This might possibly be fixed by #61988.
cc @eddyb @pnkfelix @matthewjasper