Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc crashes on multiple Drop implementations #28568

Closed
larsluthman opened this issue Sep 21, 2015 · 4 comments
Closed

rustc crashes on multiple Drop implementations #28568

larsluthman opened this issue Sep 21, 2015 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta.

Comments

@larsluthman
Copy link

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.

@larsluthman
Copy link
Author

$ rustc --version
rustc 1.4.0-beta.1 (d2e13e8 2015-09-15)

@apasel422
Copy link
Contributor

The problem here is that coherence::check_coherence sets destructors before checking for overlap. The cleanest solution would be to use the preexisting overlap infrastructure to prevent this, but as a simpler solution, populate_destructor_table could first ensure that type_def.destructor().is_none() before calling set_destructor and emit an error otherwise.

@apasel422
Copy link
Contributor

This should be tagged as an ICE.

@arielb1 arielb1 added regression-from-stable-to-beta Performance or correctness regression from stable to beta. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Sep 26, 2015
@arielb1
Copy link
Contributor

arielb1 commented Sep 26, 2015

1.3-1.4 regression (cause: #28001). Not sure this should be backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-beta Performance or correctness regression from stable to beta.
Projects
None yet
Development

No branches or pull requests

3 participants