rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
99.14k stars 12.8k forks source link

ICE: unexpected panic with mir-opt-level=3 #45493

Closed joshlf closed 7 years ago

joshlf commented 7 years ago

Compiling crossbeam v0.2.10 and smallvec v0.4.4 with -Z mir-opt-level=3, I get the following ICEs:

crossbeam

error: internal compiler error: unexpected panic

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: rustc 1.22.0-nightly (4c053db23 2017-10-22) running on x86_64-apple-darwin

thread 'rustc' panicked at 'substs of instance DefId { krate: CrateNum(0), index: DefIndex(0:186) => crossbeam[826a]::mem[0]::epoch[0]::{{impl}}[1]::deref[0] } not normalized for trans: Slice([T])', src/librustc/ty/instance.rs:103:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `crossbeam`.

smallvec

error: internal compiler error: unexpected panic

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: rustc 1.22.0-nightly (4c053db23 2017-10-22) running on x86_64-apple-darwin

thread 'rustc' panicked at 'substs of instance DefId { krate: CrateNum(2), index: DefIndex(0:17185) => core[af01]::slice[0]::{{impl}}[87]::next[0] } not normalized for trans: Slice([ReErased, T])', src/librustc/ty/instance.rs:103:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: Could not compile `smallvec`.

Misc

$ rustc --version
rustc 1.22.0-nightly (4c053db23 2017-10-22)
sinkuu commented 7 years ago

reproduction:

// -Z mir-opt-level=2 or higher

trait Array {
    type Item;
}

fn foo<A: Array>() {
    let _: *mut A::Item = std::ptr::null_mut();
}

struct Foo;
impl Array for Foo { type Item = i32; }

fn main() {
    foo::<Foo>();
}