-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StorageLive is added on a local that was already live #88649
Comments
It looks like the issue is that the locals are marked as live during the loop, which means that each iteration they get marked as live again. |
Regression is in nightly-2021-09-04. Commit range: 371f3cd...b7404c8 Confirmed that #88572 is the cause by checking locally with CI artifacts. |
Here's a diff of the MIR for the MCVE before and after #88572 (note that all of the changes are from statements being moved around): diff --git a/mir_dump-old/foo.main.-------.mir_map.0.mir b/mir_dump-new/foo.main.-------.mir_map.0.mir
index 468567de..4f94cb3e 100644
--- a/mir_dump-old/foo.main.-------.mir_map.0.mir
+++ b/mir_dump-new/foo.main.-------.mir_map.0.mir
@@ -53,6 +53,7 @@ fn main() -> () {
bb7: {
_2 = const (); // scope 1 at foo.rs:9:57: 9:59
StorageDead(_6); // scope 0 at foo.rs:9:58: 9:59
+ StorageDead(_9); // scope 0 at foo.rs:9:58: 9:59
StorageDead(_7); // scope 0 at foo.rs:9:58: 9:59
goto -> bb16; // scope 0 at foo.rs:9:58: 9:59
}
@@ -67,7 +68,6 @@ fn main() -> () {
}
bb9: {
- StorageDead(_8); // scope 0 at foo.rs:9:58: 9:59
FakeRead(ForMatchGuard, _5); // scope 0 at foo.rs:9:52: 9:53
FakeRead(ForGuardBinding, _7); // scope 0 at foo.rs:9:52: 9:53
StorageLive(_6); // scope 0 at foo.rs:9:27: 9:28
@@ -76,12 +76,12 @@ fn main() -> () {
}
bb10: {
- StorageDead(_8); // scope 0 at foo.rs:9:58: 9:59
- StorageDead(_7); // scope 0 at foo.rs:9:58: 9:59
goto -> bb11; // scope 0 at foo.rs:9:52: 9:53
}
bb11: {
+ StorageDead(_8); // scope 0 at foo.rs:9:58: 9:59
+ StorageDead(_7); // scope 0 at foo.rs:9:58: 9:59
falseEdge -> [real: bb4, imaginary: bb5]; // scope 0 at foo.rs:9:52: 9:53
}
@@ -95,7 +95,6 @@ fn main() -> () {
}
bb13: {
- StorageDead(_9); // scope 0 at foo.rs:9:58: 9:59
FakeRead(ForMatchGuard, _5); // scope 0 at foo.rs:9:52: 9:53
FakeRead(ForGuardBinding, _7); // scope 0 at foo.rs:9:52: 9:53
StorageLive(_6); // scope 0 at foo.rs:9:46: 9:47
@@ -104,12 +103,12 @@ fn main() -> () {
}
bb14: {
- StorageDead(_9); // scope 0 at foo.rs:9:58: 9:59
- StorageDead(_7); // scope 0 at foo.rs:9:58: 9:59
goto -> bb15; // scope 0 at foo.rs:9:52: 9:53
}
bb15: {
+ StorageDead(_9); // scope 0 at foo.rs:9:58: 9:59
+ StorageDead(_7); // scope 0 at foo.rs:9:58: 9:59
falseEdge -> [real: bb6, imaginary: bb4]; // scope 0 at foo.rs:9:52: 9:53
} |
Yeah, these storage markers are supposed to be used in a well-bracketed way... I can only make wild guesses for what LLVM will do with them otherwise.^^ @matthewjasper any idea how hard this will be to fix? Miri will be at least partially broken until this issue is resolved. |
Also Cc @oli-obk |
Add a regression test for rust-lang#88649 I noticed that rust-lang#88649 does not have a regression test, so I add one in this PR. The test fails with this without rust-lang#88678: ``` error[E0080]: evaluation of constant value failed --> /checkout/src/test/ui/consts/issue-88649.rs:13:52 | LL | Foo::Variant1(x) | Foo::Variant2(x) if x => {} | ^ StorageLive on a local that was already live error: aborting due to previous error For more information about this error, try `rustc --explain E0080`. ```
Rollup of 9 pull requests Successful merges: - rust-lang#86263 (Rustdoc: Report Layout of enum variants) - rust-lang#88541 (Add regression test for rust-lang#74400) - rust-lang#88553 (Improve diagnostics for unary plus operators (rust-lang#88276)) - rust-lang#88594 (More symbolic doc aliases) - rust-lang#88648 (Correct “copies” to “moves” in `<Option<T> as From<T>>::from` doc, and other copyediting) - rust-lang#88691 (Add a regression test for rust-lang#88649) - rust-lang#88694 (Drop 1.56 stabilizations from 1.55 release notes) - rust-lang#88712 (Fix docs for `uX::checked_next_multiple_of`) - rust-lang#88726 (Fix typo in `const_generics` replaced with `adt_const_params` note) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
(cherry picked from commit 214eef0)
[beta] backports - rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields rust-lang#88639 - Fix 2021 `dyn` suggestion that used code as label rust-lang#88657 - Workaround blink/chromium grid layout limitation of 1000 rows rust-lang#88776 - Change scope of temporaries in match guards rust-lang#88678 - Add a regression test for rust-lang#88649 rust-lang#88691 - Revert anon union parsing rust-lang#88775 - Disable validate_maintainers. rust-lang#88977 Also drop stage0 rustfmt, because that's only supposed to be used on master. r? `@Mark-Simulacrum`
Miri's CI started failing recently, with an error similar to:
It seems likely that this is a regression from #88572. cc @matthewjasper
Thanks to @hyd-dev for doing the original minimization.
MCVE
Generated MIR (from right after building)
EDIT: updated the MIR output so it's from the latest nightly
The text was updated successfully, but these errors were encountered: