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

Compiler crash on wrong enum definition #27337

Closed
ldanko opened this issue Jul 27, 2015 · 2 comments
Closed

Compiler crash on wrong enum definition #27337

ldanko opened this issue Jul 27, 2015 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ldanko
Copy link

ldanko commented Jul 27, 2015

I accidentially defined an enum in the wrong way, compiler crashed just after wrinting error messsage.

I tried this code:

#![crate_name = "Test"]
#![crate_type = "dylib"]

#[repr(C)]
enum Foo {
    Foo_X = 0,
    Foo_Y = Foo::Foo_X,
}

#[repr(C)]
enum Bar {
    Bar_X = 0,
    Bar_Y = Foo::Bar_X,
}

Meta

rustc --version --verbose:

rustc 1.1.0 (35ceea399 2015-06-19)
binary: rustc
commit-hash: 35ceea3997c79a3b7562e89b462ab76af5b86b22
commit-date: 2015-06-19
host: x86_64-unknown-linux-gnu
release: 1.1.0

Backtrace:
RUST_BACKTRACE=1 rustc crash.rs --verbose:

crash.rs:5:1: 7:2 error: unsupported representation for univariant enum [E0083]
crash.rs:5 enum Foo {
crash.rs:6     Foo_X = 0,
crash.rs:7 }
crash.rs:5:1: 7:2 help: run `rustc --explain E0083` to see a detailed explanation
crash.rs:10:1: 12:2 error: unsupported representation for univariant enum [E0083]
crash.rs:10 enum Bar {
crash.rs:11     Bar_X = Foo::Bar_X,
crash.rs:12 }
crash.rs:10:1: 12:2 help: run `rustc --explain E0083` to see a detailed explanation
crash.rs:11:13: 11:23 error: no associated item named `Bar_X` found for type `Foo` in the current scope
crash.rs:11     Bar_X = Foo::Bar_X,
                        ^~~~~~~~~~
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 'path not fully resolved: PathResolution { base_def: DefTy(DefId { krate: 0, node: 4 }, true), last_private: LastMod(AllPublic), depth: 1 }', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc/middle/def.rs:81

stack backtrace:
   1:     0x7fd9db382529 - sys::backtrace::write::ha3b8868b13c6f5b594r
   2:     0x7fd9db38a449 - panicking::on_panic::h0d4f0a7bb69824a9iJw
   3:     0x7fd9db34b242 - rt::unwind::begin_unwind_inner::h6eae1ff9ccde81e1sow
   4:     0x7fd9db34bfd7 - rt::unwind::begin_unwind_fmt::h1b64aa0dc7f97d91ynw
   5:     0x7fd9d93163fb - middle::const_eval::eval_const_expr_partial::hca04fb7b356ab7d1Sii
   6:     0x7fd9d94e7861 - middle::ty::enum_variants::closure.92905
   7:     0x7fd9d932d35c - middle::ty::enum_variants::h359849520637f4b28q8
   8:     0x7fd9dab39a8a - check::CheckItemTypesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::heb2e559aa222011aLqn
   9:     0x7fd9dabfd58a - check_crate::closure.38929
  10:     0x7fd9dabf704c - check_crate::h8ed0000b4b6dbbd2sJC
  11:     0x7fd9db8d21ef - driver::phase_3_run_analysis_passes::h9b9e8dc3e9bbf431tGa
  12:     0x7fd9db8b606c - driver::compile_input::h6e596544d26b4394Qba
  13:     0x7fd9db96c041 - run_compiler::haa6c0289fab7415475b
  14:     0x7fd9db969892 - boxed::F.FnBox<A>::call_box::h10721825727138786690
  15:     0x7fd9db968e59 - rt::unwind::try::try_fn::h6014602198652783625
  16:     0x7fd9db402b58 - rust_try_inner
  17:     0x7fd9db402b45 - rust_try
  18:     0x7fd9db9690f4 - boxed::F.FnBox<A>::call_box::h5510246712457526188
  19:     0x7fd9db3891e1 - sys::thread::Thread::new::thread_start::h11fbc90f6ba541f9zvv
  20:     0x7fd9d5c0d6a9 - start_thread
  21:     0x7fd9dafd2eec - clone
  22:                0x0 - <unknown>
@mitaa
Copy link
Contributor

mitaa commented Jul 28, 2015

This looks like #26483

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 29, 2015
@sanxiyn
Copy link
Member

sanxiyn commented Oct 21, 2015

Fixed by #28686.

@sanxiyn sanxiyn closed this as completed Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants