Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebank
Fix unused_assignments false positive
Fixes #22630.
In liveness analysis, make `continue` jump to the loop condition's `LiveNode` (`cond` as in comment) instead of the loop's one (`expr`).
069b0c4108/src/librustc/middle/liveness.rs (L1358-L1370)
This commit is contained in:
commit
0dd4bfa356
2 changed files with 15 additions and 23 deletions
|
|
@ -27,4 +27,13 @@ fn f5(mut x: i32) {
|
|||
x = 4; //~ ERROR: value assigned to `x` is never read
|
||||
}
|
||||
|
||||
// #22630
|
||||
fn f6() {
|
||||
let mut done = false;
|
||||
while !done {
|
||||
done = true; // no error
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue