Description
When I run 'RUST_BACKTRACE=1 rustc foo.rs', with foo.rs containing the following:
struct MyStruct;
impl Drop for MyStruct {
fn drop(&mut self) { }
}
impl Drop for MyStruct {
fn drop(&mut self) { }
}
fn main() {
}
...I expected a compiler error about multiple implementations of drop(). Instead I get a compiler panic and the following output:
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
thread 'rustc' panicked at 'assertion failed: self.destructor.get().is_none()', ../src/librustc/middle/ty/mod.rs:1684
stack backtrace:
1: 0xb723e449 - sys::backtrace::tracing::imp::write::h085f7b472bdb7297Rnt
2: 0xb723b6bf - panicking::on_panic::h89c5c4c01688e08cgnx
3: 0xb7202e23 - sys_common::unwind::begin_unwind_inner::hcaa8ef8e2210f86chfs
4: 0xb6052601 - sys_common::unwind::begin_unwind::h9342686479312802844
5: 0xb633e96d - middle::ty::AdtDefData<'tcx, 'container>::set_destructor::hc39ceba34109a38dZGe
6: 0xb6a8a0f3 - coherence::CoherenceChecker<'a, 'tcx>::populate_destructor_table::closure.44055
7: 0xb6a90ee3 - coherence::check_coherence::hae12661916868a12n4C
8: 0xb6a9d104 - check_crate::hba514200a78ba2f3FCE
9: 0xb75620b5 - driver::phase_3_run_analysis_passes::closure.21543
10: 0xb7545811 - middle::ty::context::ctxt<'tcx>::create_and_enter::h11415694699603886574
11: 0xb7541524 - driver::phase_3_run_analysis_passes::h11116205042524445881
12: 0xb7521599 - driver::compile_input::ha7ff5949919f299b0ba
13: 0xb7686544 - run_compiler::hc11b6c37dcd9098cqqc
14: 0xb76837af - boxed::F.FnBox::call_box::h9540525210634565514
15: 0xb76830c8 - sys_common::unwind::try::try_fn::h6749527944362526960
16: 0xb723af34 - __rust_try
17: 0xb722f1ae - sys_common::unwind::try::inner_try::h102b27a29a2e39d3Fbs
18: 0xb7683267 - boxed::F.FnBox::call_box::h14988572331710300946
19: 0xb72442f9 - sys::thread::Thread::new::thread_start::ha79ffc4a0b00ec55fGw
20: 0xb35e4efa - start_thread
21: 0xb70d062d - clone
22: 0x0 -
Reporting the bug as the compiler asked me to do.