From 0cfe38cf30be4f00a68eb3206f91df612fec9726 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 19 Aug 2026 08:35:29 +0200 Subject: [PATCH] xtask: allow align 8 in check-raw We need this for the layout fix for MemoryDescriptor. --- xtask/src/check_raw.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xtask/src/check_raw.rs b/xtask/src/check_raw.rs index 6f638ff4..d5c326eb 100644 --- a/xtask/src/check_raw.rs +++ b/xtask/src/check_raw.rs @@ -323,7 +323,12 @@ fn check_fields(fields: &Punctuated, 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! {