From bd52c50d416179008201c0402e113a545ff831a7 Mon Sep 17 00:00:00 2001 From: Colin Wallace Date: Tue, 4 Jun 2019 16:48:36 -0700 Subject: [PATCH] Remove the parameter bounds for __BindgenBitfieldUnit::new This will enable `new` to be changed to a `const fn` in a future patch: `const fn`s do not support trait bounds. --- src/codegen/bitfield_unit.rs | 9 +++++---- .../expectations/tests/bitfield-32bit-overflow.rs | 15 +++++++-------- tests/expectations/tests/bitfield-large.rs | 15 +++++++-------- .../tests/bitfield-method-same-name.rs | 15 +++++++-------- tests/expectations/tests/bitfield_align.rs | 15 +++++++-------- tests/expectations/tests/bitfield_align_2.rs | 15 +++++++-------- .../tests/bitfield_method_mangling.rs | 15 +++++++-------- .../tests/derive-bitfield-method-same-name.rs | 15 +++++++-------- .../tests/derive-debug-bitfield-core.rs | 15 +++++++-------- tests/expectations/tests/derive-debug-bitfield.rs | 15 +++++++-------- .../tests/derive-partialeq-bitfield.rs | 15 +++++++-------- .../tests/divide-by-zero-in-struct-layout.rs | 15 +++++++-------- tests/expectations/tests/issue-1034.rs | 15 +++++++-------- .../issue-1076-unnamed-bitfield-alignment.rs | 15 +++++++-------- .../tests/issue-739-pointer-wide-bitfield.rs | 15 +++++++-------- tests/expectations/tests/issue-816.rs | 15 +++++++-------- tests/expectations/tests/jsval_layout_opaque.rs | 15 +++++++-------- .../expectations/tests/jsval_layout_opaque_1_0.rs | 15 +++++++-------- tests/expectations/tests/layout_align.rs | 15 +++++++-------- tests/expectations/tests/layout_eth_conf.rs | 15 +++++++-------- tests/expectations/tests/layout_eth_conf_1_0.rs | 15 +++++++-------- tests/expectations/tests/layout_mbuf.rs | 15 +++++++-------- tests/expectations/tests/layout_mbuf_1_0.rs | 15 +++++++-------- tests/expectations/tests/only_bitfields.rs | 15 +++++++-------- tests/expectations/tests/struct_with_bitfields.rs | 15 +++++++-------- tests/expectations/tests/union_bitfield.rs | 15 +++++++-------- tests/expectations/tests/union_bitfield_1_0.rs | 15 +++++++-------- .../tests/union_with_anon_struct_bitfield.rs | 15 +++++++-------- .../tests/union_with_anon_struct_bitfield_1_0.rs | 15 +++++++-------- tests/expectations/tests/weird_bitfields.rs | 15 +++++++-------- 30 files changed, 208 insertions(+), 236 deletions(-) diff --git a/src/codegen/bitfield_unit.rs b/src/codegen/bitfield_unit.rs index 7f263fd12f..5c7a09bd6b 100755 --- a/src/codegen/bitfield_unit.rs +++ b/src/codegen/bitfield_unit.rs @@ -1,16 +1,12 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, { storage: Storage, align: [Align; 0], } impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, { #[inline] pub fn new(storage: Storage) -> Self { @@ -19,7 +15,12 @@ where align: [], } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield-32bit-overflow.rs b/tests/expectations/tests/bitfield-32bit-overflow.rs index 9cb1f15244..904a6ccc8d 100644 --- a/tests/expectations/tests/bitfield-32bit-overflow.rs +++ b/tests/expectations/tests/bitfield-32bit-overflow.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield-large.rs b/tests/expectations/tests/bitfield-large.rs index 1791cd32ca..0e069b0130 100644 --- a/tests/expectations/tests/bitfield-large.rs +++ b/tests/expectations/tests/bitfield-large.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield-method-same-name.rs b/tests/expectations/tests/bitfield-method-same-name.rs index 46c4744ea9..bbb3ac60d1 100644 --- a/tests/expectations/tests/bitfield-method-same-name.rs +++ b/tests/expectations/tests/bitfield-method-same-name.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs index 35e9479bab..e11751aab5 100644 --- a/tests/expectations/tests/bitfield_align.rs +++ b/tests/expectations/tests/bitfield_align.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield_align_2.rs b/tests/expectations/tests/bitfield_align_2.rs index 6f93397fc6..eb4e32b848 100644 --- a/tests/expectations/tests/bitfield_align_2.rs +++ b/tests/expectations/tests/bitfield_align_2.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/bitfield_method_mangling.rs b/tests/expectations/tests/bitfield_method_mangling.rs index 8ebb778d69..e9887ce95f 100644 --- a/tests/expectations/tests/bitfield_method_mangling.rs +++ b/tests/expectations/tests/bitfield_method_mangling.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs index 70ee2973a5..d00429cb62 100644 --- a/tests/expectations/tests/derive-bitfield-method-same-name.rs +++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs index 613e00f385..3f07d8ffc0 100644 --- a/tests/expectations/tests/derive-debug-bitfield-core.rs +++ b/tests/expectations/tests/derive-debug-bitfield-core.rs @@ -11,21 +11,20 @@ extern crate core; #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs index 88a41d7890..b9e14337c7 100644 --- a/tests/expectations/tests/derive-debug-bitfield.rs +++ b/tests/expectations/tests/derive-debug-bitfield.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs index f4d916621b..857e0414c0 100644 --- a/tests/expectations/tests/derive-partialeq-bitfield.rs +++ b/tests/expectations/tests/derive-partialeq-bitfield.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/divide-by-zero-in-struct-layout.rs b/tests/expectations/tests/divide-by-zero-in-struct-layout.rs index 1cdd1e09aa..a85c3930d4 100644 --- a/tests/expectations/tests/divide-by-zero-in-struct-layout.rs +++ b/tests/expectations/tests/divide-by-zero-in-struct-layout.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/issue-1034.rs b/tests/expectations/tests/issue-1034.rs index cd0c72179b..db9ce77c47 100644 --- a/tests/expectations/tests/issue-1034.rs +++ b/tests/expectations/tests/issue-1034.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs b/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs index 7a4b77fbad..6ec97f96b5 100644 --- a/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs +++ b/tests/expectations/tests/issue-1076-unnamed-bitfield-alignment.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs index ca56ccceb0..aae1cffa34 100644 --- a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs +++ b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/issue-816.rs b/tests/expectations/tests/issue-816.rs index b5e30fbedd..9fbfd9b399 100644 --- a/tests/expectations/tests/issue-816.rs +++ b/tests/expectations/tests/issue-816.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs index aa0420aa0b..491a6500ce 100644 --- a/tests/expectations/tests/jsval_layout_opaque.rs +++ b/tests/expectations/tests/jsval_layout_opaque.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs index 7bd58819fc..b09d129cf2 100644 --- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs +++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs index e655b9dc8f..a6e3b8b8cd 100644 --- a/tests/expectations/tests/layout_align.rs +++ b/tests/expectations/tests/layout_align.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs index 5582c7ded3..3c2d5f9b44 100644 --- a/tests/expectations/tests/layout_eth_conf.rs +++ b/tests/expectations/tests/layout_eth_conf.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs index b8c20f3d4c..0234bbd486 100644 --- a/tests/expectations/tests/layout_eth_conf_1_0.rs +++ b/tests/expectations/tests/layout_eth_conf_1_0.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs index 6ed1d13083..cbb70d7a98 100644 --- a/tests/expectations/tests/layout_mbuf.rs +++ b/tests/expectations/tests/layout_mbuf.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs index a1ec285ee9..b1fb2b9d59 100644 --- a/tests/expectations/tests/layout_mbuf_1_0.rs +++ b/tests/expectations/tests/layout_mbuf_1_0.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs index 9d925217a9..f8f2c5de71 100644 --- a/tests/expectations/tests/only_bitfields.rs +++ b/tests/expectations/tests/only_bitfields.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs index 3145945243..aff22429dd 100644 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ b/tests/expectations/tests/struct_with_bitfields.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/union_bitfield.rs b/tests/expectations/tests/union_bitfield.rs index d6f52ef5d0..0afc927084 100644 --- a/tests/expectations/tests/union_bitfield.rs +++ b/tests/expectations/tests/union_bitfield.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/union_bitfield_1_0.rs b/tests/expectations/tests/union_bitfield_1_0.rs index abc7c4b056..c875538114 100644 --- a/tests/expectations/tests/union_bitfield_1_0.rs +++ b/tests/expectations/tests/union_bitfield_1_0.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs index f97f122cf0..c451219659 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs index 83ee80eb37..2895a391ec 100644 --- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs +++ b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs index 32220edb2f..7c2cc1bcab 100644 --- a/tests/expectations/tests/weird_bitfields.rs +++ b/tests/expectations/tests/weird_bitfields.rs @@ -9,21 +9,20 @@ #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit { storage: Storage, align: [Align; 0], } -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl __BindgenBitfieldUnit { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len());