Skip to content

ICE: ID not mapped to struct fields #14815

Closed
@Valloric

Description

@Valloric
Contributor

Testcase:

#![crate_type = "lib"]

enum NodeContents<'a> {
    Children(Vec<Node<'a>>),
}

impl<'a> Drop for NodeContents<'a> {
  fn drop( &mut self ) {
  }
}

struct Node<'a> {
    contents: NodeContents<'a>,
}

impl<'a> Node<'a> {
    fn noName(contents: NodeContents<'a>) -> Node<'a> {
        Node{  contents: contents,}
    }
}

Output:

$ RUST_BACKTRACE=1 rustc testcase.rs
error: internal compiler error: ID not mapped to struct fields: enum NodeContents::NodeContents (id=3)
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>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:162

stack backtrace:
   1:     0x7fe491d4fc10 - rt::backtrace::imp::write::h40cc55cec4becf37pft::v0.11.0.pre
   2:     0x7fe491d57340 - failure::on_fail::h0ecf55594c628f4eFAt::v0.11.0.pre
   3:     0x7fe492566ad0 - unwind::begin_unwind_inner::hf89597be9cf9e2a9x2c::v0.11.0.pre
   4:     0x7fe490ed9770 - unwind::begin_unwind::h10083162363633685230::v0.11.0.pre
   5:     0x7fe490eda1b0 - diagnostic::Handler::bug::h539f1511a41eb15bJ3b::v0.11.0.pre
   6:     0x7fe492baf290 - driver::session::Session::bug::h204ed34293d608b6kcp::v0.11.0.pre
   7:     0x7fe492cbdc90 - middle::ty::lookup_struct_fields::hd13a528ec059ba50hAR::v0.11.0.pre
   8:     0x7fe492bfb9d0 - middle::ty::struct_fields::h678b3cb5747c6c6cpFR::v0.11.0.pre
   9:     0x7fe492d51b50 - middle::ty::type_contents::tc_ty::h1e130439e72e14b4lNO::v0.11.0.pre
  10:     0x7fe492cf9d70 - middle::ty::type_contents::h98fb8513fd90fac3hMO::v0.11.0.pre
  11:     0x7fe4930df210 - middle::kind::check_item::he70362b9466f4a05woU::v0.11.0.pre
  12:     0x7fe4930e20a0 - middle::kind::check_crate::hda7416011f252393LeU::v0.11.0.pre
  13:     0x7fe493488b50 - driver::driver::phase_3_run_analysis_passes::he3c22188c33b0ec8Ueo::v0.11.0.pre
  14:     0x7fe493481100 - driver::driver::compile_input::h217e3b79aef46e99l3n::v0.11.0.pre
  15:     0x7fe49354b730 - driver::run_compiler::hecd3afb1f63f45441Iq::v0.11.0.pre
  16:     0x7fe49354b650 - driver::main_args::closure.95283
  17:     0x7fe493565eb0 - driver::monitor::closure.96345
  18:     0x7fe493561150 - task::TaskBuilder::try::closure.96108
  19:     0x7fe4955951b0 - task::spawn_opts::closure.7123
  20:     0x7fe492564080 - task::Task::run::closure.5036
  21:     0x7fe4925cfb50 - rust_try
  22:     0x7fe4925660c0 - unwind::try::h28bca8d7e815c5ffTQc::v0.11.0.pre
  23:     0x7fe492563f00 - task::Task::run::hbd7ae3d03acf3a0bqxc::v0.11.0.pre
  24:     0x7fe495594f50 - task::spawn_opts::closure.7096
  25:     0x7fe491d4f060 - rt::thread::thread_start::h4e5a9307628e87efiAs::v0.11.0.pre
  26:     0x7fe491a860c0 - start_thread
  27:     0x7fe4922372d9 - __clone
  28:                0x0 - <unknown>

Version:

$ rustc --version
rustc 0.11.0-pre-nightly (0ee6a8e 2014-06-09 23:41:53 -0700)
host: x86_64-unknown-linux-gnu

This was originally reported as a comment in #13853 (comment) but appears to be unrelated to that issue.

Activity

changed the title [-]ICE: ID not mapped to struct fields: enum[/-] [+]ICE: ID not mapped to struct fields[/+] on Jun 11, 2014
ftxqxd

ftxqxd commented on Jun 11, 2014

@ftxqxd
Contributor

Reduced test case:

#![crate_type = "lib"]

enum NodeContents<'a> {}

impl<'a> Drop for NodeContents<'a> {
  fn drop(&mut self) {}
}

The ICE disappears if the Drop impl is labelled #[unsafe_destructor].

alexcrichton

alexcrichton commented on Jun 11, 2014

@alexcrichton
Member

Closing as a dupe of #13041 (same error message)

added a commit that references this issue on May 15, 2025
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

    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

        Participants

        @alexcrichton@Valloric@huonw@ftxqxd

        Issue actions

          ICE: ID not mapped to struct fields · Issue #14815 · rust-lang/rust