Skip to content
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 when using exhaustive_patterns without never_type #51221

Closed
jleedev opened this issue May 30, 2018 · 2 comments · Fixed by #62405
Closed

ICE when using exhaustive_patterns without never_type #51221

jleedev opened this issue May 30, 2018 · 2 comments · Fixed by #62405
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jleedev
Copy link

jleedev commented May 30, 2018

~$ cat a.rs 
#![feature(exhaustive_patterns)]
fn main() {
    enum Void {}
    let a: Option<Void> = None;
    let None = a;
}
~$ rustc +nightly a.rs
error: internal compiler error: librustc_mir/build/matches/mod.rs:225: match pairs [MatchPair { place: _1, pattern: Pattern { ty: std::option::Option<main::Void>, span: a.rs:5:9: 5:13, kind: Variant { adt_def: std::option::Option, substs: [main::Void], variant_index: 0, subpatterns: [] } }, slice_len_checked: false }] remaining after simplifying irrefutable pattern
 --> a.rs:5:9
  |
5 |     let None = a;
  |         ^^^^

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:499:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.28.0-nightly (524ad9b9e 2018-05-29) running on x86_64-apple-darwin

👉	101

This compiles successfully with #![feature(exhaustive_patterns,never_type)]. It's possible that this regressed when the two features were separated. It's also possible that stabilizing never_type first will make this issue moot.

@csmoe csmoe added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 1, 2018
@hellow554
Copy link
Contributor

hellow554 commented May 13, 2019

I'm very surprised that this is still open. @jonas-schievink can you add the I-nomiated flag please, if you think it's appropriate here?

@rustbot modify labels: T-compiler C-Bug

@rustbot rustbot added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 13, 2019
@jonas-schievink jonas-schievink added the A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label May 13, 2019
@jonas-schievink
Copy link
Contributor

This only seems to occur with nightly features enabled, so I'm not sure it's supposed to be nominated. I'll mention it in the tracking issue though.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 15, 2019
Remove never_type feature requirement for exhaustive patterns

I **think** this resolves rust-lang#51221
At least for me, it doesn't ICE anymore and all tests are still passing, so LGTM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants