diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-08-23 16:54:01 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-09-04 12:08:57 +0200 |
commit | dfe5185fd8757e8f14b6876e6b8359e61e048094 (patch) | |
tree | 9d83e9ffff55d2c370350f4e745622910f854b5f | |
parent | bf9b3e9c31b2f02796b38ec4472e4b32a6978e6c (diff) |
Existing test adjustments.
-rw-r--r-- | tests/expectations/tests/class_nested.rs | 40 | ||||
-rw-r--r-- | tests/expectations/tests/forward-inherit-struct-with-fields.rs | 14 | ||||
-rw-r--r-- | tests/expectations/tests/forward-inherit-struct.rs | 10 | ||||
-rw-r--r-- | tests/expectations/tests/issue-372.rs | 46 | ||||
-rw-r--r-- | tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs | 36 | ||||
-rw-r--r-- | tests/expectations/tests/objc_class.rs | 8 | ||||
-rw-r--r-- | tests/expectations/tests/opaque-tracing.rs | 8 | ||||
-rw-r--r-- | tests/expectations/tests/template.rs | 18 | ||||
-rw-r--r-- | tests/expectations/tests/typeref.rs | 38 | ||||
-rw-r--r-- | tests/expectations/tests/typeref_1_0.rs | 40 | ||||
-rw-r--r-- | tests/expectations/tests/vtable_recursive_sig.rs | 36 |
11 files changed, 147 insertions, 147 deletions
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index 76658b2e..cb23d6dd 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -30,26 +30,6 @@ impl Clone for A_B { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] -pub struct A_C { - pub baz: ::std::os::raw::c_int, -} -#[test] -fn bindgen_test_layout_A_C() { - assert_eq!(::std::mem::size_of::<A_C>() , 4usize , concat ! ( - "Size of: " , stringify ! ( A_C ) )); - assert_eq! (::std::mem::align_of::<A_C>() , 4usize , concat ! ( - "Alignment of " , stringify ! ( A_C ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const A_C ) ) . baz as * const _ as usize } , - 0usize , concat ! ( - "Alignment of field: " , stringify ! ( A_C ) , "::" , - stringify ! ( baz ) )); -} -impl Clone for A_C { - fn clone(&self) -> Self { *self } -} -#[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct A_D<T> { pub foo: T, @@ -73,6 +53,26 @@ fn bindgen_test_layout_A() { impl Clone for A { fn clone(&self) -> Self { *self } } +#[repr(C)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] +pub struct C { + pub baz: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_C() { + assert_eq!(::std::mem::size_of::<C>() , 4usize , concat ! ( + "Size of: " , stringify ! ( C ) )); + assert_eq! (::std::mem::align_of::<C>() , 4usize , concat ! ( + "Alignment of " , stringify ! ( C ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const C ) ) . baz as * const _ as usize } , + 0usize , concat ! ( + "Alignment of field: " , stringify ! ( C ) , "::" , stringify + ! ( baz ) )); +} +impl Clone for C { + fn clone(&self) -> Self { *self } +} extern "C" { #[link_name = "var"] pub static mut var: A_B; diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs index 2705ad0f..05c6d3ee 100644 --- a/tests/expectations/tests/forward-inherit-struct-with-fields.rs +++ b/tests/expectations/tests/forward-inherit-struct-with-fields.rs @@ -6,20 +6,20 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct Rooted<T> { - pub _base: js_RootedBase<T>, +pub struct js_RootedBase<T> { + pub foo: *mut T, + pub next: *mut Rooted<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -impl <T> Default for Rooted<T> { +impl <T> Default for js_RootedBase<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct js_RootedBase<T> { - pub foo: *mut T, - pub next: *mut Rooted<T>, +pub struct Rooted<T> { + pub _base: js_RootedBase<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -impl <T> Default for js_RootedBase<T> { +impl <T> Default for Rooted<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } diff --git a/tests/expectations/tests/forward-inherit-struct.rs b/tests/expectations/tests/forward-inherit-struct.rs index 28d8928b..e3f2b225 100644 --- a/tests/expectations/tests/forward-inherit-struct.rs +++ b/tests/expectations/tests/forward-inherit-struct.rs @@ -5,6 +5,11 @@ #[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct js_RootedBase { + pub _address: u8, +} +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { pub _address: u8, @@ -12,8 +17,3 @@ pub struct Rooted { impl Default for Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct js_RootedBase { - pub _address: u8, -} diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs index 8a115924..6924d0a9 100644 --- a/tests/expectations/tests/issue-372.rs +++ b/tests/expectations/tests/issue-372.rs @@ -10,29 +10,6 @@ pub mod root { use self::super::root; #[repr(C)] #[derive(Debug, Copy)] - pub struct d { - pub m: root::i, - } - #[test] - fn bindgen_test_layout_d() { - assert_eq!(::std::mem::size_of::<d>() , 24usize , concat ! ( - "Size of: " , stringify ! ( d ) )); - assert_eq! (::std::mem::align_of::<d>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( d ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const d ) ) . m as * const _ as usize } , - 0usize , concat ! ( - "Alignment of field: " , stringify ! ( d ) , "::" , - stringify ! ( m ) )); - } - impl Clone for d { - fn clone(&self) -> Self { *self } - } - impl Default for d { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } - } - #[repr(C)] - #[derive(Debug, Copy)] pub struct i { pub j: *mut root::i, pub k: *mut root::i, @@ -66,6 +43,29 @@ pub mod root { impl Default for i { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct d { + pub m: root::i, + } + #[test] + fn bindgen_test_layout_d() { + assert_eq!(::std::mem::size_of::<d>() , 24usize , concat ! ( + "Size of: " , stringify ! ( d ) )); + assert_eq! (::std::mem::align_of::<d>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( d ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const d ) ) . m as * const _ as usize } , + 0usize , concat ! ( + "Alignment of field: " , stringify ! ( d ) , "::" , + stringify ! ( m ) )); + } + impl Clone for d { + fn clone(&self) -> Self { *self } + } + impl Default for d { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } + } #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum n { diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs index 5c6d595b..540b5e7f 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -6,24 +6,6 @@ pub type RefPtr<T> = T; #[repr(C)] -#[derive(Debug, Copy)] -pub struct b { - pub _base: g, -} -#[test] -fn bindgen_test_layout_b() { - assert_eq!(::std::mem::size_of::<b>() , 1usize , concat ! ( - "Size of: " , stringify ! ( b ) )); - assert_eq! (::std::mem::align_of::<b>() , 1usize , concat ! ( - "Alignment of " , stringify ! ( b ) )); -} -impl Clone for b { - fn clone(&self) -> Self { *self } -} -impl Default for b { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -#[repr(C)] #[derive(Debug, Default, Copy)] pub struct A { pub _address: u8, @@ -75,6 +57,24 @@ impl Clone for g { impl Default for g { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +#[repr(C)] +#[derive(Debug, Copy)] +pub struct b { + pub _base: g, +} +#[test] +fn bindgen_test_layout_b() { + assert_eq!(::std::mem::size_of::<b>() , 1usize , concat ! ( + "Size of: " , stringify ! ( b ) )); + assert_eq! (::std::mem::align_of::<b>() , 1usize , concat ! ( + "Alignment of " , stringify ! ( b ) )); +} +impl Clone for b { + fn clone(&self) -> Self { *self } +} +impl Default for b { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} extern "C" { #[link_name = "_Z25Servo_Element_GetSnapshotv"] pub fn Servo_Element_GetSnapshot() -> A; diff --git a/tests/expectations/tests/objc_class.rs b/tests/expectations/tests/objc_class.rs index 21f7c0d1..31473c51 100644 --- a/tests/expectations/tests/objc_class.rs +++ b/tests/expectations/tests/objc_class.rs @@ -9,13 +9,13 @@ extern crate objc; #[allow(non_camel_case_types)] pub type id = *mut objc::runtime::Object; +extern "C" { + #[link_name = "fooVar"] + pub static mut fooVar: *mut id; +} pub trait Foo { unsafe fn method(self); } impl Foo for id { unsafe fn method(self) { msg_send!(self , method) } } -extern "C" { - #[link_name = "fooVar"] - pub static mut fooVar: *mut id; -} diff --git a/tests/expectations/tests/opaque-tracing.rs b/tests/expectations/tests/opaque-tracing.rs index 8c80c83a..9d28d7c2 100644 --- a/tests/expectations/tests/opaque-tracing.rs +++ b/tests/expectations/tests/opaque-tracing.rs @@ -4,6 +4,10 @@ #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] +extern "C" { + #[link_name = "_Z3fooP9Container"] + pub fn foo(c: *mut Container); +} #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct Container { @@ -19,7 +23,3 @@ fn bindgen_test_layout_Container() { impl Clone for Container { fn clone(&self) -> Self { *self } } -extern "C" { - #[link_name = "_Z3fooP9Container"] - pub fn foo(c: *mut Container); -} diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 91bdee72..4033f07b 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -192,6 +192,7 @@ impl Clone for RootedContainer { impl Default for RootedContainer { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>; #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct WithDtor<T> { @@ -201,7 +202,6 @@ pub struct WithDtor<T> { impl <T> Default for WithDtor<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } -pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>; #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct PODButContainsDtor { @@ -268,22 +268,22 @@ impl <T> Default for NestedBase<T> { } #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct Incomplete<T> { - pub d: T, +pub struct NestedContainer<T> { + pub c: T, + pub nested: NestedReplaced<T>, + pub inc: Incomplete<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -impl <T> Default for Incomplete<T> { +impl <T> Default for NestedContainer<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct NestedContainer<T> { - pub c: T, - pub nested: NestedReplaced<T>, - pub inc: Incomplete<T>, +pub struct Incomplete<T> { + pub d: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, } -impl <T> Default for NestedContainer<T> { +impl <T> Default for Incomplete<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index cefd02ba..2bbdcbb1 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -5,25 +5,6 @@ #[repr(C)] -pub struct nsFoo { - pub mBar: mozilla_StyleShapeSource, -} -#[test] -fn bindgen_test_layout_nsFoo() { - assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize , concat ! ( - "Size of: " , stringify ! ( nsFoo ) )); - assert_eq! (::std::mem::align_of::<nsFoo>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( nsFoo ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const nsFoo ) ) . mBar as * const _ as usize } - , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( nsFoo ) , "::" , - stringify ! ( mBar ) )); -} -impl Default for nsFoo { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -#[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, @@ -99,6 +80,25 @@ impl Clone for Bar { impl Default for Bar { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +#[repr(C)] +pub struct nsFoo { + pub mBar: mozilla_StyleShapeSource, +} +#[test] +fn bindgen_test_layout_nsFoo() { + assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize , concat ! ( + "Size of: " , stringify ! ( nsFoo ) )); + assert_eq! (::std::mem::align_of::<nsFoo>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( nsFoo ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const nsFoo ) ) . mBar as * const _ as usize } + , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( nsFoo ) , "::" , + stringify ! ( mBar ) )); +} +impl Default for nsFoo { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[test] fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation() { assert_eq!(::std::mem::size_of::<mozilla_StyleShapeSource>() , 8usize , diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index 0d240743..a99df0ad 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -37,26 +37,6 @@ impl <T> ::std::cmp::PartialEq for __BindgenUnionField<T> { impl <T> ::std::cmp::Eq for __BindgenUnionField<T> { } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] -pub struct nsFoo { - pub mBar: mozilla_StyleShapeSource, -} -#[test] -fn bindgen_test_layout_nsFoo() { - assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize , concat ! ( - "Size of: " , stringify ! ( nsFoo ) )); - assert_eq! (::std::mem::align_of::<nsFoo>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( nsFoo ) )); - assert_eq! (unsafe { - & ( * ( 0 as * const nsFoo ) ) . mBar as * const _ as usize } - , 0usize , concat ! ( - "Alignment of field: " , stringify ! ( nsFoo ) , "::" , - stringify ! ( mBar ) )); -} -impl Clone for nsFoo { - fn clone(&self) -> Self { *self } -} -#[repr(C)] -#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct mozilla_FragmentOrURL { pub mIsLocalRef: bool, } @@ -127,6 +107,26 @@ impl Clone for Bar { impl Default for Bar { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } +#[repr(C)] +#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] +pub struct nsFoo { + pub mBar: mozilla_StyleShapeSource, +} +#[test] +fn bindgen_test_layout_nsFoo() { + assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize , concat ! ( + "Size of: " , stringify ! ( nsFoo ) )); + assert_eq! (::std::mem::align_of::<nsFoo>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( nsFoo ) )); + assert_eq! (unsafe { + & ( * ( 0 as * const nsFoo ) ) . mBar as * const _ as usize } + , 0usize , concat ! ( + "Alignment of field: " , stringify ! ( nsFoo ) , "::" , + stringify ! ( mBar ) )); +} +impl Clone for nsFoo { + fn clone(&self) -> Self { *self } +} #[test] fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation() { assert_eq!(::std::mem::size_of::<mozilla_StyleShapeSource>() , 8usize , diff --git a/tests/expectations/tests/vtable_recursive_sig.rs b/tests/expectations/tests/vtable_recursive_sig.rs index f112e0cc..ab2cd875 100644 --- a/tests/expectations/tests/vtable_recursive_sig.rs +++ b/tests/expectations/tests/vtable_recursive_sig.rs @@ -5,24 +5,6 @@ #[repr(C)] -#[derive(Debug, Copy)] -pub struct Derived { - pub _base: Base, -} -#[test] -fn bindgen_test_layout_Derived() { - assert_eq!(::std::mem::size_of::<Derived>() , 8usize , concat ! ( - "Size of: " , stringify ! ( Derived ) )); - assert_eq! (::std::mem::align_of::<Derived>() , 8usize , concat ! ( - "Alignment of " , stringify ! ( Derived ) )); -} -impl Clone for Derived { - fn clone(&self) -> Self { *self } -} -impl Default for Derived { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } -} -#[repr(C)] pub struct Base__bindgen_vtable(::std::os::raw::c_void); #[repr(C)] #[derive(Debug, Copy)] @@ -46,3 +28,21 @@ extern "C" { #[link_name = "_ZN4Base9AsDerivedEv"] pub fn Base_AsDerived(this: *mut ::std::os::raw::c_void) -> *mut Derived; } +#[repr(C)] +#[derive(Debug, Copy)] +pub struct Derived { + pub _base: Base, +} +#[test] +fn bindgen_test_layout_Derived() { + assert_eq!(::std::mem::size_of::<Derived>() , 8usize , concat ! ( + "Size of: " , stringify ! ( Derived ) )); + assert_eq! (::std::mem::align_of::<Derived>() , 8usize , concat ! ( + "Alignment of " , stringify ! ( Derived ) )); +} +impl Clone for Derived { + fn clone(&self) -> Self { *self } +} +impl Default for Derived { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} |