Skip to content

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

Closed
@timvisee

Description

@timvisee

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.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions