-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ICE: Broken MIR in Item(...) with let_else
usage (use of local which has no storage here)
#102317
Comments
(I forgot to mention it in the original issue, but the |
@rustbot label +E-needs-mcve |
Oh nvm this has an MCVE already lol |
Oh yeah this is the complete code - here's my repo for it, pinned toolchain and all: https://github.com/fasterthanlime/broken-mir |
The issue seems to not affect |
Given that it is both a scoping problem, and lint related, this might be fixed by #102257. If that PR is the fix, we should maybe backport it to beta. |
Tested it with the rust playground and was only able to get the ICE to trigger for release mode and not debug mode builds (current latest nightly). @rustbot label +T-compiler +I-ICE +F-let-else +requires-nightly |
That's true for |
On a side note why is the let else label not delimited by a |
The ICE can also be reproduced with |
Oh it seems to issue the ICE if you are both in release mode and you use the "Build" feature of the playground. I've tried using the "Run" feature in release mode but it didn't issue the ICE. The playground changes automatically from "Run" to "Build" if you remove the main function, but in this instance I'd added a |
Interestingly dropping the @rustbot claim |
Okay I have locally applied #102257 and and the PR does not fix this issue, still there. |
FTR this is the test file I've used (might be helpful for @dingxiangfei2009 ): // issue #102317
// run-pass
// compile-flags: --edition 2021 -C opt-level=3 -Zvalidate-mir
struct SegmentJob {
spec: String,
}
pub async fn run() -> Result<(), ()> {
let jobs = Vec::<SegmentJob>::new();
let Some(job) = jobs.into_iter().next() else {
return Ok(())
};
Ok(())
}
fn main() {} |
Removing |
@est31 investigating unwind drops introduced by |
This might be the same problem as #99852. I have looked into this before with @JakobDegen, which lead us to discover #100513. I have no idea what exactly is wrong in the code though, it's very complicated. |
Oops, accidentally added that. My bad. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
…-obk Fix unwind drop glue for if-then scopes cc `@est31` Fix rust-lang#102317 Fix rust-lang#99852 This PR fixes the drop glue for unwinding from a panic originated in a drop while breaking out for the else block in an `if-then` scope. MIR validation does not fail for the synchronous versions of the test program, because `StorageDead` statements are skipped over in the unwinding process. It is only becoming a problem when it is inside a generator where `StorageDead` must be kept around.
Reminiscent of #99975, which is now closed, but I'm able to reproduce it easily on today's nightly:
I expected to see this happen: typechecks fine.
Instead, this happened:
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: