-
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
Broken MIR ICE with let chains #104843
Comments
@rustbot label F-let_chains |
searched nightlies: from nightly-2022-07-20 to nightly-2022-11-23 bisected with cargo-bisect-rustc v0.6.4Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --end=2022-11-23 --regress=ice -- rustc -- -Zvalidate-mir -O |
Looks like #103034 didn't fix everything after all..... @nathanwhit |
@rustbot label -E-needs-bisection |
Thanks for opening an issue for this! I put that on my todo list, but my todo list is just way to long... |
@rustbot claim |
I have a feeling that the |
Here is a summary of the cause. The scrutinees of the I am going to try moving their temporary lifetimes to The following example passes The issue that the MIR validation does not catch this shall be addressed separately and I am very intrigued. #![feature(let_chains)]
struct F(Box<()>);
struct G;
impl Drop for G {
fn drop(&mut self) {}
}
impl F {
fn s(&self) -> Option<G> {
None
}
}
fn cex() -> Option<F> {
None
}
pub fn main() {
if let Some(ce) = cex() && let Some(ce2) = ce.s()
{
}
} |
Note that regarding drop order, for now, until #103108 is addressed, we should drop all the |
This is still happening on the nightly release, @dingxiangfei2009 did you came up with something? This seems to be blocking the let-chaining features from stabilizing |
There is #107251 which would solve this. I haven't had the time to push it forward, but the next logical step would be to file PRs to the repos broken by the PR, not suggesting that this will break eventually, as the only time when this is 100% sure is when this PR is merged, but that there is the chance it might break. See the thread of #107251. The other blocker is formatting support, which depends on the style team. Edit: feel free to file the PRs if you want. |
I will update the draft that @est31 mentioned. |
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
Btw, this still ICEs if you pass |
Originally reported by @flip1995 in #99938 (comment) .
Code
Error output
Backtrace
The ICE requires
-O
to be passed to rustc, or--release
be passed to cargo, the param to validate MIR is not enough. It's also a regression, onnightly-2022-07-30
it does not reproduce.cc #99938 and #99852 related issues with similar error messages, but they are fixed and this is reproducible.
@rustbot label E-needs-bisection
The text was updated successfully, but these errors were encountered: