-
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 with if let chain
#99938
Comments
Thank you for you report, but this is probably a duplicate of #99852 |
Can confirm this no longer ICEs on most recent nightly: |
@rustbot label +E-needs-test |
We just hit this during the Clippy sync in #104688 (comment) The offending code was this: rust/src/tools/clippy/src/driver.rs Lines 93 to 98 in 2422802
Pulling the rust/src/tools/clippy/src/driver.rs Lines 93 to 99 in 5e6a9a4
|
Hmm, I can do this, but I think that is actually the same issue. While the above reproducer might be fixed, the fix doesn't seem to generally apply. The above code produced the exact same ICE/error message as posted in this issue. |
@flip1995 I think this might be some MIR optimization gone wrong, maybe caused by wrong codegen, but your issue requires optimizations to be turned on, it can't just be reproduced by The original ICE was also reproducible by Some additional info to your issue, this is a reproducer: #![feature(let_chains)]
pub fn foo() {
if false
&& let Ok(ce) = std::env::current_exe()
&& let Some(ce) = ce.to_str()
{
let _ = ce.len();
}
} Interestingly, the issue is a regression, as it didn't ICE on Edit: I very much appreciate the notion of not wanting to file multiple issues, after all this very issue is a dupe, but the clippy bug is separate. |
This isn't because of MIR opts, it only happens under |
@Nilstrieb is this storage markers emitting only in release a new feature? Because I can reproduce the ICE with the original reproducer from this issue's author, with |
…, r=davidtwco Add regression test for issue rust-lang#99938 That issue was a dupe of rust-lang#99852, and it got fixed since, but it's always better to have multiple regression tests rather than one. closes rust-lang#99938
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#103908 (Suggest `.clone()` or `ref binding` on E0382) - rust-lang#104517 (Throw error on failure in loading llvm-plugin) - rust-lang#104594 (Properly handle `Pin<&mut dyn* Trait>` receiver in codegen) - rust-lang#104742 (Make `deref_into_dyn_supertrait` lint the impl and not the usage) - rust-lang#104753 (Pass `InferCtxt` to `DropRangeVisitor` so we can resolve vars) - rust-lang#104771 (Add regression test for issue rust-lang#99938) - rust-lang#104772 (Small accessibility improvements) - rust-lang#104775 (Use ObligationCtxt::normalize) - rust-lang#104778 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Recently I played with the newly stabilized
if let chain
(tracker for issue #53667, stabilized in Rust 1.64 #94927) and found that in some cases it givesinternal compiler error: broken MIR
. Below is a minimal example. It compiles fine withcargo build
orcargo run
, but does not compile withcargo build --release
. It also compiles if you replaceif let chain
with nestedif let
.Code
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: