Closed
Description
Rust version:
> ./build/x86_64-apple-darwin/stage1/bin/rustc --version
rustc 1.17.0-dev (5ac7a035a 2017-02-26)
The code:
macro_rules! make {
($n:expr) => {
pub trait T<X> {
fn ignore(_: &X) {}
const C: X;
const D: i32 = ($n * $n);
}
impl U<Vec<i32>> for S {
const C: Vec<i32> = vec![0; $n];
}
}
}
make!(4);
Which gives:
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(3) and data Initializer but a previous def'n exists: DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("std"), disambiguator: 0 } }', src/librustc/hir/map/definitions.rs:335
stack backtrace:
1: 0x111baabdc - std::sys::imp::backtrace::tracing::imp::write::h2e3ef1dc0e51ba99
2: 0x111bb763e - std::panicking::default_hook::{{closure}}::haa60669a0a8b43e3
3: 0x111bb71e3 - std::panicking::default_hook::h0a42e1acc48a315c
4: 0x111bb7af7 - std::panicking::rust_panic_with_hook::h78a15ea95e294ff1
5: 0x111bb79a4 - std::panicking::begin_panic::hba8a9f7990fef69b
6: 0x111bb78c2 - std::panicking::begin_panic_fmt::hc74ec0af4c54fbab
7: 0x10ebf43bc - rustc::hir::map::definitions::Definitions::create_def_with_parent::hbb102500d73fd9c1
8: 0x10ebf11f2 - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_impl_item::h81eb5dc485f72f1c
9: 0x10eb6bb11 - syntax::visit::walk_item::h1a65815c3ec0cd25
10: 0x10ebf0c53 - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_item::{{closure}}::ha54e917d31c5446f
11: 0x10ebf059c - <rustc::hir::map::def_collector::DefCollector<'a> as syntax::visit::Visitor<'a>>::visit_item::hdd7947b3b5779933
12: 0x10ea711de - rustc_resolve::macros::<impl syntax::ext::base::Resolver for rustc_resolve::Resolver<'a>>::visit_expansion::h2d197847c9c689f6
13: 0x111690d6f - syntax::ext::expand::MacroExpander::collect_invocations::hccfea5820a6cd13e
14: 0x11168dd2b - syntax::ext::expand::MacroExpander::expand::h03bd73f7ebe53885
15: 0x11168c61f - syntax::ext::expand::MacroExpander::expand_crate::hc1e13e0d2bbc2981
16: 0x10d7e2881 - rustc_driver::driver::phase_2_configure_and_expand::{{closure}}::h5f58f7c0b9aa3518
17: 0x10d7d13d0 - rustc_driver::driver::phase_2_configure_and_expand::h403f66a4c4ce608a
18: 0x10d8a0a34 - rustdoc::core::run_core::h20b285afcad21f3a
19: 0x10d7f0d02 - std::panicking::try::do_call::hf08ba2b971ea2e3a
20: 0x111bba70a - __rust_maybe_catch_panic
21: 0x10d81815a - <F as alloc::boxed::FnBox<A>>::call_box::h4d43130e36f88422
22: 0x111bb6764 - std::sys::imp::thread::Thread::new::thread_start::h3187989cf33213df
23: 0x7fffb9824aba - _pthread_body
24: 0x7fffb9824a06 - _pthread_start