Closed
Description
Hit an ICE while working on a project, was able to reduce it to the following (nonsensical) example:
trait Trait<T> {
fn foo(_: T) {}
}
pub struct Foo<T = Box<Trait<DefaultFoo>>>;
type DefaultFoo = Foo;
Although an incorrect Rust program, this still triggers the ICE:
trait Trait {}
pub struct Foo<T = Box<Trait<DefaultFoo>>>;
type DefaultFoo = Foo;
The ICE can also be triggered by replacing Box
with Rc
or Arc
for example.
Meta
rustc --version --verbose
:
rustc 1.11.0-nightly (bb4a79b 2016-06-15)
binary: rustc
commit-hash: bb4a79b
commit-date: 2016-06-15
host: x86_64-apple-darwin
release: 1.11.0-nightly
Backtrace:
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:584
stack backtrace:
1: 0x107cb40ab - std::sys::backtrace::tracing::imp::write::h6528da8103c51ab9
2: 0x107cc0a5a - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hbe741a5cc3c49508
3: 0x107cc058b - std::panicking::default_hook::he0146e6a74621cb4
4: 0x107c86368 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
5: 0x10507972a - std::panicking::begin_panic::hf9f206df23a555af
6: 0x10507903c - syntax::errors::Handler::bug::hd25802f012f6858b
7: 0x1043bf197 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::h083e19915ee66466
8: 0x1043befa3 - rustc::session::opt_span_bug_fmt::h157ddeb5b4622d22
9: 0x1043d8ae9 - rustc::session::bug_fmt::h166f9667daf4dd54
10: 0x1046d8d81 - rustc::ty::context::TyCtxt::intern_adt_def::h76d66d2283e5c94e
11: 0x1037b74d2 - rustc_typeck::collect::type_scheme_of_item::h9364c34f50189fd8
12: 0x1037a5732 - _<rustc_typeck..collect..ItemCtxt<'a, 'tcx> as rustc_typeck..astconv..AstConv<'tcx, 'tcx>>::get_item_type_scheme::h505a90fb8c62bbc9
13: 0x10379049c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_path_to_ty::h0c07234d62095e09
14: 0x1036e9597 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::finish_resolving_def_to_ty::h3d556a35b1618629
15: 0x1036aaa6c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_to_ty::ha1a7ce8fdda4c74c
16: 0x1037b774f - rustc_typeck::collect::type_scheme_of_item::h9364c34f50189fd8
17: 0x1037a5732 - _<rustc_typeck..collect..ItemCtxt<'a, 'tcx> as rustc_typeck..astconv..AstConv<'tcx, 'tcx>>::get_item_type_scheme::h505a90fb8c62bbc9
18: 0x10379049c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_path_to_ty::h0c07234d62095e09
19: 0x1036e9597 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::finish_resolving_def_to_ty::h3d556a35b1618629
20: 0x1036aaa6c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_to_ty::ha1a7ce8fdda4c74c
21: 0x10378a404 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_arg_to_ty::h438463517bb904f2
22: 0x10378a01f - _<collections..vec..Vec<T> as core..iter..traits..FromIterator<T>>::from_iter::h46a990e2fe19f9c2
23: 0x1037880f8 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::convert_angle_bracketed_parameters::h1f49a6121c527de7
24: 0x10378f1c9 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::create_substs_for_ast_trait_ref::heeb85beb5dac98e0
25: 0x10378cc4c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_path_to_poly_trait_ref::h36d8cef986cca0d1
26: 0x1036e9657 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::finish_resolving_def_to_ty::h3d556a35b1618629
27: 0x1036aaa6c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_to_ty::ha1a7ce8fdda4c74c
28: 0x10378a404 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_arg_to_ty::h438463517bb904f2
29: 0x10378a01f - _<collections..vec..Vec<T> as core..iter..traits..FromIterator<T>>::from_iter::h46a990e2fe19f9c2
30: 0x1037880f8 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::convert_angle_bracketed_parameters::h1f49a6121c527de7
31: 0x1036a835a - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_path_substs_for_ty::h99fc841f70fc46b6
32: 0x1037905db - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_path_to_ty::h0c07234d62095e09
33: 0x1036e9597 - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::finish_resolving_def_to_ty::h3d556a35b1618629
34: 0x1036aaa6c - _<rustc_typeck..astconv..AstConv<'gcx, 'tcx> $u2b$$u20$$u27$o$GT$::ast_ty_to_ty::ha1a7ce8fdda4c74c
35: 0x1037c08aa - rustc_typeck::collect::ty_generics::hdc04f67a20114e67
36: 0x1037b750e - rustc_typeck::collect::type_scheme_of_item::h9364c34f50189fd8
37: 0x1037af686 - rustc_typeck::collect::convert_typed_item::hc01d0f8d602c5ace
38: 0x103798fb3 - rustc_typeck::collect::convert_item::hb084d39a484f5b45
39: 0x1036721a5 - rustc_typeck::collect::collect_item_types::hf61e31ef852175cf
40: 0x10366ed01 - rustc_typeck::check_crate::h9ad81a238efa1992
41: 0x10320d600 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::hd565ad56c5876a16
42: 0x10320b8d0 - rustc::ty::context::TyCtxt::create_and_enter::habef58c7230d34f9
43: 0x1031d5dc1 - rustc_driver::driver::compile_input::hfd60b020f6d0208d
44: 0x1031c2b94 - rustc_driver::run_compiler::h884d01d12eb76bbb
45: 0x1031bfb9f - std::panicking::try::call::hd72cf79141f67e60
46: 0x107cc7b3b - __rust_try
47: 0x107cc7ad5 - __rust_maybe_catch_panic
48: 0x1031c06ab - _<F as alloc..boxed..FnBox<A>>::call_box::h589d2091babf223a
49: 0x107cbf4d8 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
50: 0x7fff9c3f699c - _pthread_body
51: 0x7fff9c3f6919 - _pthread_start
error: internal compiler error: ../src/librustc/ty/context.rs:603: Tried to overwrite interned AdtDef: Foo
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