-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
ICE when using Box<T, A> with non-zero sized A #78459
Copy link
Copy link
Closed
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-layoutArea: Memory layout of typesArea: Memory layout of typesC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Metadata
Metadata
Assignees
Labels
A-allocatorsArea: Custom and system allocatorsArea: Custom and system allocatorsA-layoutArea: Memory layout of typesArea: Memory layout of typesC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Type
Fields
Give feedbackNo fields configured for issues without a type.
While working on #77438, I've run into the following ICE.
It seems to be caused by the type layout code not expectingOn further consideration, the issue also appears withBoxto have more than 3 fields, in this case the fat pointer containing two fields, plus theAllocRefinstance.Box<T, A>as long asAis non zero sized.This ICE was likely not encountered during testing of #77187 because in the case of
Box<T, Global>,Globalis zero sized. In the example below, removing the borrow ofGlobalwill cause the compilation to succeed.@eddyb could you take a look at this? :)
cc @TimDiekmann you may run into this as well on
RawVecCode
Old code
Playground link
New, more minimal code
Playground link
Meta
rustc --version --verbose:Error output
rust/compiler/rustc_middle/src/ty/layout.rs
Line 2056 in 07e968b
Backtrace
From playground