Skip to content

ICE: associated constants and macros #39467

Closed
@WildCryptoFox

Description

@WildCryptoFox

https://play.rust-lang.org/?gist=19881877a8b06d7014c9af2ab2a5a39f&version=nightly&backtrace=1

macro_rules! expr { () => { () } }

enum A {}

impl A {
    const A: () = expr!();
}
rustc 1.16.0-nightly (df8debf6d 2017-01-25)
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 'adding a def'n for node-id NodeId(2) and data Initializer but a previous def'n exists: DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: Misc, disambiguator: 0 } }', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/hir/map/definitions.rs:335
stack backtrace:
   1:     0x7f347fd6096c - std::sys::imp::backtrace::tracing::imp::write::h9c41d2f69e5caabf
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x7f347fd6ee6e - std::panicking::default_hook::{{closure}}::hcc803c8663cda123
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:351
   3:     0x7f347fd6ea13 - std::panicking::default_hook::hd5bda4e453dfb4be
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:361
   4:     0x7f347fd6f30b - std::panicking::rust_panic_with_hook::hffbc74969c7b5d87
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:555
   5:     0x7f347fd6f1a4 - std::panicking::begin_panic::hc4c5d184a1e3fb7c
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:517
   6:     0x7f347fd6f0c9 - std::panicking::begin_panic_fmt::h34f5b320b0f94559
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:501
   7:     0x7f347cd9e73d - rustc::hir::map::definitions::Definitions::create_def_with_parent::hade3673fccb27c33
   8:     0x7f347cd9b58e - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_impl_item::h7b3200d9cd164dd0
   9:     0x7f347cd28fa1 - syntax::visit::walk_item::h69fd055462a67732
  10:     0x7f347cd9b001 - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_item::{{closure}}::h9091e118e4816ffb
  11:     0x7f347cd9a99a - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_item::h245a68a66023f85b
  12:     0x7f347cd28d7f - syntax::visit::walk_item::h69fd055462a67732
  13:     0x7f347cd9aa0a - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_item::h245a68a66023f85b
  14:     0x7f347d24e12e - rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver<'a>>::visit_expansion::hf2f69d86db69f9ff
  15:     0x7f34789ee992 - syntax::ext::expand::MacroExpander::collect_invocations::hb7286b5215f6cabe
  16:     0x7f34789ec5d7 - syntax::ext::expand::MacroExpander::expand::he64090ad698e4ac4
  17:     0x7f34789ec095 - syntax::ext::expand::MacroExpander::expand_crate::h9effb4e2a488a85d
  18:     0x7f34801001ec - rustc_driver::driver::phase_2_configure_and_expand::{{closure}}::h3ddcf02b571a1c51
  19:     0x7f34800f7905 - rustc_driver::driver::phase_2_configure_and_expand::hd0c4535cf8df7dea
  20:     0x7f34800eddee - rustc_driver::driver::compile_input::h44853ffed84a12cb
  21:     0x7f3480137554 - rustc_driver::run_compiler::hdc4bb0fcf7d0917a
  22:     0x7f3480043c2b - std::panicking::try::do_call::h84a15e0d2b943318
  23:     0x7f347fd7814a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  24:     0x7f348006be62 - <F as alloc::boxed::FnBox<A>>::call_box::h61c78220cad685ea
  25:     0x7f347fd6dcc4 - std::sys::imp::thread::Thread::new::thread_start::h76badbf9b0ecaf58
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/liballoc/boxed.rs:615
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys_common/thread.rs:21
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/thread.rs:84
  26:     0x7f3477b256b9 - start_thread
  27:     0x7f347fa2382c - clone
  28:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions