-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
blocking-next-releaseThis issue should be resolved before we release on crates.ioThis issue should be resolved before we release on crates.iobugSomething isn't workingSomething isn't working
Description
Consider the following type:
#[derive(IntoBytes)]
#[repr(C, align(8))]
struct Foo<T> {
t: T,
}
#[derive(IntoBytes)]
emits an IntoBytes
impl for Foo
with a T: Unaligned
bound. The reasoning is based on the repr(C)
layout algorithm, but this reasoning is unsound in the presence of #[repr(align(8))]
, which #[derive(IntoBytes)]
spuriously ignores.
In particular, Foo<u8>
satisfies u8: Unaligned
, but has size 8 (7 bytes of padding) in order to satisfy its alignment requirement.
We need to either ban #[repr(align(...))]
in #[derive(IntoBytes)]
or at least ban it when generics are present.
Metadata
Metadata
Assignees
Labels
blocking-next-releaseThis issue should be resolved before we release on crates.ioThis issue should be resolved before we release on crates.iobugSomething isn't workingSomething isn't working