diff options
author | zzhu <zzhu@mozilla.com> | 2017-07-26 18:25:32 -0700 |
---|---|---|
committer | zzhu <zzhu@mozilla.com> | 2017-07-27 16:46:38 -0700 |
commit | 0231a21a98f49064d6bb58734366fdd660ba69c7 (patch) | |
tree | 122f54bab45374c08e0cb74b617dae2c60ff53d6 /tests | |
parent | 0fab51e501f45727169516f605de31e7e1d19a62 (diff) |
can derive default analysis
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expectations/tests/crtp.rs | 10 | ||||
-rw-r--r-- | tests/expectations/tests/issue-573-layout-test-failures.rs | 10 | ||||
-rw-r--r-- | tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/issue-674-1.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/issue-674-2.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/issue-674-3.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/no-recursive-whitelisting.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/replace_use.rs | 5 | ||||
-rw-r--r-- | tests/expectations/tests/typeref.rs | 5 |
9 files changed, 11 insertions, 44 deletions
diff --git a/tests/expectations/tests/crtp.rs b/tests/expectations/tests/crtp.rs index 0b761d52..f2b1dbd8 100644 --- a/tests/expectations/tests/crtp.rs +++ b/tests/expectations/tests/crtp.rs @@ -10,7 +10,7 @@ pub struct Base { pub _address: u8, } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct Derived { pub _address: u8, } @@ -24,16 +24,13 @@ fn bindgen_test_layout_Derived() { impl Clone for Derived { fn clone(&self) -> Self { *self } } -impl Default for Derived { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] #[derive(Debug, Default)] pub struct BaseWithDestructor { pub _address: u8, } #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Default)] pub struct DerivedFromBaseWithDestructor { pub _address: u8, } @@ -47,9 +44,6 @@ fn bindgen_test_layout_DerivedFromBaseWithDestructor() { "Alignment of " , stringify ! ( DerivedFromBaseWithDestructor ) )); } -impl Default for DerivedFromBaseWithDestructor { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[test] fn __bindgen_test_layout_Base_open0_Derived_close0_instantiation() { assert_eq!(::std::mem::size_of::<Base>() , 1usize , concat ! ( diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs index df5d9fc9..50ea61e0 100644 --- a/tests/expectations/tests/issue-573-layout-test-failures.rs +++ b/tests/expectations/tests/issue-573-layout-test-failures.rs @@ -5,15 +5,12 @@ #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub struct Outer { pub i: u8, } -impl Default for Outer { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct AutoIdVector { pub ar: Outer, } @@ -32,9 +29,6 @@ fn bindgen_test_layout_AutoIdVector() { impl Clone for AutoIdVector { fn clone(&self) -> Self { *self } } -impl Default for AutoIdVector { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[test] fn __bindgen_test_layout_Outer_open0_int_close0_instantiation() { assert_eq!(::std::mem::size_of::<Outer>() , 1usize , concat ! ( diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index 3c8f87c3..dd987b76 100644 --- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -10,7 +10,7 @@ pub struct a { pub _address: u8, } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct _bindgen_ty_1 { pub ar: a, } @@ -29,9 +29,6 @@ fn bindgen_test_layout__bindgen_ty_1() { impl Clone for _bindgen_ty_1 { fn clone(&self) -> Self { *self } } -impl Default for _bindgen_ty_1 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} extern "C" { #[link_name = "AutoIdVector"] pub static mut AutoIdVector: _bindgen_ty_1; diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs index 01257c23..31fe3c53 100644 --- a/tests/expectations/tests/issue-674-1.rs +++ b/tests/expectations/tests/issue-674-1.rs @@ -12,14 +12,11 @@ pub mod root { #[allow(unused_imports)] use self::super::super::root; #[repr(C)] - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Default, Copy, Clone)] pub struct Maybe { pub _address: u8, } pub type Maybe_ValueType<T> = T; - impl Default for Maybe { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } - } } #[repr(C)] #[derive(Debug, Default, Copy)] diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs index 5e9ca485..cfbef269 100644 --- a/tests/expectations/tests/issue-674-2.rs +++ b/tests/expectations/tests/issue-674-2.rs @@ -12,14 +12,11 @@ pub mod root { #[allow(unused_imports)] use self::super::super::root; #[repr(C)] - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Default, Copy, Clone)] pub struct Rooted { pub _address: u8, } pub type Rooted_ElementType<T> = T; - impl Default for Rooted { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } - } } #[repr(C)] #[derive(Debug, Default, Copy)] diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs index 6e915a18..71f794c3 100644 --- a/tests/expectations/tests/issue-674-3.rs +++ b/tests/expectations/tests/issue-674-3.rs @@ -9,14 +9,11 @@ pub mod root { #[allow(unused_imports)] use self::super::root; #[repr(C)] - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Default, Copy, Clone)] pub struct nsRefPtrHashtable { pub _address: u8, } pub type nsRefPtrHashtable_UserDataType<PtrType> = *mut PtrType; - impl Default for nsRefPtrHashtable { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } - } #[repr(C)] #[derive(Debug, Default, Copy)] pub struct a { diff --git a/tests/expectations/tests/no-recursive-whitelisting.rs b/tests/expectations/tests/no-recursive-whitelisting.rs index e2aba543..abd092bc 100644 --- a/tests/expectations/tests/no-recursive-whitelisting.rs +++ b/tests/expectations/tests/no-recursive-whitelisting.rs @@ -6,7 +6,7 @@ pub enum Bar {} #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct Foo { pub baz: *mut Bar, } @@ -25,6 +25,3 @@ fn bindgen_test_layout_Foo() { impl Clone for Foo { fn clone(&self) -> Self { *self } } -impl Default for Foo { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs index 3998d5b3..2569f7ac 100644 --- a/tests/expectations/tests/replace_use.rs +++ b/tests/expectations/tests/replace_use.rs @@ -11,7 +11,7 @@ pub struct nsTArray { pub y: ::std::os::raw::c_uint, } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct Test { pub a: nsTArray, } @@ -30,9 +30,6 @@ fn bindgen_test_layout_Test() { impl Clone for Test { fn clone(&self) -> Self { *self } } -impl Default for Test { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[test] fn __bindgen_test_layout_nsTArray_open0_long_close0_instantiation() { assert_eq!(::std::mem::size_of::<nsTArray>() , 4usize , concat ! ( diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index 92f40cc8..53119f09 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -29,7 +29,7 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> { } } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Default, Copy)] pub struct nsFoo { pub mBar: mozilla_StyleShapeSource, } @@ -48,9 +48,6 @@ fn bindgen_test_layout_nsFoo() { impl Clone for nsFoo { fn clone(&self) -> Self { *self } } -impl Default for nsFoo { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] #[derive(Debug, Default, Copy)] pub struct mozilla_FragmentOrURL { |