Skip to content

ICE when assigning one static mut to another #17450

New issue

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

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

Already on GitHub? # to your account

Closed
erickt opened this issue Sep 22, 2014 · 3 comments · Fixed by #18099
Closed

ICE when assigning one static mut to another #17450

erickt opened this issue Sep 22, 2014 · 3 comments · Fixed by #18099
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

@erickt
Copy link
Contributor

erickt commented Sep 22, 2014

This is derived from #9852. rust currently ICEs when we try to assign one static mut to another:

 #![allow(dead_code)]

static mut x: int = 3;
static mut y: int = unsafe { x };

fn main() {}

Errors with:

test.rs:4:30: 4:31 error: internal compiler error: expected a const, fn, struct, or variant def
test.rs:4 static mut y: int = unsafe { x };
                                       ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /Users/erickt/rust/rust/src/libsyntax/ast_util.rs:784

stack backtrace:
   1:        0x107e02d55 - rt::backtrace::imp::write::h880d189576c848d1oiq
   2:        0x107e05f96 - failure::on_fail::h6e2ad4b13ef7a2e3Tyq
   3:        0x1080be2a5 - unwind::begin_unwind_inner::h0d2594eca0d27f4dKUd
   4:        0x106182b67 - unwind::begin_unwind::h3603686205363448393
   5:        0x106182add - diagnostic::SpanHandler::span_bug::h0b7338aa407f744656C
   6:        0x104e4ae75 - driver::session::Session::span_bug::h98e862e5ea08eca3Q3w
   7:        0x1050c9b2f - middle::trans::consts::const_expr_unadjusted::h75200d988d8eabefCy6
   8:        0x1050c5bb1 - middle::trans::consts::const_expr::h26d468d8f41e83ffki6
   9:        0x1050c8553 - middle::trans::consts::const_expr_unadjusted::h75200d988d8eabefCy6
  10:        0x1050c5bb1 - middle::trans::consts::const_expr::h26d468d8f41e83ffki6
  11:        0x10503ef64 - middle::trans::base::get_item_val::ha243af605bce5ef4iid
  12:        0x1050c7d27 - middle::trans::consts::trans_const::hc5ca6e42fe09b429w76
  13:        0x10503de0c - middle::trans::base::trans_item::hb3c5a9b94c59edf9zPc
  14:        0x105104adc - middle::trans::base::trans_crate::h074744ec69b12518BKd
  15:        0x1054fb9fd - driver::driver::phase_4_translate_to_llvm::he9d14803ada4325ci6v
  16:        0x1054f42e4 - driver::driver::compile_input::h2b35795b01946e28YIv
  17:        0x105590767 - driver::run_compiler::hd0e9e5fa356d4730zNy
  18:        0x10558efa6 - driver::main_args::closure.$x22closure$x22$LP$134720$RP$
  19:        0x1055a0aab - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$135864$RP$
  20:        0x1055a09b5 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$135841$RP$
  21:        0x104c5587c - task::spawn_opts::closure.$x22closure$x22$LP$8297$RP$
  22:        0x108123b0c - rust_try
  23:        0x1080bb57b - unwind::try::he1b146324b64ee886Id
  24:        0x1080bb333 - task::Task::run::hd7c8fa467c984ef9yRc
  25:        0x104c55711 - task::spawn_opts::closure.$x22closure$x22$LP$8242$RP$
  26:        0x1080bd1f6 - thread::thread_start::ha2523279e73a34caofd
  27:     0x7fff8bcc9899 - _pthread_body
  28:     0x7fff8bcc972a - _pthread_struct_init
@erickt erickt added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 22, 2014
@mahkoh
Copy link
Contributor

mahkoh commented Sep 23, 2014

This ices because the match here only allows mutable = false statics. It might or might not be enough to remove this check.

@mahkoh
Copy link
Contributor

mahkoh commented Oct 10, 2014

No longer valid.

@alexcrichton
Copy link
Member

Flagging as needstest

@alexcrichton alexcrichton added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 11, 2014
bors added a commit that referenced this issue Oct 18, 2014
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
# for free to join this conversation on GitHub. Already have an account? # 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

Successfully merging a pull request may close this issue.

3 participants