Closed
Description
Test case:
#[allow(dead_code)]
static X: &'static str = &*"";
fn main() {}
Output:
$ RUST_BACKTRACE=1 rustc test.rs -O
@ref8 = internal unnamed_addr constant %str_slice { i8* getelementptr inbounds ([0 x i8]* @str954, i32 0, i32 0), i64 0 }
{ i8*, i8* } undef
error: internal compiler error: const expr(8: &*"") of type &'static str has size 8 instead of 16
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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:189
stack backtrace:
1: 0x2c97f720 - sys::backtrace::write::h66f3f2784d0f6c5ddgA
2: 0x2c9a7b80 - panicking::on_panic::h6fdde9e4e9166fe6jaJ
3: 0x2c8e7c30 - rt::unwind::begin_unwind_inner::hba10c536ef2aae75MQI
4: 0x29bf70c0 - rt::unwind::begin_unwind::h11287547919384241778
5: 0x29bf7880 - diagnostic::Handler::bug::hcd811e06453c2215AHD
6: 0x2a92f0e0 - session::Session::bug::h6899b8b34aff4289tjp
7: 0x2b684c80 - trans::consts::const_expr::h035f67d1634baae2etn
8: 0x2b5bdee0 - trans::base::get_item_val::h6996afac4f0d2cd8zdu
9: 0x2b687ae0 - trans::consts::trans_static::h8a306b81be8d489c68n
10: 0x2b5bbbf0 - trans::base::trans_item::h84b885e418e4a555QIt
11: 0x2b6a49c0 - trans::base::trans_crate::h42b5704fc939dd15qEu
12: 0x2d005970 - driver::phase_4_translate_to_llvm::h73df038fa8e4514eqNa
13: 0x2cfdfec0 - driver::compile_input::h0de317319ab5c701Hba
14: 0x2d0aae20 - run_compiler::hffa0c0711e361de8E5b
15: 0x2d0a9720 - thunk::F.Invoke<A, R>::invoke::h12673221910893163557
16: 0x2d0a8610 - rt::unwind::try::try_fn::h15130568597725528481
17: 0x2ca13740 - rust_try_inner
18: 0x2ca13730 - rust_try
19: 0x2d0a8910 - thunk::F.Invoke<A, R>::invoke::h3924406537784056782
20: 0x2c993990 - sys::thread::thread_start::h3734be2229bd3edegEE
21: 0x268bb0c0 - start_thread
22: 0x2c560449 - __clone
23: 0x0 - <unknown>
Compiler version:
rustc 1.0.0-nightly (b47aebe3f 2015-02-26) (built 2015-02-27)
binary: rustc
commit-hash: b47aebe3fc2da06c760fd8ea19f84cbc41d34831
commit-date: 2015-02-26
build-date: 2015-02-27
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
This issue has a similar error to that in #20074, but it's not clear to me that it's the same issue. The types involved are different, as are the mismatched size values. I'm also unable to reproduce that issue's failure -- maybe it's fixed already?