Skip to content

Commit 31e4409

Browse files
committed
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.
1 parent 2d88dd1 commit 31e4409

40 files changed

+73
-72
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "bindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/servo/rust-bindgen"
1515
documentation = "https://docs.rs/bindgen"
16-
version = "0.24.1"
16+
version = "0.25.0"
1717
build = "build.rs"
1818

1919
exclude = [

src/codegen/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,7 @@ impl CodeGenerator for CompInfo {
14771477
ctx.ext_cx(),
14781478
::$prefix::marker::PhantomData<::$prefix::cell::UnsafeCell<$ident>>);
14791479
let phantom_field = StructFieldBuilder::named(format!("_phantom_{}", idx))
1480+
.pub_()
14801481
.build_ty(phantom_ty);
14811482
fields.push(phantom_field);
14821483
}

tests/expectations/tests/anonymous-template-types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct Foo<T> {
1010
pub t_member: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for Foo<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -22,7 +22,7 @@ pub struct Bar {
2222
#[derive(Debug, Copy, Clone)]
2323
pub struct Quux<V> {
2424
pub v_member: V,
25-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
25+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
2626
}
2727
impl <V> Default for Quux<V> {
2828
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/class_nested.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Clone for A_C {
5353
#[derive(Debug, Copy, Clone)]
5454
pub struct A_D<T> {
5555
pub foo: T,
56-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
56+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
5757
}
5858
impl <T> Default for A_D<T> {
5959
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -116,13 +116,13 @@ impl Clone for D {
116116
#[derive(Debug, Copy, Clone)]
117117
pub struct Templated<T> {
118118
pub member: T,
119-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
119+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
120120
}
121121
#[repr(C)]
122122
#[derive(Debug, Copy, Clone)]
123123
pub struct Templated_Templated_inner<T> {
124124
pub member_ptr: *mut T,
125-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
125+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
126126
}
127127
impl <T> Default for Templated_Templated_inner<T> {
128128
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/class_with_dtor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug)]
99
pub struct HandleWithDtor<T> {
1010
pub ptr: *mut T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for HandleWithDtor<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/const_tparam.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
pub struct C<T> {
1010
pub foo: *const T,
1111
pub bar: *mut T,
12-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1313
}
1414
impl <T> Default for C<T> {
1515
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/default-template-parameter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
pub struct Foo<T, U> {
1010
pub t: T,
1111
pub u: U,
12-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
13-
_phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
13+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
1414
}
1515
impl <T, U> Default for Foo<T, U> {
1616
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/forward-declaration-autoptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Foo {
1313
#[derive(Debug, Copy, Clone)]
1414
pub struct RefPtr<T> {
1515
pub m_inner: *mut T,
16-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
16+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1717
}
1818
impl <T> Default for RefPtr<T> {
1919
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/forward-inherit-struct-with-fields.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct Rooted<T> {
1010
pub _base: js_RootedBase<T>,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for Rooted<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -18,7 +18,7 @@ impl <T> Default for Rooted<T> {
1818
pub struct js_RootedBase<T> {
1919
pub foo: *mut T,
2020
pub next: *mut Rooted<T>,
21-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
21+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
2222
}
2323
impl <T> Default for js_RootedBase<T> {
2424
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/inherit_named.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct Wohoo {
1313
#[derive(Debug, Copy, Clone)]
1414
pub struct Weeee<T> {
1515
pub _base: T,
16-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
16+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1717
}
1818
impl <T> Default for Weeee<T> {
1919
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Clone for A {
4343
#[derive(Debug, Copy, Clone)]
4444
pub struct e<c> {
4545
pub d: RefPtr<c>,
46-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<c>>,
46+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<c>>,
4747
}
4848
impl <c> Default for e<c> {
4949
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct RefPtr<T> {
1010
pub use_of_t: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for RefPtr<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -17,7 +17,7 @@ impl <T> Default for RefPtr<T> {
1717
#[derive(Debug, Copy, Clone)]
1818
pub struct UsesRefPtrWithAliasedTypeParam<U> {
1919
pub member: RefPtr<UsesRefPtrWithAliasedTypeParam_V<U>>,
20-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
20+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
2121
}
2222
pub type UsesRefPtrWithAliasedTypeParam_V<U> = U;
2323
impl <U> Default for UsesRefPtrWithAliasedTypeParam<U> {

tests/expectations/tests/issue-645-cannot-find-type-T-in-this-scope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#[derive(Debug, Copy, Clone)]
1010
pub struct HasRefPtr<T> {
1111
pub refptr_member: RefPtr<HasRefPtr_TypedefOfT<T>>,
12-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1313
}
1414
pub type HasRefPtr_TypedefOfT<T> = T;
1515
impl <T> Default for HasRefPtr<T> {

tests/expectations/tests/issue-662-cannot-find-T-in-this-scope.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct RefPtr<T> {
1010
pub a: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for RefPtr<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -17,7 +17,7 @@ impl <T> Default for RefPtr<T> {
1717
#[derive(Debug, Copy, Clone)]
1818
pub struct nsMainThreadPtrHolder<T> {
1919
pub a: T,
20-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
20+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
2121
}
2222
impl <T> Default for nsMainThreadPtrHolder<T> {
2323
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -26,7 +26,7 @@ impl <T> Default for nsMainThreadPtrHolder<T> {
2626
#[derive(Debug, Copy, Clone)]
2727
pub struct nsMainThreadPtrHandle<T> {
2828
pub mPtr: RefPtr<nsMainThreadPtrHolder<T>>,
29-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
29+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
3030
}
3131
impl <T> Default for nsMainThreadPtrHandle<T> {
3232
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/issue-662-part-2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#[derive(Debug, Copy, Clone)]
1010
pub struct nsMainThreadPtrHolder<T> {
1111
pub a: T,
12-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1313
}
1414
impl <T> Default for nsMainThreadPtrHolder<T> {
1515
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -18,7 +18,7 @@ impl <T> Default for nsMainThreadPtrHolder<T> {
1818
#[derive(Debug, Copy, Clone)]
1919
pub struct nsMainThreadPtrHandle<U> {
2020
pub mPtr: RefPtr<nsMainThreadPtrHolder<U>>,
21-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
21+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
2222
}
2323
impl <U> Default for nsMainThreadPtrHandle<U> {
2424
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/namespace.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub mod root {
6969
pub m_c: T,
7070
pub m_c_ptr: *mut T,
7171
pub m_c_arr: [T; 10usize],
72-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
72+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
7373
}
7474
impl <T> Default for C<T> {
7575
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -82,7 +82,7 @@ pub mod root {
8282
#[derive(Debug)]
8383
pub struct D<T> {
8484
pub m_c: root::C<T>,
85-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
85+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
8686
}
8787
impl <T> Default for D<T> {
8888
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/nsStyleAutoArray.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct nsTArray<T> {
1010
pub mBuff: *mut T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for nsTArray<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -18,7 +18,7 @@ impl <T> Default for nsTArray<T> {
1818
pub struct nsStyleAutoArray<T> {
1919
pub mFirstElement: T,
2020
pub mOtherElements: nsTArray<T>,
21-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
21+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
2222
}
2323
#[repr(i32)]
2424
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]

tests/expectations/tests/replace_template_alias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub type JS_detail_MaybeWrapped<T> = T;
1212
#[derive(Debug, Copy, Clone)]
1313
pub struct JS_Rooted<T> {
1414
pub ptr: JS_detail_MaybeWrapped<T>,
15-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
15+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1616
}
1717
impl <T> Default for JS_Rooted<T> {
1818
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/replaces_double.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct Rooted<T> {
1010
pub ptr: Rooted_MaybeWrapped<T>,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
/**
1414
* <div rustbindgen replaces="Rooted_MaybeWrapped"></div>

tests/expectations/tests/template-param-usage-0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct UsesTemplateParameter<T> {
1010
pub t: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for UsesTemplateParameter<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-10.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct DoublyIndirectUsage<T, U> {
1010
pub doubly_indirect: DoublyIndirectUsage_IndirectUsage<T, U>,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
12-
_phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
12+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
1313
}
1414
pub type DoublyIndirectUsage_Aliased<T> = T;
1515
pub type DoublyIndirectUsage_Typedefed<U> = U;
@@ -18,8 +18,8 @@ pub type DoublyIndirectUsage_Typedefed<U> = U;
1818
pub struct DoublyIndirectUsage_IndirectUsage<T, U> {
1919
pub member: DoublyIndirectUsage_Aliased<T>,
2020
pub another: DoublyIndirectUsage_Typedefed<U>,
21-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
22-
_phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
21+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
22+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
2323
}
2424
impl <T, U> Default for DoublyIndirectUsage_IndirectUsage<T, U> {
2525
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-12.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct BaseUsesT<T> {
1010
pub t: *mut T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for BaseUsesT<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -18,7 +18,7 @@ impl <T> Default for BaseUsesT<T> {
1818
pub struct CrtpUsesU<U> {
1919
pub _base: BaseUsesT<CrtpUsesU<U>>,
2020
pub usage: U,
21-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
21+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
2222
}
2323
impl <U> Default for CrtpUsesU<U> {
2424
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-13.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct BaseIgnoresT {
1414
pub struct CrtpUsesU<U> {
1515
pub _base: BaseIgnoresT,
1616
pub usage: U,
17-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
17+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
1818
}
1919
impl <U> Default for CrtpUsesU<U> {
2020
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-15.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct BaseUsesT<T> {
1010
pub usage: *mut T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
impl <T> Default for BaseUsesT<T> {
1414
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct UsesTemplateParameter<T> {
1010
pub t: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
#[repr(C)]
1414
#[derive(Debug, Copy, Clone)]
1515
pub struct UsesTemplateParameter_AlsoUsesTemplateParameter<T> {
1616
pub also: T,
17-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
17+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1818
}
1919
impl <T> Default for UsesTemplateParameter_AlsoUsesTemplateParameter<T> {
2020
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

tests/expectations/tests/template-param-usage-3.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct UsesTemplateParameter<T> {
1010
pub t: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
#[repr(C)]
1414
#[derive(Debug, Copy, Clone)]
1515
pub struct UsesTemplateParameter_AlsoUsesTemplateParameterAndMore<T, U> {
1616
pub also: T,
1717
pub more: U,
18-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
19-
_phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
18+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
19+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<U>>,
2020
}
2121
impl <T, U> Default for
2222
UsesTemplateParameter_AlsoUsesTemplateParameterAndMore<T, U> {

tests/expectations/tests/template-param-usage-4.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct UsesTemplateParameter<T> {
1010
pub t: T,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
#[repr(C)]
1414
#[derive(Debug, Default, Copy, Clone)]

tests/expectations/tests/template-param-usage-5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[derive(Debug, Copy, Clone)]
99
pub struct IndirectlyUsesTemplateParameter<T> {
1010
pub aliased: IndirectlyUsesTemplateParameter_Aliased<T>,
11-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
11+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
1212
}
1313
pub type IndirectlyUsesTemplateParameter_Aliased<T> = T;
1414
impl <T> Default for IndirectlyUsesTemplateParameter<T> {

tests/expectations/tests/template-param-usage-7.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
pub struct DoesNotUseU<T, V> {
1010
pub t: T,
1111
pub v: V,
12-
_phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
13-
_phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
12+
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
13+
pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell<V>>,
1414
}
1515
impl <T, V> Default for DoesNotUseU<T, V> {
1616
fn default() -> Self { unsafe { ::std::mem::zeroed() } }

0 commit comments

Comments
 (0)