-
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.
[const-prop] Correctly handle locals that can't be propagated
`const_prop()` now handles writing the Rvalue into the Place in the stack frame for us. So if we're not supported to propagate that value, we need to clear it.
- Loading branch information
1 parent
f2023ac
commit 3a8932d
Showing
3 changed files
with
28 additions
and
29 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,15 @@ | ||
// run-pass | ||
|
||
fn main() { | ||
foo(10); | ||
} | ||
|
||
fn foo(mut n: i32) { | ||
if false { | ||
n = 0i32; | ||
} | ||
|
||
if n > 0i32 { | ||
1i32 / n; | ||
} | ||
} |
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,8 @@ | ||
warning: unused arithmetic operation that must be used | ||
--> $DIR/issue-64970.rs:13:9 | ||
| | ||
LL | 1i32 / n; | ||
| ^^^^^^^^ | ||
| | ||
= note: `#[warn(unused_must_use)]` on by default | ||
|