summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2022-07-25 11:33:21 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-27 04:47:50 -0500
commitf773267b090bf16b9e8375fcbdcd8ba5e88806a8 (patch)
tree9849794f671e56b06415ece56e309174eccd084b
parentc8a298d23fe5176f07d2a507690b4119220445ea (diff)
codegen: Don't generate conflicting packed() and align() representation hints.HEADmaster
Fixes #2240
-rw-r--r--bindgen/codegen/mod.rs4
1 files changed, 3 insertions, 1 deletions
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.