xtask: allow align 8 in check-raw

We need this for the layout fix for MemoryDescriptor.
This commit is contained in:
Philipp Schuster 2026-08-19 08:35:29 +02:00
parent e72d1269c9
commit 0cfe38cf30
No known key found for this signature in database

View file

@ -323,7 +323,12 @@ fn check_fields(fields: &Punctuated<Field, Comma>, src: &Path) -> Result<(), Err
}
/// List with allowed combinations of representations (see [`Repr`]).
const ALLOWED_REPRS: &[&[Repr]] = &[&[Repr::C], &[Repr::C, Repr::Packed], &[Repr::Transparent]];
const ALLOWED_REPRS: &[&[Repr]] = &[
&[Repr::C],
&[Repr::C, Repr::Packed],
&[Repr::Align(8), Repr::C],
&[Repr::Transparent],
];
fn check_type_attrs(attrs: &[Attribute], spanned: &dyn Spanned, src: &Path) -> Result<(), Error> {
let attrs = parse_attrs(attrs, src)?;
@ -606,6 +611,20 @@ mod tests {
.is_ok()
);
// Valid `repr(C, align(8))` struct.
assert!(
check_struct(
&parse_quote! {
#[repr(C, align(8))]
pub struct S {
pub f: u32,
}
},
src(),
)
.is_ok()
);
// Missing `pub` on struct.
check_item_err(
parse_quote! {