diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-08-03 20:37:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-03 20:37:28 -0500 |
commit | 04fdb10212e729f77343f8548db2f8fdf83a5af9 (patch) | |
tree | f6efa28618ea94b9821025c4f9c02702bdfc9355 /tests | |
parent | b1cfa783108f84b051fe8e4e4f02a484f919f147 (diff) | |
parent | 8c6a2533645438a7741736c2a353a63eb188b30b (diff) |
Auto merge of #889 - photoszzt:fix_recursive_whitelist_opaque, r=fitzgen
Fix recursive whitelisting and handling of opaque for derive default
Fix regression of derive default analysis.
Also fix opaque handing exposed by the above fix. r? @fitzgen
Diffstat (limited to 'tests')
6 files changed, 12 insertions, 18 deletions
diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs index 0de55fab..311b3767 100644 --- a/tests/expectations/tests/no-derive-debug.rs +++ b/tests/expectations/tests/no-derive-debug.rs @@ -9,7 +9,7 @@ /// and replacement for another type that doesn't implement it would prevent it /// from building if --no-derive-debug didn't work. #[repr(C)] -#[derive(Default, Copy)] +#[derive(Copy)] pub struct bar { pub foo: foo, pub baz: ::std::os::raw::c_int, @@ -34,3 +34,6 @@ fn bindgen_test_layout_bar() { impl Clone for bar { fn clone(&self) -> Self { *self } } +impl Default for bar { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} diff --git a/tests/expectations/tests/no-recursive-whitelisting.rs b/tests/expectations/tests/no-recursive-whitelisting.rs index abd092bc..e2aba543 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, Default, Copy)] +#[derive(Debug, Copy)] pub struct Foo { pub baz: *mut Bar, } @@ -25,3 +25,6 @@ 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/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs index 9adf8ef5..65efefb2 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -5,12 +5,9 @@ #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub struct OpaqueTemplate { } -impl Default for OpaqueTemplate { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] #[derive(Debug, Default, Copy)] pub struct ContainsOpaqueTemplate { diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs index 6e239521..9f0969cd 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -5,12 +5,9 @@ #[repr(C)] -#[derive(Copy, Clone)] +#[derive(Default, Copy, Clone)] pub struct OpaqueTemplate { } -impl Default for OpaqueTemplate { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] pub struct ContainsOpaqueTemplate { pub mBlah: [u32; 101usize], diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs index 8c2cab8b..feb22439 100644 --- a/tests/expectations/tests/opaque_pointer.rs +++ b/tests/expectations/tests/opaque_pointer.rs @@ -22,12 +22,9 @@ impl Clone for OtherOpaque { } /// <div rustbindgen opaque></div> #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub struct Opaque { } -impl Default for Opaque { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] #[derive(Debug, Copy)] pub struct WithOpaquePtr { diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 275f45ea..f1cc8a25 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -171,12 +171,9 @@ impl Default for PODButContainsDtor { } /// <div rustbindgen opaque> #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub struct Opaque { } -impl Default for Opaque { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} #[repr(C)] #[derive(Debug, Default, Copy)] pub struct POD { |