-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: if_let_guard + mir drop tracking: broken mir #116079
Labels
-Zvalidate-mir
Unstable option: MIR validation
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-bug
Category: This is a bug.
F-if_let_guard
`#![feature(if_let_guard)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Backtrace
|
Smaller, sync version (flags are #![feature(if_let_guard)]
fn f(x: bool) {
match x {
_ => (),
_ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
_ => (),
}
} |
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 23, 2023
Rollup merge of rust-lang#119077 - tmiasko:lint, r=cjgillot Separate MIR lints from validation Add a MIR lint pass, enabled with -Zlint-mir, which identifies undefined or likely erroneous behaviour. The initial implementation mostly migrates existing checks of this nature from MIR validator, where they did not belong (those checks have false positives and there is nothing inherently invalid about MIR with undefined behaviour). Fixes rust-lang#104736 Fixes rust-lang#104843 Fixes rust-lang#116079 Fixes rust-lang#116736 Fixes rust-lang#118990
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 25, 2023
…r=TaKO8Ki Give temporaries in if let guards correct scopes Temporaries in if-let guards have scopes that escape the match arm, this causes problems because the drops might be for temporaries that are not storage live. This PR changes the scope of temporaries in if-let guards to be limited to the arm: ```rust _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} // Temporary for Some(String::new()) is dropped here ^ ``` We also now deduplicate temporaries between copies of the guard created for or-patterns: ```rust // Only create a single Some(String::new()) temporary variable _ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {} ``` This changes MIR building to pass around `ExprId`s rather than `Expr`s so that we have a way to index different expressions. cc rust-lang#51114 Closes rust-lang#116079
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
-Zvalidate-mir
Unstable option: MIR validation
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-bug
Category: This is a bug.
F-if_let_guard
`#![feature(if_let_guard)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
rustc -Zvalidate-mir -Zdrop-tracking-mir=yes --edition=2018
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: