From 31e440917cdc8ac57cd69ddf929e90a7c4b46367 Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Mon, 8 May 2017 23:41:32 +0200 Subject: codegen: Make phantom fields public. Otherwise you can't construct structs outside of the bindings file, which is breaking. Also, given the previous change was breaking and I didn't notice, I yanked 0.24.1. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/codegen/mod.rs | 1 + .../expectations/tests/anonymous-template-types.rs | 4 ++-- tests/expectations/tests/class_nested.rs | 6 +++--- tests/expectations/tests/class_with_dtor.rs | 2 +- tests/expectations/tests/const_tparam.rs | 2 +- .../tests/default-template-parameter.rs | 4 ++-- .../tests/forward-declaration-autoptr.rs | 2 +- .../tests/forward-inherit-struct-with-fields.rs | 4 ++-- tests/expectations/tests/inherit_named.rs | 2 +- .../issue-584-stylo-template-analysis-panic.rs | 2 +- .../issue-638-stylo-cannot-find-T-in-this-scope.rs | 4 ++-- .../issue-645-cannot-find-type-T-in-this-scope.rs | 2 +- .../tests/issue-662-cannot-find-T-in-this-scope.rs | 6 +++--- tests/expectations/tests/issue-662-part-2.rs | 4 ++-- tests/expectations/tests/namespace.rs | 4 ++-- tests/expectations/tests/nsStyleAutoArray.rs | 4 ++-- tests/expectations/tests/replace_template_alias.rs | 2 +- tests/expectations/tests/replaces_double.rs | 2 +- tests/expectations/tests/template-param-usage-0.rs | 2 +- .../expectations/tests/template-param-usage-10.rs | 8 ++++---- .../expectations/tests/template-param-usage-12.rs | 4 ++-- .../expectations/tests/template-param-usage-13.rs | 2 +- .../expectations/tests/template-param-usage-15.rs | 2 +- tests/expectations/tests/template-param-usage-2.rs | 4 ++-- tests/expectations/tests/template-param-usage-3.rs | 6 +++--- tests/expectations/tests/template-param-usage-4.rs | 2 +- tests/expectations/tests/template-param-usage-5.rs | 2 +- tests/expectations/tests/template-param-usage-7.rs | 4 ++-- tests/expectations/tests/template-param-usage-8.rs | 4 ++-- tests/expectations/tests/template-param-usage-9.rs | 4 ++-- tests/expectations/tests/template.rs | 24 +++++++++++----------- tests/expectations/tests/template_alias.rs | 2 +- .../expectations/tests/template_alias_namespace.rs | 2 +- .../tests/template_typedef_transitive_param.rs | 2 +- .../type_alias_partial_template_especialization.rs | 2 +- tests/expectations/tests/using.rs | 2 +- tests/expectations/tests/what_is_going_on.rs | 2 +- tests/expectations/tests/whitelist_basic.rs | 4 ++-- 40 files changed, 73 insertions(+), 72 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 857ef015..91305caf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "bindgen" -version = "0.24.1" +version = "0.25.0" dependencies = [ "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", "cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 33c1a226..86d0451c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ name = "bindgen" readme = "README.md" repository = "https://github.com/servo/rust-bindgen" documentation = "https://docs.rs/bindgen" -version = "0.24.1" +version = "0.25.0" build = "build.rs" exclude = [ diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 7f0a822a..6f9685b5 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1477,6 +1477,7 @@ impl CodeGenerator for CompInfo { ctx.ext_cx(), ::$prefix::marker::PhantomData<::$prefix::cell::UnsafeCell<$ident>>); let phantom_field = StructFieldBuilder::named(format!("_phantom_{}", idx)) + .pub_() .build_ty(phantom_ty); fields.push(phantom_field); } diff --git a/tests/expectations/tests/anonymous-template-types.rs b/tests/expectations/tests/anonymous-template-types.rs index 50604a3f..1dcd7e97 100644 --- a/tests/expectations/tests/anonymous-template-types.rs +++ b/tests/expectations/tests/anonymous-template-types.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct Foo { pub t_member: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Foo { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -22,7 +22,7 @@ pub struct Bar { #[derive(Debug, Copy, Clone)] pub struct Quux { pub v_member: V, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Quux { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index 8446cbcd..77072354 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -53,7 +53,7 @@ impl Clone for A_C { #[derive(Debug, Copy, Clone)] pub struct A_D { pub foo: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for A_D { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -116,13 +116,13 @@ impl Clone for D { #[derive(Debug, Copy, Clone)] pub struct Templated { pub member: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Templated_Templated_inner { pub member_ptr: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Templated_Templated_inner { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs index 3b15b891..a3210247 100644 --- a/tests/expectations/tests/class_with_dtor.rs +++ b/tests/expectations/tests/class_with_dtor.rs @@ -8,7 +8,7 @@ #[derive(Debug)] pub struct HandleWithDtor { pub ptr: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for HandleWithDtor { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/const_tparam.rs b/tests/expectations/tests/const_tparam.rs index 7600e18e..983958af 100644 --- a/tests/expectations/tests/const_tparam.rs +++ b/tests/expectations/tests/const_tparam.rs @@ -9,7 +9,7 @@ pub struct C { pub foo: *const T, pub bar: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/default-template-parameter.rs b/tests/expectations/tests/default-template-parameter.rs index c098dac7..3b65075c 100644 --- a/tests/expectations/tests/default-template-parameter.rs +++ b/tests/expectations/tests/default-template-parameter.rs @@ -9,8 +9,8 @@ pub struct Foo { pub t: T, pub u: U, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Foo { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs index e129e0fb..08ee31ef 100644 --- a/tests/expectations/tests/forward-declaration-autoptr.rs +++ b/tests/expectations/tests/forward-declaration-autoptr.rs @@ -13,7 +13,7 @@ pub struct Foo { #[derive(Debug, Copy, Clone)] pub struct RefPtr { pub m_inner: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for RefPtr { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs index 1b31f62b..77a43405 100644 --- a/tests/expectations/tests/forward-inherit-struct-with-fields.rs +++ b/tests/expectations/tests/forward-inherit-struct-with-fields.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct Rooted { pub _base: js_RootedBase, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -18,7 +18,7 @@ impl Default for Rooted { pub struct js_RootedBase { pub foo: *mut T, pub next: *mut Rooted, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for js_RootedBase { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/inherit_named.rs b/tests/expectations/tests/inherit_named.rs index a641de70..4951a1c6 100644 --- a/tests/expectations/tests/inherit_named.rs +++ b/tests/expectations/tests/inherit_named.rs @@ -13,7 +13,7 @@ pub struct Wohoo { #[derive(Debug, Copy, Clone)] pub struct Weeee { pub _base: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Weeee { fn default() -> Self { unsafe { ::std::mem::zeroed() } } 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 ddcaf3fc..b1af2b8c 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -43,7 +43,7 @@ impl Clone for A { #[derive(Debug, Copy, Clone)] pub struct e { pub d: RefPtr, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for e { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs index 3afaf62d..0b28a558 100644 --- a/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct RefPtr { pub use_of_t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for RefPtr { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -17,7 +17,7 @@ impl Default for RefPtr { #[derive(Debug, Copy, Clone)] pub struct UsesRefPtrWithAliasedTypeParam { pub member: RefPtr>, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type UsesRefPtrWithAliasedTypeParam_V = U; impl Default for UsesRefPtrWithAliasedTypeParam { diff --git a/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs b/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs index c9695b69..68c07647 100644 --- a/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs @@ -9,7 +9,7 @@ #[derive(Debug, Copy, Clone)] pub struct HasRefPtr { pub refptr_member: RefPtr>, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type HasRefPtr_TypedefOfT = T; impl Default for HasRefPtr { diff --git a/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs b/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs index 4a81f24e..7ee918a3 100644 --- a/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs +++ b/tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct RefPtr { pub a: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for RefPtr { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -17,7 +17,7 @@ impl Default for RefPtr { #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHolder { pub a: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHolder { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -26,7 +26,7 @@ impl Default for nsMainThreadPtrHolder { #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHandle { pub mPtr: RefPtr>, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHandle { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/issue-662-part-2.rs b/tests/expectations/tests/issue-662-part-2.rs index eb9a34d1..52a9cafc 100644 --- a/tests/expectations/tests/issue-662-part-2.rs +++ b/tests/expectations/tests/issue-662-part-2.rs @@ -9,7 +9,7 @@ #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHolder { pub a: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHolder { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -18,7 +18,7 @@ impl Default for nsMainThreadPtrHolder { #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHandle { pub mPtr: RefPtr>, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHandle { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs index 86d5e892..0fca8d72 100644 --- a/tests/expectations/tests/namespace.rs +++ b/tests/expectations/tests/namespace.rs @@ -69,7 +69,7 @@ pub mod root { pub m_c: T, pub m_c_ptr: *mut T, pub m_c_arr: [T; 10usize], - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for C { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -82,7 +82,7 @@ pub mod root { #[derive(Debug)] pub struct D { pub m_c: root::C, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for D { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs index 04f01c0c..ea68980d 100644 --- a/tests/expectations/tests/nsStyleAutoArray.rs +++ b/tests/expectations/tests/nsStyleAutoArray.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct nsTArray { pub mBuff: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsTArray { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -18,7 +18,7 @@ impl Default for nsTArray { pub struct nsStyleAutoArray { pub mFirstElement: T, pub mOtherElements: nsTArray, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/tests/expectations/tests/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs index 65a5332b..4de44d25 100644 --- a/tests/expectations/tests/replace_template_alias.rs +++ b/tests/expectations/tests/replace_template_alias.rs @@ -12,7 +12,7 @@ pub type JS_detail_MaybeWrapped = T; #[derive(Debug, Copy, Clone)] pub struct JS_Rooted { pub ptr: JS_detail_MaybeWrapped, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for JS_Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs index f7093d3d..f3bc0bf4 100644 --- a/tests/expectations/tests/replaces_double.rs +++ b/tests/expectations/tests/replaces_double.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct Rooted { pub ptr: Rooted_MaybeWrapped, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } /** *
diff --git a/tests/expectations/tests/template-param-usage-0.rs b/tests/expectations/tests/template-param-usage-0.rs index a36d729a..c782132b 100644 --- a/tests/expectations/tests/template-param-usage-0.rs +++ b/tests/expectations/tests/template-param-usage-0.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { pub t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for UsesTemplateParameter { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-10.rs b/tests/expectations/tests/template-param-usage-10.rs index d41740cd..bee2ffd0 100644 --- a/tests/expectations/tests/template-param-usage-10.rs +++ b/tests/expectations/tests/template-param-usage-10.rs @@ -8,8 +8,8 @@ #[derive(Debug, Copy, Clone)] pub struct DoublyIndirectUsage { pub doubly_indirect: DoublyIndirectUsage_IndirectUsage, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type DoublyIndirectUsage_Aliased = T; pub type DoublyIndirectUsage_Typedefed = U; @@ -18,8 +18,8 @@ pub type DoublyIndirectUsage_Typedefed = U; pub struct DoublyIndirectUsage_IndirectUsage { pub member: DoublyIndirectUsage_Aliased, pub another: DoublyIndirectUsage_Typedefed, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for DoublyIndirectUsage_IndirectUsage { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-12.rs b/tests/expectations/tests/template-param-usage-12.rs index fcf10615..0823de1e 100644 --- a/tests/expectations/tests/template-param-usage-12.rs +++ b/tests/expectations/tests/template-param-usage-12.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct BaseUsesT { pub t: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseUsesT { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -18,7 +18,7 @@ impl Default for BaseUsesT { pub struct CrtpUsesU { pub _base: BaseUsesT>, pub usage: U, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for CrtpUsesU { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-13.rs b/tests/expectations/tests/template-param-usage-13.rs index 10e45ed1..0d850c7b 100644 --- a/tests/expectations/tests/template-param-usage-13.rs +++ b/tests/expectations/tests/template-param-usage-13.rs @@ -14,7 +14,7 @@ pub struct BaseIgnoresT { pub struct CrtpUsesU { pub _base: BaseIgnoresT, pub usage: U, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for CrtpUsesU { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-15.rs b/tests/expectations/tests/template-param-usage-15.rs index 77667b45..060c6e07 100644 --- a/tests/expectations/tests/template-param-usage-15.rs +++ b/tests/expectations/tests/template-param-usage-15.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct BaseUsesT { pub usage: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseUsesT { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-2.rs b/tests/expectations/tests/template-param-usage-2.rs index 4f5987a1..008826b6 100644 --- a/tests/expectations/tests/template-param-usage-2.rs +++ b/tests/expectations/tests/template-param-usage-2.rs @@ -8,13 +8,13 @@ #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { pub t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter_AlsoUsesTemplateParameter { pub also: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for UsesTemplateParameter_AlsoUsesTemplateParameter { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-3.rs b/tests/expectations/tests/template-param-usage-3.rs index 07571dcc..5a94b95d 100644 --- a/tests/expectations/tests/template-param-usage-3.rs +++ b/tests/expectations/tests/template-param-usage-3.rs @@ -8,15 +8,15 @@ #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { pub t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter_AlsoUsesTemplateParameterAndMore { pub also: T, pub more: U, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for UsesTemplateParameter_AlsoUsesTemplateParameterAndMore { diff --git a/tests/expectations/tests/template-param-usage-4.rs b/tests/expectations/tests/template-param-usage-4.rs index 7b8fe9f1..f95a4c60 100644 --- a/tests/expectations/tests/template-param-usage-4.rs +++ b/tests/expectations/tests/template-param-usage-4.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { pub t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/template-param-usage-5.rs b/tests/expectations/tests/template-param-usage-5.rs index 3efdfac3..d719dbc8 100644 --- a/tests/expectations/tests/template-param-usage-5.rs +++ b/tests/expectations/tests/template-param-usage-5.rs @@ -8,7 +8,7 @@ #[derive(Debug, Copy, Clone)] pub struct IndirectlyUsesTemplateParameter { pub aliased: IndirectlyUsesTemplateParameter_Aliased, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type IndirectlyUsesTemplateParameter_Aliased = T; impl Default for IndirectlyUsesTemplateParameter { diff --git a/tests/expectations/tests/template-param-usage-7.rs b/tests/expectations/tests/template-param-usage-7.rs index 3d1378ad..326917fc 100644 --- a/tests/expectations/tests/template-param-usage-7.rs +++ b/tests/expectations/tests/template-param-usage-7.rs @@ -9,8 +9,8 @@ pub struct DoesNotUseU { pub t: T, pub v: V, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for DoesNotUseU { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template-param-usage-8.rs b/tests/expectations/tests/template-param-usage-8.rs index 322c7257..55c39e19 100644 --- a/tests/expectations/tests/template-param-usage-8.rs +++ b/tests/expectations/tests/template-param-usage-8.rs @@ -9,8 +9,8 @@ pub struct IndirectUsage { pub member1: IndirectUsage_Typedefed, pub member2: IndirectUsage_Aliased, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type IndirectUsage_Typedefed = T; pub type IndirectUsage_Aliased = U; diff --git a/tests/expectations/tests/template-param-usage-9.rs b/tests/expectations/tests/template-param-usage-9.rs index 5f2319c4..ec6c66b2 100644 --- a/tests/expectations/tests/template-param-usage-9.rs +++ b/tests/expectations/tests/template-param-usage-9.rs @@ -16,8 +16,8 @@ pub type DoesNotUse_Typedefed = U; pub struct DoesNotUse_IndirectUsage { pub member: DoesNotUse_Aliased, pub another: DoesNotUse_Typedefed, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, - _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for DoesNotUse_IndirectUsage { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 682c6db9..d4f81711 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -10,7 +10,7 @@ pub struct Foo { pub m_member: T, pub m_member_ptr: *mut T, pub m_member_arr: [T; 1usize], - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Foo { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -30,7 +30,7 @@ pub type D_MyFoo = Foo<::std::os::raw::c_int>; pub struct D_U { pub m_nested_foo: D_MyFoo, pub m_baz: Z, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for D_U { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -44,7 +44,7 @@ pub struct Rooted { pub prev: *mut T, pub next: *mut Rooted<*mut ::std::os::raw::c_void>, pub ptr: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -76,7 +76,7 @@ impl Default for RootedContainer { #[derive(Debug)] pub struct WithDtor { pub member: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for WithDtor { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -137,7 +137,7 @@ impl Clone for POD { #[derive(Debug, Copy, Clone)] pub struct NestedReplaced { pub buff: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedReplaced { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -146,7 +146,7 @@ impl Default for NestedReplaced { #[derive(Debug, Copy, Clone)] pub struct NestedBase { pub buff: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedBase { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -155,7 +155,7 @@ impl Default for NestedBase { #[derive(Debug, Copy, Clone)] pub struct Incomplete { pub d: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Incomplete { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -166,7 +166,7 @@ pub struct NestedContainer { pub c: T, pub nested: NestedReplaced, pub inc: Incomplete, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedContainer { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -201,7 +201,7 @@ pub struct Templated { #[derive(Debug)] pub struct ReplacedWithoutDestructor { pub buff: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ReplacedWithoutDestructor { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -210,7 +210,7 @@ impl Default for ReplacedWithoutDestructor { #[derive(Debug)] pub struct ShouldNotBeCopiable { pub m_member: ReplacedWithoutDestructor, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ShouldNotBeCopiable { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -219,7 +219,7 @@ impl Default for ShouldNotBeCopiable { #[derive(Debug)] pub struct ShouldNotBeCopiableAsWell { pub m_member: ReplacedWithoutDestructorFwd, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ShouldNotBeCopiableAsWell { fn default() -> Self { unsafe { ::std::mem::zeroed() } } @@ -234,7 +234,7 @@ impl Default for ShouldNotBeCopiableAsWell { #[derive(Debug)] pub struct ReplacedWithoutDestructorFwd { pub buff: *mut T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ReplacedWithoutDestructorFwd { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template_alias.rs b/tests/expectations/tests/template_alias.rs index f98d165d..c440c278 100644 --- a/tests/expectations/tests/template_alias.rs +++ b/tests/expectations/tests/template_alias.rs @@ -9,7 +9,7 @@ pub type JS_detail_Wrapped = T; #[derive(Debug, Copy, Clone)] pub struct JS_Rooted { pub ptr: JS_detail_Wrapped, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for JS_Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template_alias_namespace.rs b/tests/expectations/tests/template_alias_namespace.rs index 491bb68c..dfcbe367 100644 --- a/tests/expectations/tests/template_alias_namespace.rs +++ b/tests/expectations/tests/template_alias_namespace.rs @@ -20,7 +20,7 @@ pub mod root { #[derive(Debug, Copy, Clone)] pub struct Rooted { pub ptr: root::JS::detail::Wrapped, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/template_typedef_transitive_param.rs b/tests/expectations/tests/template_typedef_transitive_param.rs index 5f6b4c38..cc360cd1 100644 --- a/tests/expectations/tests/template_typedef_transitive_param.rs +++ b/tests/expectations/tests/template_typedef_transitive_param.rs @@ -13,7 +13,7 @@ pub struct Wrapper { #[derive(Debug, Copy, Clone)] pub struct Wrapper_Wrapped { pub t: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Wrapper_Wrapped { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/type_alias_partial_template_especialization.rs b/tests/expectations/tests/type_alias_partial_template_especialization.rs index 09c32486..a3970c68 100644 --- a/tests/expectations/tests/type_alias_partial_template_especialization.rs +++ b/tests/expectations/tests/type_alias_partial_template_especialization.rs @@ -9,7 +9,7 @@ pub type MaybeWrapped = A; #[derive(Debug, Copy, Clone)] pub struct Rooted { pub ptr: MaybeWrapped, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/using.rs b/tests/expectations/tests/using.rs index 44376b93..2997bcf5 100644 --- a/tests/expectations/tests/using.rs +++ b/tests/expectations/tests/using.rs @@ -9,7 +9,7 @@ pub struct Point { pub x: T, pub y: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Point { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/what_is_going_on.rs b/tests/expectations/tests/what_is_going_on.rs index fa56f04b..388fe472 100644 --- a/tests/expectations/tests/what_is_going_on.rs +++ b/tests/expectations/tests/what_is_going_on.rs @@ -25,7 +25,7 @@ pub type Float = f32; pub struct PointTyped { pub x: F, pub y: F, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for PointTyped { fn default() -> Self { unsafe { ::std::mem::zeroed() } } diff --git a/tests/expectations/tests/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs index a83f0273..0eeeba4e 100644 --- a/tests/expectations/tests/whitelist_basic.rs +++ b/tests/expectations/tests/whitelist_basic.rs @@ -9,13 +9,13 @@ pub struct WhitelistMe { pub foo: ::std::os::raw::c_int, pub bar: WhitelistMe_Inner, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct WhitelistMe_Inner { pub bar: T, - _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for WhitelistMe_Inner { fn default() -> Self { unsafe { ::std::mem::zeroed() } } -- cgit v1.2.3