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

ICE with Drop types in statics #34053

Closed
kornholi opened this issue Jun 3, 2016 · 5 comments
Closed

ICE with Drop types in statics #34053

kornholi opened this issue Jun 3, 2016 · 5 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@kornholi
Copy link

kornholi commented Jun 3, 2016

#![feature(drop_types_in_const)]
struct A(i32); // not limited to tuple structs

impl Drop for A {
    fn drop(&mut self) { }
}

static FOO: A = A(123);

fn main() {
    println!("{}", &FOO.0);
}

gives:

error: internal compiler error: unexpected panic
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `1`, right: `2`)', ../src/librustc_trans/adt.rs:1425
stack backtrace:
   1:     0x7f73f3db3534 - std::sys::backtrace::tracing::imp::write::h6528da8103c51ab9
   2:     0x7f73f3dc1b3b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hbe741a5cc3c49508
   3:     0x7f73f3dc16d8 - std::panicking::default_hook::he0146e6a74621cb4
   4:     0x7f73f3d8488d - std::panicking::rust_panic_with_hook::h587239a80cad02d2
   5:     0x7f73f3dc1dd1 - std::panicking::begin_panic::h77cefecf7d758cdf
   6:     0x7f73f3d869da - std::panicking::begin_panic_fmt::hb3024643f3039337
   7:     0x7f73f17c5ce7 - rustc_trans::adt::build_const_struct::hdd0431344839d114
   8:     0x7f73f17c48f5 - rustc_trans::adt::trans_const::h7635f041c0960e31
   9:     0x7f73f18709af - rustc_trans::consts::const_expr_unadjusted::h7fee3ce2f8dec095
  10:     0x7f73f186c1c6 - rustc_trans::consts::const_expr::h89b51f911278b3c4
  11:     0x7f73f17f735c - rustc_trans::base::trans_item::hca2904a0eb6b2a6f
  12:     0x7f73f181047d - _<rustc_trans..base..TransItemsWithinModVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_item::h9938dc39c74c3b7b
  13:     0x7f73f18008a7 - rustc_trans::base::trans_crate::h999c47a06d45abea
  14:     0x7f73f4311cdb - rustc_driver::driver::phase_4_translate_to_llvm::had910d0e745bc40f
  15:     0x7f73f430f9db - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::he7bfc52a5708c702
  16:     0x7f73f430ad04 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h14076f482deadce2
  17:     0x7f73f4304073 - rustc::ty::context::TyCtxt::create_and_enter::hd16288ef035eb80e
  18:     0x7f73f42caee4 - rustc_driver::driver::compile_input::hfd60b020f6d0208d
  19:     0x7f73f42b51c9 - rustc_driver::run_compiler::h884d01d12eb76bbb
  20:     0x7f73f42b1e80 - std::panicking::try::call::h04b58e895b5a0293
  21:     0x7f73f3dd050b - __rust_try
  22:     0x7f73f3dd04ae - __rust_maybe_catch_panic
  23:     0x7f73f42b2a4a - _<F as alloc..boxed..FnBox<A>>::call_box::h09d8d6a2bbba123a
  24:     0x7f73f3dbfd34 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
  25:     0x7f73eb9b0473 - start_thread
  26:     0x7f73f3a0c69c - clone
  27:                0x0 - <unknown>
@eefriedman
Copy link
Contributor

Off the top of my head, looks like some sort of confusion involving drop flags.

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 3, 2016
@jonas-schievink
Copy link
Contributor

Yes, it works when adding #[unsafe_no_drop_flag] to the struct.

This doesn't yet work with -Zorbit, but will once filling drop is removed completely (after old trans is removed, presumably).

@durka
Copy link
Contributor

durka commented Aug 28, 2016

Fixed now.

@eddyb eddyb added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 28, 2016
@kornholi
Copy link
Author

Confirmed working in latest nightly.

@eddyb
Copy link
Member

eddyb commented Aug 28, 2016

We want a test though.

@eddyb eddyb reopened this Aug 28, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 30, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 30, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 31, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this issue Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants