Skip to content

ICE when using exhaustive_patterns without never_type #51221

Closed

Description

@jleedev
~$ 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.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Jun 1, 2018
  2. hellow554 commented on May 13, 2019

    @hellow554
    Contributor

    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

  3. added
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on May 13, 2019
  4. added
    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
    on May 13, 2019
  5. jonas-schievink commented on May 13, 2019

    @jonas-schievink
    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.

  6. added a commit that references this issue on Jul 15, 2019
    99e7328
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions