Rustc panics(in some cases) when repr(aligned) struct is used in struct with repr(packed) attribute #73112
Labels
A-typesystem
Area: The type system
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I was writing some code that does some x86 page table configuration, but then I noticed that Rust compiler started to panic with this code:
And I did realize that I cannot use
packed
inSomeStruct
sincePageTable
hasalign(4096)
attribute. If I rewrite the above code withoutx86_64
crate:(Note that this is basically same thing as
x86_64
'sPageTable
struct)This compiler error is displayed, which is normal:
And here's output from
RUST_BACKTRACE=1 cargo build --verbose
(In this case, I'm trying to compile the first code):Looking at the backtrace, there's
check_packed
function andexpect_local
:While there's no line number(since the compiler is installed using
rustup
), thankfully there are only two calls toexpect_local
insidecheck_packed
. And it seems like the first one is panicking since normal output has nothing more thannote: `PageTable` has a `#[repr(align)]` attribute
, but I might be wrong.rust/src/librustc_typeck/check/mod.rs
Line 2480 in 9c1857f
I ran
rustup update
about five minutes ago before submitting this issue, but result was the same.BTW: I initially found this bug in Clippy, but then I noticed that Rustc was doing the same thing.
Version
The text was updated successfully, but these errors were encountered: