Skip to content

Commit 9852f2e

Browse files
committed
false positive
maybe we need to modify liveness analysis
1 parent d860d45 commit 9852f2e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/ui/explicit_reinitialization.fixed

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,17 @@ fn known_false_negative() {
9696
println!("{x}");
9797
}
9898

99+
fn false_positive() {
100+
let mut x = 1;
101+
println!("{x}");
102+
103+
if true {
104+
x = 2;
105+
println!("{x}");
106+
} else {
107+
x = 3;
108+
println!("{x}");
109+
}
110+
}
111+
99112
fn main() {}

tests/ui/explicit_reinitialization.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,17 @@ fn known_false_negative() {
9696
println!("{x}");
9797
}
9898

99+
fn false_positive() {
100+
let mut x = 1;
101+
println!("{x}");
102+
103+
if true {
104+
x = 2;
105+
println!("{x}");
106+
} else {
107+
x = 3;
108+
println!("{x}");
109+
}
110+
}
111+
99112
fn main() {}

0 commit comments

Comments
 (0)