Skip to content

Internal Compiler Error (broken MIR) on stable/beta/nightly with lazy_static and shawshank #39367

Closed
@jpschorr

Description

@jpschorr

Code

Cargo.toml

[package]
name = "ice_lazy_static_shawshank"
version = "0.1.0"

[dependencies]
lazy_static = "0.1.*"
shawshank = "0.2.*"

lib.rs

#[macro_use]
extern crate lazy_static;
extern crate shawshank;

lazy_static! {
    pub static ref ARENA: shawshank::ArenaSet<String> = {
        shawshank::string_arena_set()
    };
}
 

Error

Compiler info

rustc --version --verbose:

rustc 1.14.0 (e8a012324 2016-12-16)
binary: rustc
commit-hash: e8a0123241f0d397d39cd18fcc4e5e7edde22730
commit-date: 2016-12-16
host: x86_64-apple-darwin
release: 1.14.0
LLVM version: 3.9

Backtrace

RUST_BACKTRACE=1 cargo build

   Compiling ice_lazy_static_shawshank v0.1.0 (file:///Users/jpschorr/rust/ice_lazy_static_shawshank)
warning: broken MIR (<ARENA as std::ops::Deref>::deref::__stability::DATA = _2): bad assignment (*const shawshank::ArenaSet<std::string::String> = *const shawshank::ArenaSet<std::string::String, usize, std::collections::HashMap<&'static str, usize>>): Sorts(ExpectedFound { expected: <std::string::String as std::ops::Deref>::Target, found: str })
 --> src/lib.rs:5:1
  |
5 | lazy_static! {
  | ^
  |
  = note: this error originates in a macro outside of the current crate

warning: broken MIR (_4 = &(*<ARENA as std::ops::Deref>::deref::__stability::DATA)): bad assignment (&'static shawshank::ArenaSet<std::string::String, usize, std::collections::HashMap<&'static str, usize>> = &'static shawshank::ArenaSet<std::string::String>): Sorts(ExpectedFound { expected: str, found: <std::string::String as std::ops::Deref>::Target })
 --> src/lib.rs:5:1
  |
5 | lazy_static! {
  | ^
  |
  = note: this error originates in a macro outside of the current crate

error: internal compiler error: ../src/librustc_trans/debuginfo/type_names.rs:149: debuginfo: Trying to create type name for unexpected type: <std::string::String as std::ops::Deref>::Target

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>', ../src/librustc_errors/lib.rs:424
stack backtrace:
   1:        0x11298bfaa - std::sys::imp::backtrace::tracing::imp::write::h917062bce4ff48c3
   2:        0x11299bd6f - std::panicking::default_hook::{{closure}}::h0bacac31b5ed1870
   3:        0x112998e35 - std::panicking::default_hook::h5897799da33ece67
   4:        0x112999566 - std::panicking::rust_panic_with_hook::h109e116a3a861224
   5:        0x11282761a - std::panicking::begin_panic::h7ee1a5d23402297a
   6:        0x112838b84 - rustc_errors::Handler::bug::hcb152875f06770ca
   7:        0x10fa6323c - rustc::session::opt_span_bug_fmt::{{closure}}::hac6e8f2df662620f
   8:        0x10f991ba9 - rustc::session::opt_span_bug_fmt::he7e61f6adc55e29d
   9:        0x10f99172a - rustc::session::bug_fmt::h995c6792d8929834
  10:        0x10e984826 - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::hcc7d963c9e9ec306
  11:        0x10e983c40 - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::hcc7d963c9e9ec306
  12:        0x10e98516f - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::push_type_params::hcc94e8d523543311
  13:        0x10e98391e - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::hcc7d963c9e9ec306
  14:        0x10e98516f - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::push_type_params::hcc94e8d523543311
  15:        0x10e98391e - rustc_trans::debuginfo::type_names::push_debuginfo_type_name::hcc7d963c9e9ec306
  16:        0x10e98919b - rustc_trans::debuginfo::metadata::type_metadata::hb8e4086e618f8959
  17:        0x10e98854c - rustc_trans::debuginfo::metadata::type_metadata::hb8e4086e618f8959
  18:        0x10e9cc155 - rustc_trans::trans_item::TransItem::define::hf67eb98c96335402
  19:        0x10e94f4cd - rustc_trans::base::trans_crate::h47f4206b4f9f44d2
  20:        0x10e79ecd1 - rustc_driver::driver::phase_4_translate_to_llvm::hd8440dd1d6d967c3
  21:        0x10e7d64dc - rustc_driver::driver::compile_input::{{closure}}::h1d3b0af04a04cdbb
  22:        0x10e7c334b - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h5a9a7c8e1b6dbe3a
  23:        0x10e79cb16 - rustc_driver::driver::phase_3_run_analysis_passes::h823704ee01fd0a1e
  24:        0x10e7856e5 - rustc_driver::driver::compile_input::h66a0adaf05fab85d
  25:        0x10e7b0019 - rustc_driver::run_compiler::hafe7bbfedf95a825
  26:        0x10e6e7d28 - std::panicking::try::do_call::h5ff5e568cb9cce51
  27:        0x11299c32a - __rust_maybe_catch_panic
  28:        0x10e707eff - <F as alloc::boxed::FnBox<A>>::call_box::h92e2f4ed0df1d5b6
  29:        0x1129983d4 - std::sys::imp::thread::Thread::new::thread_start::ha102a6120fc52763
  30:     0x7fff995cd99c - _pthread_body
  31:     0x7fff995cd919 - _pthread_start

error: Could not compile `ice_lazy_static_shawshank`.

Also

Similarly, it happens for

rustc 1.15.0-beta.5 (10893a9a3 2017-01-19)
binary: rustc
commit-hash: 10893a9a349cdd423f2490a6984acb5b3b7c8046
commit-date: 2017-01-19
host: x86_64-apple-darwin
release: 1.15.0-beta.5
LLVM version: 3.9
rustc 1.16.0-nightly (df8debf6d 2017-01-25)
binary: rustc
commit-hash: df8debf6d9afc431adbbd8311dcaf2b70eb9762e
commit-date: 2017-01-25
host: x86_64-apple-darwin
release: 1.16.0-nightly
LLVM version: 3.9

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions