summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen/mod.rs10
-rw-r--r--tests/expectations/tests/issue-1291.rs8
-rw-r--r--tests/expectations/tests/repr-align.rs9
3 files changed, 18 insertions, 9 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 15b0a139..aee04318 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -1555,10 +1555,12 @@ impl CodeGenerator for CompInfo {
packed = true;
} else {
explicit_align = Some(layout.align);
- let ty = helpers::blob(Layout::new(0, layout.align));
- fields.push(quote! {
- pub __bindgen_align: #ty ,
- });
+ if !ctx.options().rust_features.repr_align {
+ let ty = helpers::blob(Layout::new(0, layout.align));
+ fields.push(quote! {
+ pub __bindgen_align: #ty ,
+ });
+ }
}
}
}
diff --git a/tests/expectations/tests/issue-1291.rs b/tests/expectations/tests/issue-1291.rs
index a2330541..f92d364e 100644
--- a/tests/expectations/tests/issue-1291.rs
+++ b/tests/expectations/tests/issue-1291.rs
@@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
#[repr(C)]
#[repr(align(16))]
@@ -22,7 +27,6 @@ pub struct RTCRay {
pub primID: ::std::os::raw::c_uint,
pub instID: ::std::os::raw::c_uint,
pub __bindgen_padding_0: [u32; 3usize],
- pub __bindgen_align: [u8; 0usize],
}
#[test]
fn bindgen_test_layout_RTCRay() {
diff --git a/tests/expectations/tests/repr-align.rs b/tests/expectations/tests/repr-align.rs
index 1827ca9d..8a0c9023 100644
--- a/tests/expectations/tests/repr-align.rs
+++ b/tests/expectations/tests/repr-align.rs
@@ -1,6 +1,11 @@
/* automatically generated by rust-bindgen */
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#![allow(
+ dead_code,
+ non_snake_case,
+ non_camel_case_types,
+ non_upper_case_globals
+)]
#![cfg(feature = "nightly")]
#[repr(C)]
@@ -9,7 +14,6 @@
pub struct a {
pub b: ::std::os::raw::c_int,
pub c: ::std::os::raw::c_int,
- pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_a() {
@@ -40,7 +44,6 @@ fn bindgen_test_layout_a() {
pub struct b {
pub b: ::std::os::raw::c_int,
pub c: ::std::os::raw::c_int,
- pub __bindgen_align: [u64; 0usize],
}
#[test]
fn bindgen_test_layout_b() {