Skip to content
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

Internal compiler error, broken MIR, in latest Rust nightly #55183

Closed
timvisee opened this issue Oct 18, 2018 · 15 comments
Closed

Internal compiler error, broken MIR, in latest Rust nightly #55183

timvisee opened this issue Oct 18, 2018 · 15 comments
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@timvisee
Copy link
Contributor

timvisee commented Oct 18, 2018

The latest Rust nightly (rustc 1.31.0-nightly (1dceaddfb 2018-10-17)) has introduced an compiler error, that causes the compiler to crash when compiling nalgebra. I'm not entirely sure posting this here is correct. The problem was introduced in a minor Rust nightly compiler update, and if the code is bad, I don't think the Rust compiler should crash the way it does now.

Here is a snippet of errors that are coming up (complete log):

error: internal compiler error: broken MIR in DefId(0/0:8133 ~ nalgebra[ff9d]::base[0]::swizzle[0]::{{impl}}[0]::xx[0]) (const base::construction::<impl base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer>>::new): bad constant user type FnDef(DefId(0/0:8339 ~ nalgebra[ff9d]::base[0]::construction[0]::{{impl}}[47]::new[0]), Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [_], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(0/0:8338 ~ nalgebra[ff9d]::base[0]::construction[0]::{{impl}}[47]), self_ty: base::matrix::Matrix<_, base::dimension::U2, base::dimension::U1, base::matrix_array::MatrixArray<_, base::dimension::U2, base::dimension::U1>> }) } }) vs fn(N, N) -> base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer> {base::construction::<impl base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer>><N>::new}: NoSolution
  --> src/base/swizzle.rs:14:30
   |
14 |                       $Result::new($(self[$i]),*)
   |                                ^^^
...
21 | / impl_swizzle!(
22 | |     where U0: xx() -> Vector2[0, 0];
23 | |     where U1: xy() -> Vector2[0, 1];
24 | |     where U2: xz() -> Vector2[0, 2];
...  |
66 | |     where U2: zzz() -> Vector3[2, 2, 2]
67 | | );
   | |__- in this macro invocation

error: internal compiler error: broken MIR in DefId(0/0:8135 ~ nalgebra[ff9d]::base[0]::swizzle[0]::{{impl}}[1]::xy[0]) (const base::construction::<impl base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer>>::new): bad constant user type FnDef(DefId(0/0:8339 ~ nalgebra[ff9d]::base[0]::construction[0]::{{impl}}[47]::new[0]), Canonical { variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [_], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(0/0:8338 ~ nalgebra[ff9d]::base[0]::construction[0]::{{impl}}[47]), self_ty: base::matrix::Matrix<_, base::dimension::U2, base::dimension::U1, base::matrix_array::MatrixArray<_, base::dimension::U2, base::dimension::U1>> }) } }) vs fn(N, N) -> base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer> {base::construction::<impl base::matrix::Matrix<N, base::dimension::U2, base::dimension::U1, <base::default_allocator::DefaultAllocator as base::allocator::Allocator<N, base::dimension::U2>>::Buffer>><N>::new}: NoSolution
  --> src/base/swizzle.rs:14:30
   |
14 |                       $Result::new($(self[$i]),*)
   |                                ^^^
...
21 | / impl_swizzle!(
22 | |     where U0: xx() -> Vector2[0, 0];
23 | |     where U1: xy() -> Vector2[0, 1];
24 | |     where U2: xz() -> Vector2[0, 2];
...  |
66 | |     where U2: zzz() -> Vector3[2, 2, 2]
67 | | );
   | |__- in this macro invocation

# --- snip ---

This error is coming up when checking, building and when building for --release.

I'm running this on Ubuntu 18.04, here's some more information:

$ rustc -Vv
rustc 1.31.0-nightly (1dceaddfb 2018-10-17)
binary: rustc
commit-hash: 1dceaddfbe163e2d916c904b98923342730ba970
commit-date: 2018-10-17
host: x86_64-unknown-linux-gnu
release: 1.31.0-nightly
LLVM version: 8.0

$ cargo -Vv
cargo 1.31.0-nightly (5dbac9888 2018-10-08)
release: 1.31.0
commit-hash: 5dbac98885199bbd7c0f189d7405b5523434d1e3
commit-date: 2018-10-08

$ uname -srmo
Linux 4.15.0-33-generic x86_64 GNU/Linux

To reproduce this, ensure you've the same Rust nightly version installed as mentioned above. Then clone the nalgebra repository and run cargo check (faster than compiling). The error should come up when checking nalgebra starts.

@matthewjasper
Copy link
Contributor

cc @nikomatsakis related to type annotation PRs?

@vadixidav
Copy link
Contributor

This also happens on Windows for me. Same errors.

@nikomatsakis
Copy link
Contributor

Could be.

@nikomatsakis
Copy link
Contributor

I think this may be fixed with #55152 -- at least I did not observe it. I'll do a better test though

@nikomatsakis
Copy link
Contributor

Up, I am wrong, I see it.

@nikomatsakis
Copy link
Contributor

This is probably an RC2 blocker :(

@nikomatsakis nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-NLL Area: Non-lexical lifetimes (NLL) labels Oct 18, 2018
@nikomatsakis nikomatsakis added this to the Edition 2018 RC 2 milestone Oct 18, 2018
@nikomatsakis nikomatsakis self-assigned this Oct 18, 2018
@nikomatsakis
Copy link
Contributor

I'm going to try and take a look

@nikomatsakis
Copy link
Contributor

Hmm actually it seems like my branch does fix this.. or at least I am not reproducing now that I did a proper build (all the way to stage2, without --keep-stage or any such nonsense). Checking again. =)

@nikomatsakis
Copy link
Contributor

Oh, geez, I am seeing these errors, but they seem to somehow interact with incremental in a nasty way that makes them go away on the second run! No wonder I keep getting confused.

@nikomatsakis
Copy link
Contributor

I have a fix. I will tack it on to #55152

@nikomatsakis
Copy link
Contributor

I just need a small test case now :P

@nikomatsakis
Copy link
Contributor

Got one, pushed fix to #55152

@Centril Centril added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 18, 2018
bors added a commit that referenced this issue Oct 19, 2018
…stants, r=pnkfelix

support type annot in constants, casts

Fixes #54571
Fixes #54332
Fixes #55183

r? @pnkfelix
@ElusiveMori
Copy link

@nikomatsakis Pardon me, but do you reckon there's an ETA on when the PR might land in nightly?
I tried rolling back to before this issue was introduced, but RLS refused to work with it for some reason (can't install it with rustup), meaning that I am blocked now until this issue is resolved (I imagine many other nalgebra users as well).

@matthewjasper
Copy link
Contributor

It will be in the next nightly I think

@timvisee
Copy link
Contributor Author

I can confirm that this is fixed in the latest nightly. Thanks a bunch, that was a quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants