From f773267b090bf16b9e8375fcbdcd8ba5e88806a8 Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Mon, 25 Jul 2022 11:33:21 +0200 Subject: codegen: Don't generate conflicting packed() and align() representation hints. Fixes #2240 --- bindgen/codegen/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index b5a7b27c..df7602a9 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -2084,7 +2084,9 @@ impl CodeGenerator for CompInfo { attributes.push(attributes::repr("C")); } - if ctx.options().rust_features().repr_align { + if ctx.options().rust_features().repr_align && !packed { + // We can't specify both packed(N) and align(N), but the align() + // should be redundant in this case. if let Some(explicit) = explicit_align { // Ensure that the struct has the correct alignment even in // presence of alignas. -- cgit v1.2.3