Skip to content

Internal compiler error when matching non-existant enum case (PathResolution) #34209

Closed
@FabianEmmes

Description

@FabianEmmes

Compiling the following program yields an internal compiler error:

enum S {
    A,
}

fn bug(l: S) {
    match l {
        S::B{ } => { },
    }
}

fn main () {}
$ rustc --version
rustc 1.11.0-nightly (7d2f75a95 2016-06-09)
$ rustc bug.rs
error: internal compiler error: ../src/librustc/hir/def.rs:77: path not fully resolved: PathResolution { base_def: Enum(DefId { krate: 0, node: DefIndex(4) => S }), depth: 1 }
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 'Box<Any>', ../src/libsyntax/errors/mod.rs:584
stack backtrace:
   1:     0x7fe96e1cc62f - std::sys::backtrace::tracing::imp::write::h6528da8103c51ab9
   2:     0x7fe96e1da26b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hbe741a5cc3c49508
   3:     0x7fe96e1d9e08 - std::panicking::default_hook::he0146e6a74621cb4
   4:     0x7fe96e1a016e - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
   5:     0x7fe96938d887 - std::panicking::begin_panic::hf9f206df23a555af
   6:     0x7fe96938d1ee - syntax::errors::Handler::bug::hd25802f012f6858b
   7:     0x7fe96a5b0134 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::h083e19915ee66466
   8:     0x7fe96a5aff3d - rustc::session::opt_span_bug_fmt::h157ddeb5b4622d22
   9:     0x7fe96a5ca8b6 - rustc::session::bug_fmt::h166f9667daf4dd54
  10:     0x7fe96a5afdaf - rustc::ty::_<impl rustc..ty..context..TyCtxt<'a, 'gcx, 'tcx>>::expect_def::h1bba3da31e27b082
  11:     0x7fe96cd4c2a4 - rustc_typeck::check::_match::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::check_pat_struct::hb2aac908ea2f3898
  12:     0x7fe96ccebad2 - rustc_typeck::check::_match::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::check_pat::hb68aedceeb2eae7b
  13:     0x7fe96cd36ec2 - rustc_typeck::check::_match::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::check_match::he1e7f5ae9b0c3187
  14:     0x7fe96cd126cf - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::hc65ba746f75e2d76
  15:     0x7fe96ccedc3d - rustc_typeck::check::FnCtxt::check_block_with_expected::h66a8dcc154a53b83
  16:     0x7fe96cce4d7e - rustc_typeck::check::check_fn::h74a0e95f02904d77
  17:     0x7fe96cce1e6e - rustc_typeck::check::check_bare_fn::h7683dfd1c7fc31d1
  18:     0x7fe96ccdd5c2 - rustc_typeck::check::check_item_body::h33cafe2320cee00a
  19:     0x7fe96ccd50ce - rustc_typeck::check::check_item_bodies::h0649c58896094a63
  20:     0x7fe96cccaec6 - rustc_typeck::check_crate::h9ad81a238efa1992
  21:     0x7fe96e6ff7cc - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::hd565ad56c5876a16
  22:     0x7fe96e6fd8b9 - rustc::ty::context::TyCtxt::create_and_enter::habef58c7230d34f9
  23:     0x7fe96e6c7d7f - rustc_driver::driver::compile_input::hfd60b020f6d0208d
  24:     0x7fe96e6b3cc4 - rustc_driver::run_compiler::h884d01d12eb76bbb
  25:     0x7fe96e6b0d9e - std::panicking::try::call::hd72cf79141f67e60
  26:     0x7fe96e1e872b - __rust_try
  27:     0x7fe96e1e86ce - __rust_maybe_catch_panic
  28:     0x7fe96e6b1884 - _<F as alloc..boxed..FnBox<A>>::call_box::h589d2091babf223a
  29:     0x7fe96e1d8394 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
  30:     0x7fe965b1f473 - start_thread
  31:     0x7fe96de2769c - clone
  32:                0x0 - <unknown>

return code: 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions