Skip to content

ICE: no type for node 30: local ref __self_0_0 (id=30) #17030

@JeffBelgum

Description

@JeffBelgum

Trying to compile:

#[deriving(Show)]
struct A { b: int }
impl A {}
enum A {}

Leads to the following compiler error:

bug.rs:1:12: 1:16 error: mismatched types: expected `A`, found `A` [E0028]
bug.rs:1 #[deriving(Show)]
                    ^~~~
note: in expansion of #[deriving]
bug.rs:1:1: 1:18 note: expansion site
bug.rs:2:12: 2:18 error: the type of this value must be known in this context
bug.rs:2 struct A { b: int }
                    ^~~~~~
note: in expansion of #[deriving]
bug.rs:1:1: 1:18 note: expansion site
bug.rs:2:12: 2:18 error: cannot determine a type for this bounded type parameter: unconstrained type
bug.rs:2 struct A { b: int }
                    ^~~~~~
note: in expansion of #[deriving]
bug.rs:1:1: 1:18 note: expansion site
error: internal compiler error: no type for node 30: local ref __self_0_0 (id=30) in fcx 0x10c5aaf90
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/ast_util.rs:776

And the following stack backtrace

stack backtrace:
   1:        0x10b0f1fd5 - rt::backtrace::imp::write::h8a16f0d6cc468cc2WUq
   2:        0x10b0f5311 - failure::on_fail::h73f7991e2e18ff1aQbr
   3:        0x10b3939a5 - unwind::begin_unwind_inner::h7563dbccbae0d69fb0d
   4:        0x10a849f2a - unwind::begin_unwind::h15457849011356628111
   5:        0x10a84a743 - diagnostic::Handler::bug::h1b12eda712d730dfufF
   6:        0x107be5ed8 - driver::session::Session::bug::he94b475aa8c9efbbuKC
   7:        0x1080e2b95 - middle::typeck::check::FnCtxt<'a>::node_ty::he1db56b2f6e38765UUW
   8:        0x108106fc9 - middle::typeck::check::writeback::WritebackCx<'cx>::visit_node_id::h69cc4fac9776bb0f91N
   9:        0x1081054ac - middle::typeck::check::writeback::WritebackCx<'cx>.Visitor<(*>::visit_pat::h52b3b9becfa5d6f9YSN
  10:        0x1081056df - middle::typeck::check::writeback::WritebackCx<'cx>.Visitor<(*>::visit_pat::h52b3b9becfa5d6f9YSN
  11:        0x10810c053 - visit::walk_arm::h9826119459230672094
  12:        0x108103d43 - middle::typeck::check::writeback::WritebackCx<'cx>.Visitor<(*>::visit_expr::h46ccff77a586708aJQN
  13:        0x10810c5b1 - visit::walk_block::h15035022899041750626
  14:        0x108105247 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h6470a04ae2a7f182QKN
  15:        0x108159acb - middle::typeck::check::check_bare_fn::h3dc52015b58422b13HU
  16:        0x108164456 - middle::typeck::check::check_method_body::h9cbff2c23b51dab6lzV
  17:        0x108152b96 - middle::typeck::check::check_item::h18b70d8bf39d6f29MnV
  18:        0x10815987d - middle::typeck::check::check_item_types::h1e56caee9458b8b62GU
  19:        0x107bd3446 - util::common::time::h17392792334583830769
  20:        0x10836bd0c - middle::typeck::check_crate::h4730e89ab2202064sjn
  21:        0x108429a25 - driver::driver::phase_3_run_analysis_passes::h5ba3dde5cec5fc2dp1B
  22:        0x108424c2c - driver::driver::compile_input::h05a21904a92e1503cNB
  23:        0x1084b1bda - driver::run_compiler::hed4b6336d7803791CCF
  24:        0x1084afe56 - driver::main_args::closure.141533
  25:        0x1084c280b - task::TaskBuilder<S>::try_future::closure.142702
  26:        0x1084c2713 - task::TaskBuilder<S>::spawn_internal::closure.142679
  27:        0x107b8952c - task::spawn_opts::closure.8480
  28:        0x10b3f5d2c - rust_try_inner
  29:        0x10b3f5d16 - rust_try
  30:        0x10b390ea7 - unwind::try::h5c767661da0124aclOd
  31:        0x10b390d1c - task::Task::run::hbb8d1805a446205eL0c
  32:        0x107b89372 - task::spawn_opts::closure.8425
  33:        0x10b3928e6 - thread::thread_start::h7a1f59f7cbfcd0f2Sld
  34:     0x7fff95565899 - _pthread_body
  35:     0x7fff9556572a - _pthread_struct_init

I've stripped it down to the smallest example I can. The order and types of everything (except the struct's inner value and the trait to be derived) seems to matter.

I've triggered the bug with rustc 0.12.0-pre-nightly (d59d97c 2014-09-04 01:11:04 +0000) on Mac OS X 10.9.4 and play.rust-lang.org on master, but not play.rust-lang.org on v0.11.0 or v0.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions