-
Notifications
You must be signed in to change notification settings - Fork 13k
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 with let_chains
#122871
Comments
Indeed looks very similar to #99852 which was fixed in #102394. Minimized: #![feature(let_chains)]
struct Struct;
impl Drop for Struct {
fn drop(&mut self) {}
}
fn main() {
if true
&& let _ = Struct
{}
} This is the first pass that errors:
Here's a MIR that errors, taken in a later phase for convenience:
// MIR for `main` after SimplifyCfg-pre-optimizations
fn main() -> () {
let mut _0: ();
let mut _1: bool;
let mut _2: Struct;
let mut _3: bool;
bb0: {
_3 = const false;
StorageLive(_1);
_1 = const true;
switchInt(move _1) -> [0: bb2, otherwise: bb1];
}
bb1: {
StorageLive(_2);
_3 = const true;
_2 = Struct;
_0 = const ();
goto -> bb3;
}
bb2: {
_0 = const ();
goto -> bb3;
}
bb3: {
StorageDead(_1);
switchInt(_3) -> [0: bb4, otherwise: bb6];
}
bb4: {
_3 = const false;
StorageDead(_2);
return;
}
bb5 (cleanup): {
resume;
}
bb6: {
drop(_2) -> [return: bb4, unwind: bb5];
}
} version: |
The error is pretty clear: when testing the boolean, if found Indeed this no longer errors: #![feature(let_chains)]
struct Struct;
impl Drop for Struct {
fn drop(&mut self) {}
}
fn main() {
let s = Struct;
if true
&& let _ = s
{}
} |
Ah, this is actually an issue with |
triage: neither the original repro or the minimized version cause any form of error in the latest nightly |
@lolbinarycat did you try with |
just tried it with |
Nice, thanks for checking 👍 |
Code
Meta
rustc --version --verbose
:Error output
command
rustc EDF91430837E67F42912F85F184235C09E30358C3D226F98C2B0098353056538.rs '-Zlint-mir'
full backtrace is very long (about 3000 lines)
you can see it in here
Backtrace
seems like bug occured at visit_local and it's different one from #120421 visit_statement and visit_terminator
The text was updated successfully, but these errors were encountered: