Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

Closed
joshlf opened this issue Oct 24, 2017 · 1 comment · Fixed by #45723
Closed

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

joshlf opened this issue Oct 24, 2017 · 1 comment · Fixed by #45723
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@joshlf
Copy link
Contributor

joshlf commented Oct 24, 2017

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)
@TimNN TimNN added A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 24, 2017
@sinkuu
Copy link
Contributor

sinkuu commented Nov 2, 2017

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>();
}

bors added a commit that referenced this issue Nov 5, 2017
Fix MIR inlining panic in generic function

MIR inlining calls `Instance::resolve` with a substs containing param, and `trans_apply_param_substs` panics. ~~This PR fixes it by making `Instance::resolve` return `None` if `substs.has_param_types()`, though I'm not sure if this is a right fix.~~

Fixes #45493.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. 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