diff options
author | Zhiting Zhu <zzhu@mozilla.com> | 2017-08-04 15:54:53 -0700 |
---|---|---|
committer | Zhiting Zhu <zzhu@mozilla.com> | 2017-08-09 15:19:00 -0700 |
commit | df820a20ca904268033a04506b8c96b416ad90ba (patch) | |
tree | 4cc435d1b7066cd661a39df2d4da2681337c7f04 | |
parent | e358a00e88e5d69608dd0c4967a4e2e0c78f323f (diff) |
Template related tests for derive Hash
-rw-r--r-- | tests/expectations/tests/anonymous-template-types.rs | 8 | ||||
-rw-r--r-- | tests/expectations/tests/empty_template_param_name.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/template-fun-ty.rs | 6 | ||||
-rw-r--r-- | tests/expectations/tests/template.rs | 42 | ||||
-rw-r--r-- | tests/expectations/tests/template_alias.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/template_alias_namespace.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/template_typedef_transitive_param.rs | 4 | ||||
-rw-r--r-- | tests/expectations/tests/templateref_opaque.rs | 4 | ||||
-rw-r--r-- | tests/headers/anonymous-template-types.hpp | 2 | ||||
-rw-r--r-- | tests/headers/empty_template_param_name.hpp | 1 | ||||
-rw-r--r-- | tests/headers/template-fun-ty.hpp | 1 | ||||
-rw-r--r-- | tests/headers/template.hpp | 2 | ||||
-rw-r--r-- | tests/headers/template_alias.hpp | 2 | ||||
-rw-r--r-- | tests/headers/template_alias_namespace.hpp | 2 | ||||
-rw-r--r-- | tests/headers/template_typedef_transitive_param.hpp | 1 | ||||
-rw-r--r-- | tests/headers/templateref_opaque.hpp | 1 |
16 files changed, 43 insertions, 39 deletions
diff --git a/tests/expectations/tests/anonymous-template-types.rs b/tests/expectations/tests/anonymous-template-types.rs index 0f19d86e..6d231330 100644 --- a/tests/expectations/tests/anonymous-template-types.rs +++ b/tests/expectations/tests/anonymous-template-types.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct Foo<T> { pub t_member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -14,12 +14,12 @@ impl <T> Default for Foo<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Bar { pub member: ::std::os::raw::c_char, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct Quux<V> { pub v_member: V, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>, @@ -28,7 +28,7 @@ impl <V> Default for Quux<V> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Lobo { pub also_member: ::std::os::raw::c_char, } diff --git a/tests/expectations/tests/empty_template_param_name.rs b/tests/expectations/tests/empty_template_param_name.rs index f182d9c2..07f27e54 100644 --- a/tests/expectations/tests/empty_template_param_name.rs +++ b/tests/expectations/tests/empty_template_param_name.rs @@ -6,7 +6,7 @@ pub type __void_t = ::std::os::raw::c_void; #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct __iterator_traits { pub _address: u8, } diff --git a/tests/expectations/tests/template-fun-ty.rs b/tests/expectations/tests/template-fun-ty.rs index 30571266..a4c8ad44 100644 --- a/tests/expectations/tests/template-fun-ty.rs +++ b/tests/expectations/tests/template-fun-ty.rs @@ -5,19 +5,19 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Foo { pub _address: u8, } pub type Foo_FunctionPtr<T> = ::std::option::Option<unsafe extern "C" fn() -> T>; #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct RefPtr { pub _address: u8, } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct RefPtr_Proxy { pub _address: u8, } diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index f1cc8a25..141af8fa 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -5,7 +5,7 @@ #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct Foo<T> { pub m_member: T, pub m_member_ptr: *mut T, @@ -16,7 +16,7 @@ impl <T> Default for Foo<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct B<T> { pub m_member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -29,7 +29,7 @@ extern "C" { pub fn bar(foo: Foo<::std::os::raw::c_int>); } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Hash)] pub struct C { pub mB: B<::std::os::raw::c_uint>, pub mBConstPtr: B<*const ::std::os::raw::c_int>, @@ -87,13 +87,13 @@ impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct D { pub m_foo: D_MyFoo, } pub type D_MyFoo = Foo<::std::os::raw::c_int>; #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct D_U<Z> { pub m_nested_foo: D_MyFoo, pub m_baz: Z, @@ -106,7 +106,7 @@ impl Default for D { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct Rooted<T> { pub prev: *mut T, pub next: *mut Rooted<*mut ::std::os::raw::c_void>, @@ -117,7 +117,7 @@ impl <T> Default for Rooted<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Hash)] pub struct RootedContainer { pub root: Rooted<*mut ::std::os::raw::c_void>, } @@ -140,7 +140,7 @@ impl Default for RootedContainer { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct WithDtor<T> { pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -150,7 +150,7 @@ impl <T> Default for WithDtor<T> { } pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>; #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct PODButContainsDtor { pub member: WithDtorIntFwd, } @@ -171,11 +171,11 @@ impl Default for PODButContainsDtor { } /// <div rustbindgen opaque> #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Opaque { } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct POD { pub opaque_member: u32, } @@ -196,7 +196,7 @@ impl Clone for POD { } /// <div rustbindgen replaces="NestedReplaced"></div> #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct NestedReplaced<T> { pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -205,7 +205,7 @@ impl <T> Default for NestedReplaced<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct NestedBase<T> { pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -214,7 +214,7 @@ impl <T> Default for NestedBase<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct Incomplete<T> { pub d: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -223,7 +223,7 @@ impl <T> Default for Incomplete<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct NestedContainer<T> { pub c: T, pub nested: NestedReplaced<T>, @@ -234,7 +234,7 @@ impl <T> Default for NestedContainer<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug, Default, Copy)] +#[derive(Debug, Default, Copy, Hash)] pub struct Untemplated { pub _address: u8, } @@ -249,7 +249,7 @@ impl Clone for Untemplated { fn clone(&self) -> Self { *self } } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Templated { pub m_untemplated: Untemplated, } @@ -258,7 +258,7 @@ pub struct Templated { /// /// <div rustbindgen replaces="ReplacedWithoutDestructor"></div> #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct ReplacedWithoutDestructor<T> { pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -267,7 +267,7 @@ impl <T> Default for ReplacedWithoutDestructor<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct ShouldNotBeCopiable<T> { pub m_member: ReplacedWithoutDestructor<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, @@ -276,7 +276,7 @@ impl <T> Default for ShouldNotBeCopiable<T> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct ShouldNotBeCopiableAsWell<U> { pub m_member: ReplacedWithoutDestructorFwd<U>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>, @@ -289,7 +289,7 @@ impl <U> Default for ShouldNotBeCopiableAsWell<U> { /// /// <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div> #[repr(C)] -#[derive(Debug)] +#[derive(Debug, Hash)] pub struct ReplacedWithoutDestructorFwd<T> { pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs index a718e704..537fc376 100644 --- a/tests/expectations/tests/template_alias.rs +++ b/tests/expectations/tests/template_alias.rs @@ -6,7 +6,7 @@ pub type JS_detail_Wrapped<T> = T; #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct JS_Rooted<T> { pub ptr: JS_detail_Wrapped<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs index 2fb88a81..ba94dd7d 100644 --- a/tests/expectations/tests/template_alias_namespace.rs +++ b/tests/expectations/tests/template_alias_namespace.rs @@ -17,7 +17,7 @@ pub mod root { pub type Wrapped<T> = T; } #[repr(C)] - #[derive(Debug, Copy, Clone)] + #[derive(Debug, Copy, Clone, Hash)] pub struct Rooted<T> { pub ptr: root::JS::detail::Wrapped<T>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs index 05604223..6a0026fb 100644 --- a/tests/expectations/tests/template_typedef_transitive_param.rs +++ b/tests/expectations/tests/template_typedef_transitive_param.rs @@ -5,12 +5,12 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct Wrapper { pub _address: u8, } #[repr(C)] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, Hash)] pub struct Wrapper_Wrapped<T> { pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, diff --git a/tests/expectations/tests/templateref_opaque.rs b/tests/expectations/tests/templateref_opaque.rs index 5f6a7459..a20dd691 100644 --- a/tests/expectations/tests/templateref_opaque.rs +++ b/tests/expectations/tests/templateref_opaque.rs @@ -5,13 +5,13 @@ #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct detail_PointerType { pub _address: u8, } pub type detail_PointerType_Type<T> = *mut T; #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone, Hash)] pub struct UniquePtr { pub _address: u8, } diff --git a/tests/headers/anonymous-template-types.hpp b/tests/headers/anonymous-template-types.hpp index 9ada71a9..34924fc9 100644 --- a/tests/headers/anonymous-template-types.hpp +++ b/tests/headers/anonymous-template-types.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: -- -std=c++14 +// bindgen-flags: --with-derive-hash -- -std=c++14 template <typename T, typename> struct Foo { diff --git a/tests/headers/empty_template_param_name.hpp b/tests/headers/empty_template_param_name.hpp index 0e9f3c34..ef212d55 100644 --- a/tests/headers/empty_template_param_name.hpp +++ b/tests/headers/empty_template_param_name.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash // bindgen-flags: -- -std=c++11 template<typename...> using __void_t = void; diff --git a/tests/headers/template-fun-ty.hpp b/tests/headers/template-fun-ty.hpp index 1e8e1c25..cc33fb74 100644 --- a/tests/headers/template-fun-ty.hpp +++ b/tests/headers/template-fun-ty.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash template <typename T> class Foo { diff --git a/tests/headers/template.hpp b/tests/headers/template.hpp index 168eac9c..c3dff4f7 100644 --- a/tests/headers/template.hpp +++ b/tests/headers/template.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: -- -std=c++11 +// bindgen-flags: --with-derive-hash -- -std=c++11 // template<typename T, typename U> class Foo { T m_member; diff --git a/tests/headers/template_alias.hpp b/tests/headers/template_alias.hpp index 646d9f40..684bf286 100644 --- a/tests/headers/template_alias.hpp +++ b/tests/headers/template_alias.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: -- -std=c++14 +// bindgen-flags: --with-derive-hash -- -std=c++14 namespace JS { namespace detail { diff --git a/tests/headers/template_alias_namespace.hpp b/tests/headers/template_alias_namespace.hpp index bd637166..b24e4bd3 100644 --- a/tests/headers/template_alias_namespace.hpp +++ b/tests/headers/template_alias_namespace.hpp @@ -1,4 +1,4 @@ -// bindgen-flags: --enable-cxx-namespaces -- -std=c++14 +// bindgen-flags: --with-derive-hash --enable-cxx-namespaces -- -std=c++14 namespace JS { namespace detail { diff --git a/tests/headers/template_typedef_transitive_param.hpp b/tests/headers/template_typedef_transitive_param.hpp index 2269ac36..2c50cda6 100644 --- a/tests/headers/template_typedef_transitive_param.hpp +++ b/tests/headers/template_typedef_transitive_param.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash template<typename T> struct Wrapper { struct Wrapped { diff --git a/tests/headers/templateref_opaque.hpp b/tests/headers/templateref_opaque.hpp index ca154c34..1dcf4778 100644 --- a/tests/headers/templateref_opaque.hpp +++ b/tests/headers/templateref_opaque.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --with-derive-hash namespace detail { template<typename T> |