Repository navigation
error: internal compiler error: "inference variables in ..." on packed type #61402
Description
Activity
- addedI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️A-inferenceArea: Type inferenceArea: Type inferenceT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on May 31, 2019 Still encountering this in
rustc 1.37.0-nightly (03ee55bb1 2019-06-01).Indepent of the issue, you can install specific compiler versions with necessary components according to this matrix and this installation process.
This ICE itself arises from this line:
rust/src/librustc_typeck/check/wfcheck.rs
Line 264 in 51dc52b
item.span, &format!("inference variables in {:?}", ty)); triage: P-high, assigning to self. Removing nomination.
Okay I've narrowed the test case down
click for first reduction
Here is a standalone file (play):
#![allow(unused_imports, dead_code)] pub struct U1; pub trait ArrayLength { } impl ArrayLength for U1 { } pub trait Trait { type Output; } impl Trait for U1 { type Output = U1; } pub trait DimName { type Value; } impl DimName for U1 { type Value = U1; } pub struct ArrayStorage<R> where R: DimName, R::Value: Trait, <R::Value as Trait>::Output: ArrayLength, { data: <R::Value as Trait>::Output, } pub struct DefaultAllocator; pub trait Allocator<R = U1> { type Buffer; } impl<R: DimName> Allocator<R> for DefaultAllocator where R::Value: Trait, <R::Value as Trait>::Output: ArrayLength, { type Buffer = ArrayStorage<R>; } #[repr(C, packed)] struct Vertex { pos: <DefaultAllocator as Allocator>::Buffer } fn main() { println!("Hello, world!"); }
Update: Got a better reduction now (play):
#![allow(unused_imports, dead_code)] pub struct S; pub trait Trait<R> { type Assoc; } impl<X> Trait<X> for S { type Assoc = X; } #[repr(C, packed)] struct Packed { pos: Box<<S as Trait<usize>>::Assoc>, } fn main() { println!("Hello, world!"); }
This is a stable-to-stable regression, injected between rust 1.23 and 1.24.
- addedregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
on Jun 11, 2019 the fact that the bug goes away if you take away the
packedonstruct Vertexleads me to hypothesize that the bug is caused by some internal layout code for checking the validity (or just computing the effects) of that use ofpacked)- changed the title
[-]error: internal compiler error: inference variables in nalgebra::base::matrix::Matrix<f32, nalgebra::base::dimension::U3, nalgebra::base::dimension::U1, nalgebra::base::array_storage::ArrayStorage<_, _, _>>[/-][+]error: internal compiler error: "inference variables in ..." on packed type[/+]on Jun 11, 2019 (Also, bisection on my mac has shown this was injected by PR #44884 )
- added a commit that references this issue
on Jun 28, 2019 - added 4 commits that reference this issue
on Jul 3, 2019
Given the following source code in both
release 1.35.0and1.36.0-nightly (e305df184 2019-04-24), I encounter an internal compiler error using nalgebra 0.18.0.The code is probably not legal to begin with as I ran into it as I was moving from my own homebrewn math code to nalgebra. I have the impression that the compiler probably shouldn't ICE regardless of what junk you feed it, so I'm still reporting this.
Build output from
cargo +nightly build:I unfortunately do not have a newer nightly to test with due to the lack of a more recent RLS blocking the rustup attempt.