Skip to content

ICE instead "non-exhaustive patterns" warning #40221

Closed
@swizard0

Description

@swizard0

The minimum code example:

enum P {
    C(PC),
}

enum PC {
    Q,
    QA,
}

fn test(proto: P) {
    match proto {
        P::C(PC::Q) =>
            (),
    }
}

fn main() {
}

compiling:

% RUST_BACKTRACE=1 rustc tmp.rs
error: internal compiler error: unexpected panic

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'assertion failed: !self.is_enum()', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/librustc/ty/mod.rs:1497
stack backtrace:
   1:        0x1109feb2c - std::sys::imp::backtrace::tracing::imp::write::h36dcd6719b30e145
   2:        0x110a0b23e - std::panicking::default_hook::{{closure}}::h4ef47a6ed549d2e6
   3:        0x110a0ade3 - std::panicking::default_hook::hd7b4c7a7e16abb43
   4:        0x110a0b6f7 - std::panicking::rust_panic_with_hook::h33761bada49f3713
   5:        0x10cfdd214 - std::panicking::begin_panic::h95dab7ee8de9a9da
   6:        0x10d218b4e - rustc::ty::AdtDef::struct_variant::he28eaae9d1b9c7a8
   7:        0x10cdd1f65 - <rustc_const_eval::pattern::Pattern<'tcx> as core::fmt::Display>::fmt::hb2bc146bc61c0c23
   8:        0x110a4a605 - core::fmt::write::h7f41c54d8315ce0a
   9:        0x110a0ea4e - collections::fmt::format::h201c2e3c43f15470
  10:        0x10cdce0cb - rustc_const_eval::check_match::MatchVisitor::check_match::{{closure}}::h8765d658afab62bb
  11:        0x10cdcb972 - <rustc_const_eval::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h210885977704b1c0
  12:        0x10cdca5c0 - <rustc_const_eval::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr::h210885977704b1c0
  13:        0x10cdcc580 - <rustc_const_eval::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_body::hd194e1221abb715e
  14:        0x10cdc9167 - <rustc_const_eval::check_match::OuterVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_fn::h8c77996733ab8e7f
  15:        0x10cdad74c - rustc::hir::intravisit::walk_item::h404488f94d153f69
  16:        0x10cdc96a3 - rustc_const_eval::check_match::check_crate::hccfb63f4ad1088e1
  17:        0x10bdcf2e7 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h92434f8a72606098
  18:        0x10bd3a647 - rustc::ty::context::TyCtxt::create_and_enter::hf370726397099108
  19:        0x10bdafae7 - rustc_driver::driver::compile_input::h32ceef72bc3e1387
  20:        0x10bdf268e - rustc_driver::run_compiler::h98c0b71fc02a61c6
  21:        0x10bd01cd8 - std::panicking::try::do_call::hf2fe29fc9d77605e
  22:        0x110a0e30a - __rust_maybe_catch_panic
  23:        0x10bd2c123 - <F as alloc::boxed::FnBox<A>>::call_box::h3b47a718dac9d04a
  24:        0x110a0a364 - std::sys::imp::thread::Thread::new::thread_start::he1b44499d44cc4a4
  25:     0x7fffd3112aaa - _pthread_body
  26:     0x7fffd31129f6 - _pthread_start
rustc 1.16.0-nightly (bf6d7b665 2017-01-15)

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions