diff options
author | Colin Wallace <colin@mooooo.ooo> | 2019-06-04 16:48:36 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-06-06 09:50:47 -0400 |
commit | 9c2cc9520430ecbe31298c19e6b98ed5bdc0d02a (patch) | |
tree | f61080f2c237a63f1611ade7f1efa24e924f43e1 | |
parent | 12b41ce31b058dea693aceeac7171548f9f5b6c7 (diff) |
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.
30 files changed, 208 insertions, 236 deletions
diff --git a/src/codegen/bitfield_unit.rs b/src/codegen/bitfield_unit.rs index 7f263fd1..5c7a09bd 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, { storage: Storage, align: [Align; 0], } impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, { #[inline] pub fn new(storage: Storage) -> Self { @@ -19,7 +15,12 @@ where align: [], } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 9cb1f152..904a6ccc 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 1791cd32..0e069b01 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 46c4744e..bbb3ac60 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 35e9479b..e11751aa 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 6f93397f..eb4e32b8 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 8ebb778d..e9887ce9 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 70ee2973..d00429cb 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 613e00f3..3f07d8ff 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 88a41d78..b9e14337 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 f4d91662..857e0414 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 1cdd1e09..a85c3930 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 cd0c7217..db9ce77c 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 7a4b77fb..6ec97f96 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 ca56ccce..aae1cffa 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 b5e30fbe..9fbfd9b3 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 aa0420aa..491a6500 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 7bd58819..b09d129c 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 e655b9dc..a6e3b8b8 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 5582c7de..3c2d5f9b 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 b8c20f3d..0234bbd4 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 6ed1d130..cbb70d7a 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 a1ec285e..b1fb2b9d 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 9d925217..f8f2c5de 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 31459452..aff22429 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 d6f52ef5..0afc9270 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 abc7c4b0..c8755381 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 f97f122c..c4512196 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 83ee80eb..2895a391 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +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 32220edb..7c2cc1bc 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<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +pub struct __BindgenBitfieldUnit<Storage, Align> { storage: Storage, align: [Align; 0], } -impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> { #[inline] pub fn new(storage: Storage) -> Self { Self { storage, align: [] } } +} +impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align> +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ #[inline] pub fn get_bit(&self, index: usize) -> bool { debug_assert!(index / 8 < self.storage.as_ref().len()); |