Closed
Description
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