From 2d4e71e49d1055df8990f8ae2b4f803e8e863b70 Mon Sep 17 00:00:00 2001 From: Weston Carvalho Date: Tue, 12 Jan 2021 12:57:10 -0800 Subject: [PATCH] Add opt-in flag for respecting C++ access specifiers --- src/codegen/mod.rs | 22 +++++-- src/lib.rs | 15 +++++ src/options.rs | 8 +++ tests/expectations/tests/class_nested.rs | 10 ++-- tests/expectations/tests/class_with_dtor.rs | 4 +- .../tests/class_with_inner_struct.rs | 12 ++-- .../tests/class_with_inner_struct_1_0.rs | 12 ++-- tests/expectations/tests/comment-indent.rs | 2 +- tests/expectations/tests/const_tparam.rs | 4 +- .../constify-module-enums-simple-alias.rs | 16 ++--- ...onstify-module-enums-simple-nonamespace.rs | 4 +- .../tests/constify-module-enums-types.rs | 6 +- .../tests/derive-debug-bitfield-core.rs | 14 ++--- .../tests/derive-debug-bitfield.rs | 14 ++--- .../tests/derive-debug-function-pointer.rs | 4 +- .../tests/derive-debug-generic.rs | 2 +- ...ive-debug-opaque-template-instantiation.rs | 2 +- .../expectations/tests/derive-debug-opaque.rs | 2 +- .../tests/derive-partialeq-base.rs | 4 +- .../tests/derive-partialeq-bitfield.rs | 14 ++--- .../tests/derive-partialeq-pointer.rs | 2 +- .../expectations/tests/do-not-derive-copy.rs | 2 +- tests/expectations/tests/doggo-or-null.rs | 2 +- .../duplicated-namespaces-definitions.rs | 4 +- .../tests/dynamic_loading_with_blacklist.rs | 2 +- .../tests/dynamic_loading_with_class.rs | 2 +- .../tests/enum_and_vtable_mangling.rs | 2 +- .../forward-inherit-struct-with-fields.rs | 6 +- .../expectations/tests/gen-destructors-neg.rs | 2 +- tests/expectations/tests/gen-destructors.rs | 2 +- ...from-template-instantiation-with-vtable.rs | 4 +- tests/expectations/tests/inline_namespace.rs | 2 +- .../tests/inline_namespace_conservative.rs | 2 +- .../tests/inline_namespace_no_ns_enabled.rs | 6 +- tests/expectations/tests/inner_const.rs | 2 +- .../expectations/tests/inner_template_self.rs | 6 +- .../tests/issue-1113-template-references.rs | 6 +- .../tests/issue-1118-using-forward-decl.rs | 6 +- tests/expectations/tests/issue-358.rs | 4 +- tests/expectations/tests/issue-372.rs | 10 ++-- tests/expectations/tests/issue-446.rs | 4 +- ...ate-params-causing-layout-test-failures.rs | 4 +- .../tests/issue-573-layout-test-failures.rs | 4 +- .../issue-574-assertion-failure-in-codegen.rs | 2 +- ...issue-584-stylo-template-analysis-panic.rs | 6 +- ...e-638-stylo-cannot-find-T-in-this-scope.rs | 4 +- ...ue-645-cannot-find-type-T-in-this-scope.rs | 2 +- .../issue-662-cannot-find-T-in-this-scope.rs | 6 +- tests/expectations/tests/issue-662-part-2.rs | 4 +- tests/expectations/tests/issue-674-2.rs | 4 +- tests/expectations/tests/issue-674-3.rs | 2 +- .../issue-691-template-parameter-virtual.rs | 2 +- .../tests/issue-801-opaque-sloppiness.rs | 2 +- ...07-opaque-types-methods-being-generated.rs | 2 +- .../issue-848-replacement-system-include.rs | 2 +- tests/expectations/tests/libclang-9/class.rs | 46 +++++++------- .../tests/libclang-9/class_1_0.rs | 46 +++++++------- .../issue-769-bad-instantiation-test.rs | 2 +- .../partial-specialization-and-inheritance.rs | 2 +- .../type_alias_template_specialized.rs | 2 +- .../tests/libclang-9/zero-sized-array.rs | 10 ++-- tests/expectations/tests/msvc-no-usr.rs | 2 +- tests/expectations/tests/mutable.rs | 8 +-- tests/expectations/tests/namespace.rs | 8 +-- tests/expectations/tests/nested.rs | 2 +- .../tests/nested_within_namespace.rs | 6 +- .../expectations/tests/no-hash-whitelisted.rs | 2 +- .../tests/no-partialeq-whitelisted.rs | 2 +- tests/expectations/tests/no_copy.rs | 2 +- .../expectations/tests/no_copy_whitelisted.rs | 2 +- tests/expectations/tests/no_debug.rs | 2 +- .../tests/no_debug_bypass_impl_debug.rs | 4 +- .../tests/no_debug_whitelisted.rs | 2 +- tests/expectations/tests/no_default.rs | 4 +- .../tests/no_default_bypass_derive_default.rs | 4 +- .../tests/no_default_whitelisted.rs | 2 +- tests/expectations/tests/nsBaseHashtable.rs | 8 +-- tests/expectations/tests/nsStyleAutoArray.rs | 6 +- tests/expectations/tests/only_bitfields.rs | 15 +++-- .../tests/opaque-template-inst-member-2.rs | 6 +- .../tests/opaque-template-inst-member.rs | 6 +- ...paque-template-instantiation-namespaced.rs | 6 +- .../tests/opaque-template-instantiation.rs | 6 +- tests/expectations/tests/private_fields.rs | 47 +++++++++++++++ .../tests/replace_template_alias.rs | 2 +- tests/expectations/tests/replaces_double.rs | 2 +- .../tests/sentry-defined-multiple-times.rs | 18 +++--- tests/expectations/tests/size_t_template.rs | 2 +- .../tests/template-param-usage-0.rs | 2 +- .../tests/template-param-usage-1.rs | 2 +- .../tests/template-param-usage-10.rs | 6 +- .../tests/template-param-usage-12.rs | 4 +- .../tests/template-param-usage-13.rs | 4 +- .../tests/template-param-usage-14.rs | 4 +- .../tests/template-param-usage-15.rs | 4 +- .../tests/template-param-usage-2.rs | 4 +- .../tests/template-param-usage-3.rs | 6 +- .../tests/template-param-usage-4.rs | 4 +- .../tests/template-param-usage-5.rs | 2 +- .../tests/template-param-usage-6.rs | 2 +- .../tests/template-param-usage-7.rs | 4 +- .../tests/template-param-usage-8.rs | 4 +- .../tests/template-param-usage-9.rs | 4 +- tests/expectations/tests/template.rs | 50 ++++++++-------- ..._alias_partial_template_especialization.rs | 2 +- tests/expectations/tests/typeref.rs | 2 +- tests/expectations/tests/typeref_1_0.rs | 2 +- tests/expectations/tests/using.rs | 4 +- .../expectations/tests/virtual_inheritance.rs | 8 +-- tests/expectations/tests/weird_bitfields.rs | 60 +++++++++---------- tests/expectations/tests/whitelist_basic.rs | 6 +- .../whitelisted-item-references-no-hash.rs | 2 +- ...hitelisted-item-references-no-partialeq.rs | 2 +- .../whitelisted_item_references_no_copy.rs | 2 +- tests/headers/private_fields.hpp | 5 ++ 115 files changed, 434 insertions(+), 346 deletions(-) diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index e4566807b..a03f52104 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1271,10 +1271,18 @@ impl<'a> FieldCodegen<'a> for FieldData { } } - let is_private = !self.is_public() || + + let is_private = (!self.is_public() && ctx.options().respect_cxx_access_specs) || self.annotations() .private_fields() .unwrap_or(fields_should_be_private); + println!("is_pub({}), respect_cxx_access_specs({}), annotations({}) => {}", + self.is_public(), + ctx.options().respect_cxx_access_specs, + self.annotations() + .private_fields() + .unwrap_or(fields_should_be_private), + is_private); let accessor_kind = self.annotations().accessor_kind().unwrap_or(accessor_kind); @@ -1395,8 +1403,10 @@ impl Bitfield { } } -fn access_specifier(is_pub: bool) -> proc_macro2::TokenStream { - if is_pub { +fn access_specifier(ctx: &BindgenContext, is_pub: bool) -> proc_macro2::TokenStream { + println!("is_pub({}), respect_cxx_access_specs({}) => {}", is_pub, + ctx.options().respect_cxx_access_specs, is_pub || !ctx.options().respect_cxx_access_specs); + if is_pub || !ctx.options().respect_cxx_access_specs { quote! { pub } } else { quote! {} @@ -1516,7 +1526,7 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit { ctor_impl = bf.extend_ctor_impl(ctx, param_name, ctor_impl); } - let access_spec = access_specifier(access_spec); + let access_spec = access_specifier(ctx, access_spec); let field = quote! { #access_spec #unit_field_ident : #field_ty , @@ -1604,7 +1614,7 @@ impl<'a> FieldCodegen<'a> for Bitfield { let offset = self.offset_into_unit(); let width = self.width() as u8; let access_spec = - access_specifier(self.is_public() && !fields_should_be_private); + access_specifier(ctx, self.is_public() && !fields_should_be_private); if parent.is_union() && !parent.can_be_rust_union(ctx) { methods.extend(Some(quote! { @@ -1730,7 +1740,7 @@ impl CodeGenerator for CompInfo { struct_layout.saw_base(inner_item.expect_type()); - let access_spec = access_specifier(base.is_public()); + let access_spec = access_specifier(ctx, base.is_public()); fields.push(quote! { #access_spec #field_name: #inner, }); diff --git a/src/lib.rs b/src/lib.rs index 2329dee98..3ca50ef18 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -545,6 +545,10 @@ impl Builder { output_vector.push(name.clone()); } + if self.options.respect_cxx_access_specs { + output_vector.push("--respect-cxx-access-specs".into()); + } + // Add clang arguments output_vector.push("--".into()); @@ -1518,6 +1522,12 @@ impl Builder { self.options.dynamic_library_name = Some(dynamic_library_name.into()); self } + + /// Generate bindings as `pub` only if the bound item is publically accessible by C++. + pub fn respect_cxx_access_specs(mut self, doit: bool) -> Self { + self.options.respect_cxx_access_specs = doit; + self + } } /// Configuration options for generated bindings. @@ -1805,6 +1815,10 @@ struct BindgenOptions { /// The name of the dynamic library (if we are generating bindings for a shared library). If /// this is None, no dynamic bindings are created. dynamic_library_name: Option, + + /// Only make generated bindings `pub` if the items would be publically accessible + /// by C++. + respect_cxx_access_specs: bool } /// TODO(emilio): This is sort of a lie (see the error message that results from @@ -1941,6 +1955,7 @@ impl Default for BindgenOptions { array_pointers_in_arguments: false, wasm_import_module_name: None, dynamic_library_name: None, + respect_cxx_access_specs: false, } } } diff --git a/src/options.rs b/src/options.rs index 7d3e077ee..6dc5ff63e 100644 --- a/src/options.rs +++ b/src/options.rs @@ -493,6 +493,9 @@ where .long("dynamic-loading") .takes_value(true) .help("Use dynamic loading mode with the given library name."), + Arg::with_name("respect-cxx-access-specs") + .long("respect-cxx-access-specs") + .help("Makes generated bindings `pub` only for items if the items are publically accessible in C++."), ]) // .args() .get_matches_from(args); @@ -915,6 +918,11 @@ where builder = builder.dynamic_library_name(dynamic_library_name); } + if matches.is_present("respect-cxx-access-specs") { + println!("Respecting private items."); + builder = builder.respect_cxx_access_specs(true); + } + let verbose = matches.is_present("verbose"); Ok((builder, output, verbose)) diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs index 911feffe4..5f7a1dfc6 100644 --- a/tests/expectations/tests/class_nested.rs +++ b/tests/expectations/tests/class_nested.rs @@ -13,7 +13,7 @@ pub struct A { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct A_B { - member_b: ::std::os::raw::c_int, + pub member_b: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_A_B() { @@ -43,7 +43,7 @@ fn bindgen_test_layout_A_B() { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct A_D { - foo: T, + pub foo: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for A_D { @@ -77,7 +77,7 @@ fn bindgen_test_layout_A() { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct A_C { - baz: ::std::os::raw::c_int, + pub baz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_A_C() { @@ -125,7 +125,7 @@ extern "C" { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct D { - member: A_B, + pub member: A_B, } #[test] fn bindgen_test_layout_D() { @@ -148,7 +148,7 @@ fn bindgen_test_layout_D() { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Templated { - member: T, + pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs index 2bb36e7b6..7cefe99df 100644 --- a/tests/expectations/tests/class_with_dtor.rs +++ b/tests/expectations/tests/class_with_dtor.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct HandleWithDtor { - ptr: *mut T, + pub ptr: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for HandleWithDtor { @@ -20,7 +20,7 @@ pub type HandleValue = HandleWithDtor<::std::os::raw::c_int>; #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct WithoutDtor { - shouldBeWithDtor: HandleValue, + pub shouldBeWithDtor: HandleValue, } #[test] fn bindgen_test_layout_WithoutDtor() { diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs index 01c4507c3..8d21b674e 100644 --- a/tests/expectations/tests/class_with_inner_struct.rs +++ b/tests/expectations/tests/class_with_inner_struct.rs @@ -8,9 +8,9 @@ #[repr(C)] #[derive(Copy, Clone)] pub struct A { - c: ::std::os::raw::c_uint, - named_union: A__bindgen_ty_1, - __bindgen_anon_1: A__bindgen_ty_2, + pub c: ::std::os::raw::c_uint, + pub named_union: A__bindgen_ty_1, + pub __bindgen_anon_1: A__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -165,7 +165,7 @@ impl Default for A { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct B { - d: ::std::os::raw::c_uint, + pub d: ::std::os::raw::c_uint, } #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] @@ -239,8 +239,8 @@ pub enum StepSyntax { #[repr(C)] #[derive(Copy, Clone)] pub struct C { - d: ::std::os::raw::c_uint, - __bindgen_anon_1: C__bindgen_ty_1, + pub d: ::std::os::raw::c_uint, + pub __bindgen_anon_1: C__bindgen_ty_1, } #[repr(C)] #[derive(Copy, Clone)] diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs index e1425776e..4bb71602b 100644 --- a/tests/expectations/tests/class_with_inner_struct_1_0.rs +++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs @@ -51,9 +51,9 @@ impl ::std::cmp::Eq for __BindgenUnionField {} #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct A { - c: ::std::os::raw::c_uint, - named_union: A__bindgen_ty_1, - __bindgen_anon_1: A__bindgen_ty_2, + pub c: ::std::os::raw::c_uint, + pub named_union: A__bindgen_ty_1, + pub __bindgen_anon_1: A__bindgen_ty_2, } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] @@ -213,7 +213,7 @@ impl Clone for A { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] pub struct B { - d: ::std::os::raw::c_uint, + pub d: ::std::os::raw::c_uint, } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq, Eq)] @@ -297,8 +297,8 @@ pub enum StepSyntax { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct C { - d: ::std::os::raw::c_uint, - __bindgen_anon_1: C__bindgen_ty_1, + pub d: ::std::os::raw::c_uint, + pub __bindgen_anon_1: C__bindgen_ty_1, } #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq)] diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs index 6f293ed37..c381b7342 100644 --- a/tests/expectations/tests/comment-indent.rs +++ b/tests/expectations/tests/comment-indent.rs @@ -66,7 +66,7 @@ pub mod root { /// +------+ +-------+ /// | foo | ----> | bar | /// +------+ +-------+ - member: ::std::os::raw::c_int, + pub member: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Baz() { diff --git a/tests/expectations/tests/const_tparam.rs b/tests/expectations/tests/const_tparam.rs index bce86ad1c..f56561f0d 100644 --- a/tests/expectations/tests/const_tparam.rs +++ b/tests/expectations/tests/const_tparam.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct C { - foo: *const T, - bar: *const T, + pub foo: *const T, + pub bar: *const T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for C { diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs index 23dd7b090..64e77c68b 100644 --- a/tests/expectations/tests/constify-module-enums-simple-alias.rs +++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs @@ -17,14 +17,14 @@ pub use self::Foo_alias2 as Foo_alias3; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Bar { - baz1: Foo::Type, - baz2: Foo_alias1, - baz3: Foo_alias2, - baz4: Foo_alias3, - baz_ptr1: *mut Foo::Type, - baz_ptr2: *mut Foo_alias1, - baz_ptr3: *mut Foo_alias2, - baz_ptr4: *mut Foo_alias3, + pub baz1: Foo::Type, + pub baz2: Foo_alias1, + pub baz3: Foo_alias2, + pub baz4: Foo_alias3, + pub baz_ptr1: *mut Foo::Type, + pub baz_ptr2: *mut Foo_alias1, + pub baz_ptr3: *mut Foo_alias2, + pub baz_ptr4: *mut Foo_alias3, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs index 466e6886a..3a95b3c91 100644 --- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs +++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs @@ -13,8 +13,8 @@ pub mod one_Foo { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Bar { - baz1: one_Foo::Type, - baz2: *mut one_Foo::Type, + pub baz1: one_Foo::Type, + pub baz2: *mut one_Foo::Type, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs index c6f3cb741..4ba85b37d 100644 --- a/tests/expectations/tests/constify-module-enums-types.rs +++ b/tests/expectations/tests/constify-module-enums-types.rs @@ -174,7 +174,7 @@ impl Default for bar { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Baz { - member1: ns2_Foo::Type, + pub member1: ns2_Foo::Type, } #[test] fn bindgen_test_layout_Baz() { @@ -212,7 +212,7 @@ pub mod one_Foo { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Bar { - baz: *mut one_Foo::Type, + pub baz: *mut one_Foo::Type, } #[test] fn bindgen_test_layout_Bar() { @@ -256,7 +256,7 @@ extern "C" { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Thing { - thing: T, + pub thing: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Thing { diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs index 3d69ac0e4..76fa20bab 100644 --- a/tests/expectations/tests/derive-debug-bitfield-core.rs +++ b/tests/expectations/tests/derive-debug-bitfield-core.rs @@ -97,8 +97,8 @@ where #[derive(Copy, Clone)] pub struct C { pub _bitfield_align_1: [u8; 0], - _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, - large_array: [::std::os::raw::c_int; 50usize], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub large_array: [::std::os::raw::c_int; 50usize], } #[test] fn bindgen_test_layout_C() { @@ -142,33 +142,33 @@ impl ::core::fmt::Debug for C { } impl C { #[inline] - fn a(&self) -> bool { + pub fn a(&self) -> bool { unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } } #[inline] - fn set_a(&mut self, val: bool) { + pub fn set_a(&mut self, val: bool) { unsafe { let val: u8 = ::core::mem::transmute(val); self._bitfield_1.set(0usize, 1u8, val as u64) } } #[inline] - fn b(&self) -> bool { + pub fn b(&self) -> bool { unsafe { ::core::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } } #[inline] - fn set_b(&mut self, val: bool) { + pub fn set_b(&mut self, val: bool) { unsafe { let val: u8 = ::core::mem::transmute(val); self._bitfield_1.set(1usize, 7u8, val as u64) } } #[inline] - fn new_bitfield_1( + pub fn new_bitfield_1( a: bool, b: bool, ) -> __BindgenBitfieldUnit<[u8; 1usize]> { diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs index dd77431bf..d07642a83 100644 --- a/tests/expectations/tests/derive-debug-bitfield.rs +++ b/tests/expectations/tests/derive-debug-bitfield.rs @@ -95,8 +95,8 @@ where #[derive(Copy, Clone)] pub struct C { pub _bitfield_align_1: [u8; 0], - _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, - large_array: [::std::os::raw::c_int; 50usize], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub large_array: [::std::os::raw::c_int; 50usize], } #[test] fn bindgen_test_layout_C() { @@ -149,33 +149,33 @@ impl ::std::fmt::Debug for C { } impl C { #[inline] - fn a(&self) -> bool { + pub fn a(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } } #[inline] - fn set_a(&mut self, val: bool) { + pub fn set_a(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(0usize, 1u8, val as u64) } } #[inline] - fn b(&self) -> bool { + pub fn b(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } } #[inline] - fn set_b(&mut self, val: bool) { + pub fn set_b(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(1usize, 7u8, val as u64) } } #[inline] - fn new_bitfield_1( + pub fn new_bitfield_1( a: bool, b: bool, ) -> __BindgenBitfieldUnit<[u8; 1usize]> { diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs index 4a4ba4282..7052ff001 100644 --- a/tests/expectations/tests/derive-debug-function-pointer.rs +++ b/tests/expectations/tests/derive-debug-function-pointer.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Copy, Clone)] pub struct Nice { - pointer: Nice_Function, - large_array: [::std::os::raw::c_int; 34usize], + pub pointer: Nice_Function, + pub large_array: [::std::os::raw::c_int; 34usize], } pub type Nice_Function = ::std::option::Option; diff --git a/tests/expectations/tests/derive-debug-generic.rs b/tests/expectations/tests/derive-debug-generic.rs index f14cf3a9d..88fd97283 100644 --- a/tests/expectations/tests/derive-debug-generic.rs +++ b/tests/expectations/tests/derive-debug-generic.rs @@ -7,7 +7,7 @@ #[repr(C)] pub struct Generic { - t: [T; 40usize], + pub t: [T; 40usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Generic { diff --git a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs index ff499b822..4e87368b3 100644 --- a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs +++ b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs @@ -7,7 +7,7 @@ #[repr(C)] pub struct Instance { - val: [u32; 50usize], + pub val: [u32; 50usize], } #[test] fn bindgen_test_layout_Instance() { diff --git a/tests/expectations/tests/derive-debug-opaque.rs b/tests/expectations/tests/derive-debug-opaque.rs index 6de062818..dfb264c7a 100644 --- a/tests/expectations/tests/derive-debug-opaque.rs +++ b/tests/expectations/tests/derive-debug-opaque.rs @@ -35,7 +35,7 @@ impl ::std::fmt::Debug for Opaque { } #[repr(C)] pub struct OpaqueUser { - opaque: Opaque, + pub opaque: Opaque, } #[test] fn bindgen_test_layout_OpaqueUser() { diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs index 57ac07d88..9946616b3 100644 --- a/tests/expectations/tests/derive-partialeq-base.rs +++ b/tests/expectations/tests/derive-partialeq-base.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Copy, Clone)] pub struct Base { - large: [::std::os::raw::c_int; 33usize], + pub large: [::std::os::raw::c_int; 33usize], } #[test] fn bindgen_test_layout_Base() { @@ -46,7 +46,7 @@ impl ::std::cmp::PartialEq for Base { #[repr(C)] #[derive(Copy, Clone)] pub struct ShouldDerivePartialEq { - _base: Base, + pub _base: Base, } #[test] fn bindgen_test_layout_ShouldDerivePartialEq() { diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs index 8aeb1aa9a..c7f1231ef 100644 --- a/tests/expectations/tests/derive-partialeq-bitfield.rs +++ b/tests/expectations/tests/derive-partialeq-bitfield.rs @@ -95,8 +95,8 @@ where #[derive(Copy, Clone)] pub struct C { pub _bitfield_align_1: [u8; 0], - _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, - large_array: [::std::os::raw::c_int; 50usize], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub large_array: [::std::os::raw::c_int; 50usize], } #[test] fn bindgen_test_layout_C() { @@ -137,33 +137,33 @@ impl ::std::cmp::PartialEq for C { } impl C { #[inline] - fn a(&self) -> bool { + pub fn a(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } } #[inline] - fn set_a(&mut self, val: bool) { + pub fn set_a(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(0usize, 1u8, val as u64) } } #[inline] - fn b(&self) -> bool { + pub fn b(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } } #[inline] - fn set_b(&mut self, val: bool) { + pub fn set_b(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(1usize, 7u8, val as u64) } } #[inline] - fn new_bitfield_1( + pub fn new_bitfield_1( a: bool, b: bool, ) -> __BindgenBitfieldUnit<[u8; 1usize]> { diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs index 16344b8aa..55bd782fa 100644 --- a/tests/expectations/tests/derive-partialeq-pointer.rs +++ b/tests/expectations/tests/derive-partialeq-pointer.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Bar { - b: *mut a, + pub b: *mut a, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs index 817895a7e..4112d88a5 100644 --- a/tests/expectations/tests/do-not-derive-copy.rs +++ b/tests/expectations/tests/do-not-derive-copy.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default)] pub struct WouldBeCopyButWeAreNotDerivingCopy { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_WouldBeCopyButWeAreNotDerivingCopy() { diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs index 9f57d58d0..1d3bf5c16 100644 --- a/tests/expectations/tests/doggo-or-null.rs +++ b/tests/expectations/tests/doggo-or-null.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq)] pub struct Doggo { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Doggo() { diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs index 466702dab..b79ccaea3 100644 --- a/tests/expectations/tests/duplicated-namespaces-definitions.rs +++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs @@ -15,8 +15,8 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar { - foo: ::std::os::raw::c_int, - baz: bool, + pub foo: ::std::os::raw::c_int, + pub baz: bool, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/dynamic_loading_with_blacklist.rs b/tests/expectations/tests/dynamic_loading_with_blacklist.rs index 2aeb79dd0..15092f06d 100644 --- a/tests/expectations/tests/dynamic_loading_with_blacklist.rs +++ b/tests/expectations/tests/dynamic_loading_with_blacklist.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct X { - _x: ::std::os::raw::c_int, + pub _x: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_X() { diff --git a/tests/expectations/tests/dynamic_loading_with_class.rs b/tests/expectations/tests/dynamic_loading_with_class.rs index fb1cbe300..a402e2887 100644 --- a/tests/expectations/tests/dynamic_loading_with_class.rs +++ b/tests/expectations/tests/dynamic_loading_with_class.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct A { - _x: ::std::os::raw::c_int, + pub _x: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_A() { diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs index 4f849ba81..5eaaec95e 100644 --- a/tests/expectations/tests/enum_and_vtable_mangling.rs +++ b/tests/expectations/tests/enum_and_vtable_mangling.rs @@ -19,7 +19,7 @@ pub struct C__bindgen_vtable(::std::os::raw::c_void); #[derive(Debug, Copy, Clone)] pub struct C { pub vtable_: *const C__bindgen_vtable, - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_C() { diff --git a/tests/expectations/tests/forward-inherit-struct-with-fields.rs b/tests/expectations/tests/forward-inherit-struct-with-fields.rs index 3f6ac24f3..cae75bf4d 100644 --- a/tests/expectations/tests/forward-inherit-struct-with-fields.rs +++ b/tests/expectations/tests/forward-inherit-struct-with-fields.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct js_RootedBase { - foo: *mut T, - next: *mut Rooted, + pub foo: *mut T, + pub next: *mut Rooted, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for js_RootedBase { @@ -20,7 +20,7 @@ impl Default for js_RootedBase { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { - _base: js_RootedBase, + pub _base: js_RootedBase, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs index 4554d9cdf..67b6d7014 100644 --- a/tests/expectations/tests/gen-destructors-neg.rs +++ b/tests/expectations/tests/gen-destructors-neg.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default)] pub struct Foo { - bar: ::std::os::raw::c_int, + pub bar: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Foo() { diff --git a/tests/expectations/tests/gen-destructors.rs b/tests/expectations/tests/gen-destructors.rs index 0f6207beb..7d96870df 100644 --- a/tests/expectations/tests/gen-destructors.rs +++ b/tests/expectations/tests/gen-destructors.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default)] pub struct Foo { - bar: ::std::os::raw::c_int, + pub bar: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Foo() { diff --git a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs index b107d25ed..c488713fc 100644 --- a/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs +++ b/tests/expectations/tests/inherit-from-template-instantiation-with-vtable.rs @@ -12,7 +12,7 @@ pub struct BaseWithVtable__bindgen_vtable(::std::os::raw::c_void); #[derive(Debug, Copy, Clone)] pub struct BaseWithVtable { pub vtable_: *const BaseWithVtable__bindgen_vtable, - t: T, + pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseWithVtable { @@ -72,7 +72,7 @@ impl Default for DerivedWithVirtualMethods { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct BaseWithoutVtable { - u: U, + pub u: U, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseWithoutVtable { diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs index 7211984a5..036d2da61 100644 --- a/tests/expectations/tests/inline_namespace.rs +++ b/tests/expectations/tests/inline_namespace.rs @@ -17,7 +17,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar { - baz: root::foo::Ty, + pub baz: root::foo::Ty, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs index e75c0eb00..3d2ce0c41 100644 --- a/tests/expectations/tests/inline_namespace_conservative.rs +++ b/tests/expectations/tests/inline_namespace_conservative.rs @@ -22,7 +22,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar { - baz: root::foo::bar::Ty, + pub baz: root::foo::bar::Ty, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/inline_namespace_no_ns_enabled.rs b/tests/expectations/tests/inline_namespace_no_ns_enabled.rs index bd610ad86..20bac9a13 100644 --- a/tests/expectations/tests/inline_namespace_no_ns_enabled.rs +++ b/tests/expectations/tests/inline_namespace_no_ns_enabled.rs @@ -8,9 +8,9 @@ #[repr(C)] #[derive(Debug)] pub struct std_basic_string { - hider: std_basic_string_Alloc_hider, - length: ::std::os::raw::c_ulong, - __bindgen_anon_1: std_basic_string__bindgen_ty_1, + pub hider: std_basic_string_Alloc_hider, + pub length: ::std::os::raw::c_ulong, + pub __bindgen_anon_1: std_basic_string__bindgen_ty_1, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs index a7bfa82ee..912ae0242 100644 --- a/tests/expectations/tests/inner_const.rs +++ b/tests/expectations/tests/inner_const.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Foo { - bar: ::std::os::raw::c_int, + pub bar: ::std::os::raw::c_int, } extern "C" { #[link_name = "\u{1}_ZN3Foo3BOOE"] diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs index 864199e7f..f3e153f49 100644 --- a/tests/expectations/tests/inner_template_self.rs +++ b/tests/expectations/tests/inner_template_self.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct LinkedList { - next: *mut LinkedList, - prev: *mut LinkedList, + pub next: *mut LinkedList, + pub prev: *mut LinkedList, } impl Default for LinkedList { fn default() -> Self { @@ -19,7 +19,7 @@ impl Default for LinkedList { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct InstantiateIt { - m_list: LinkedList, + pub m_list: LinkedList, } #[test] fn bindgen_test_layout_InstantiateIt() { diff --git a/tests/expectations/tests/issue-1113-template-references.rs b/tests/expectations/tests/issue-1113-template-references.rs index 5bc7e1308..79a06dac9 100644 --- a/tests/expectations/tests/issue-1113-template-references.rs +++ b/tests/expectations/tests/issue-1113-template-references.rs @@ -9,7 +9,7 @@ #[derive(Debug, Copy, Clone)] pub struct Entry { pub _base: K, - mData: V, + pub mData: V, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } @@ -27,8 +27,8 @@ pub type nsBaseHashtable_EntryType = Entry; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsBaseHashtable_EntryPtr { - mEntry: *mut nsBaseHashtable_EntryType, - mExistingEntry: bool, + pub mEntry: *mut nsBaseHashtable_EntryType, + pub mExistingEntry: bool, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/issue-1118-using-forward-decl.rs b/tests/expectations/tests/issue-1118-using-forward-decl.rs index e50afe474..df764a583 100644 --- a/tests/expectations/tests/issue-1118-using-forward-decl.rs +++ b/tests/expectations/tests/issue-1118-using-forward-decl.rs @@ -9,7 +9,7 @@ pub type c = nsTArray; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsTArray_base { - d: *mut ::std::os::raw::c_int, + pub d: *mut ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_nsTArray_base() { @@ -44,7 +44,7 @@ impl Default for nsTArray_base { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsTArray { - _base: nsTArray_base, + pub _base: nsTArray_base, } impl Default for nsTArray { fn default() -> Self { @@ -54,7 +54,7 @@ impl Default for nsTArray { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsIContent { - foo: nsTArray, + pub foo: nsTArray, } #[test] fn bindgen_test_layout_nsIContent() { diff --git a/tests/expectations/tests/issue-358.rs b/tests/expectations/tests/issue-358.rs index 5f2b393ce..320c7e1d8 100644 --- a/tests/expectations/tests/issue-358.rs +++ b/tests/expectations/tests/issue-358.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JS_PersistentRooted { - _base: a, + pub _base: a, } impl Default for JS_PersistentRooted { fn default() -> Self { @@ -18,7 +18,7 @@ impl Default for JS_PersistentRooted { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct a { - b: *mut a, + pub b: *mut a, } impl Default for a { fn default() -> Self { diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs index e7362ced0..ce6e36c5b 100644 --- a/tests/expectations/tests/issue-372.rs +++ b/tests/expectations/tests/issue-372.rs @@ -12,9 +12,9 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct i { - j: *mut root::i, - k: *mut root::i, - l: bool, + pub j: *mut root::i, + pub k: *mut root::i, + pub l: bool, } #[test] fn bindgen_test_layout_i() { @@ -52,7 +52,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct d { - m: root::i, + pub m: root::i, } #[test] fn bindgen_test_layout_d() { @@ -95,7 +95,7 @@ pub mod root { } #[repr(C)] pub struct F { - w: [u64; 33usize], + pub w: [u64; 33usize], } #[test] fn bindgen_test_layout_F() { diff --git a/tests/expectations/tests/issue-446.rs b/tests/expectations/tests/issue-446.rs index 4bdfd5673..6c9cae462 100644 --- a/tests/expectations/tests/issue-446.rs +++ b/tests/expectations/tests/issue-446.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct List { - next: *mut List, + pub next: *mut List, } impl Default for List { fn default() -> Self { @@ -18,7 +18,7 @@ impl Default for List { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct PersistentRooted { - root_list: List, + pub root_list: List, } impl Default for PersistentRooted { fn default() -> Self { diff --git a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs index 84134c32c..4b2fa7a2a 100644 --- a/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs +++ b/tests/expectations/tests/issue-569-non-type-template-params-causing-layout-test-failures.rs @@ -17,7 +17,7 @@ pub type JS_Alias = u8; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JS_Base { - f: JS_Alias, + pub f: JS_Alias, } impl Default for JS_Base { fn default() -> Self { @@ -27,7 +27,7 @@ impl Default for JS_Base { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JS_AutoIdVector { - _base: JS_Base, + pub _base: JS_Base, } #[test] fn bindgen_test_layout_JS_AutoIdVector() { diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs index 7fd795581..871849aa4 100644 --- a/tests/expectations/tests/issue-573-layout-test-failures.rs +++ b/tests/expectations/tests/issue-573-layout-test-failures.rs @@ -8,12 +8,12 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Outer { - i: u8, + pub i: u8, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct AutoIdVector { - ar: Outer, + pub ar: Outer, } #[test] fn bindgen_test_layout_AutoIdVector() { diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs index 6b4ec65ac..e04ff24cb 100644 --- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs +++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs @@ -13,7 +13,7 @@ pub struct a { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct _bindgen_ty_1 { - ar: a, + pub ar: a, } #[test] fn bindgen_test_layout__bindgen_ty_1() { 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 464a2baf0..61489990a 100644 --- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs +++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs @@ -28,7 +28,7 @@ fn bindgen_test_layout_A() { } #[repr(C)] pub struct e { - d: RefPtr, + pub d: RefPtr, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for e { @@ -43,7 +43,7 @@ pub struct f { } #[repr(C)] pub struct g { - h: f, + pub h: f, } #[test] fn bindgen_test_layout_g() { @@ -70,7 +70,7 @@ impl Default for g { } #[repr(C)] pub struct b { - _base: g, + pub _base: g, } #[test] fn bindgen_test_layout_b() { 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 86fbd5f97..8c3ad474f 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 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct RefPtr { - use_of_t: T, + pub use_of_t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for RefPtr { @@ -19,7 +19,7 @@ impl Default for RefPtr { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesRefPtrWithAliasedTypeParam { - member: RefPtr>, + pub member: RefPtr>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type UsesRefPtrWithAliasedTypeParam_V = U; 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 1dc32ffaf..176fae643 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 @@ -10,7 +10,7 @@ pub struct RefPtr(T); #[repr(C)] pub struct HasRefPtr { - refptr_member: RefPtr>, + pub refptr_member: RefPtr>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type HasRefPtr_TypedefOfT = T; 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 149897745..d12c87152 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 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct RefPtr { - a: T, + pub a: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for RefPtr { @@ -19,7 +19,7 @@ impl Default for RefPtr { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHolder { - a: T, + pub a: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHolder { @@ -30,7 +30,7 @@ impl Default for nsMainThreadPtrHolder { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHandle { - mPtr: RefPtr>, + pub mPtr: RefPtr>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHandle { diff --git a/tests/expectations/tests/issue-662-part-2.rs b/tests/expectations/tests/issue-662-part-2.rs index 6833dee7b..d08e6fb81 100644 --- a/tests/expectations/tests/issue-662-part-2.rs +++ b/tests/expectations/tests/issue-662-part-2.rs @@ -11,7 +11,7 @@ pub struct RefPtr(T); #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsMainThreadPtrHolder { - a: T, + pub a: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHolder { @@ -21,7 +21,7 @@ impl Default for nsMainThreadPtrHolder { } #[repr(C)] pub struct nsMainThreadPtrHandle { - mPtr: RefPtr>, + pub mPtr: RefPtr>, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsMainThreadPtrHandle { diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs index e4e007665..4ccc4504c 100644 --- a/tests/expectations/tests/issue-674-2.rs +++ b/tests/expectations/tests/issue-674-2.rs @@ -22,7 +22,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct c { - b: u8, + pub b: u8, } #[test] fn bindgen_test_layout_c() { @@ -45,7 +45,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct B { - a: root::c, + pub a: root::c, } #[test] fn bindgen_test_layout_B() { diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs index 67c4ced8f..99c96b969 100644 --- a/tests/expectations/tests/issue-674-3.rs +++ b/tests/expectations/tests/issue-674-3.rs @@ -41,7 +41,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct nsCSSValue { - c: root::a, + pub c: root::a, } #[test] fn bindgen_test_layout_nsCSSValue() { diff --git a/tests/expectations/tests/issue-691-template-parameter-virtual.rs b/tests/expectations/tests/issue-691-template-parameter-virtual.rs index f34cce094..3d2072821 100644 --- a/tests/expectations/tests/issue-691-template-parameter-virtual.rs +++ b/tests/expectations/tests/issue-691-template-parameter-virtual.rs @@ -33,7 +33,7 @@ impl Default for VirtualMethods { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Set { - bar: ::std::os::raw::c_int, + pub bar: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs index 2369c39ac..6fe3cc681 100644 --- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs +++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs @@ -36,7 +36,7 @@ extern "C" { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct C { - b: B, + pub b: B, } #[test] fn bindgen_test_layout_C() { diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs index ee9d45959..bad51ff43 100644 --- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs +++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs @@ -105,7 +105,7 @@ extern "C" { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Whitelisted { - some_member: Opaque, + pub some_member: Opaque, } #[test] fn bindgen_test_layout_Whitelisted() { diff --git a/tests/expectations/tests/issue-848-replacement-system-include.rs b/tests/expectations/tests/issue-848-replacement-system-include.rs index c7275b2f5..af91e1ec7 100644 --- a/tests/expectations/tests/issue-848-replacement-system-include.rs +++ b/tests/expectations/tests/issue-848-replacement-system-include.rs @@ -14,7 +14,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsTArray { - m: *mut T, + pub m: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsTArray { diff --git a/tests/expectations/tests/libclang-9/class.rs b/tests/expectations/tests/libclang-9/class.rs index 14ddd1421..baa851b96 100644 --- a/tests/expectations/tests/libclang-9/class.rs +++ b/tests/expectations/tests/libclang-9/class.rs @@ -38,8 +38,8 @@ impl ::std::fmt::Debug for __IncompleteArrayField { #[repr(C)] #[derive(Copy, Clone)] pub struct C { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], } #[test] fn bindgen_test_layout_C() { @@ -76,9 +76,9 @@ impl Default for C { } #[repr(C)] pub struct C_with_zero_length_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array() { @@ -140,8 +140,8 @@ impl Default for C_with_zero_length_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_zero_length_array_2 { - a: ::std::os::raw::c_int, - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_2() { @@ -184,9 +184,9 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { } #[repr(C)] pub struct C_with_incomplete_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_incomplete_array() { @@ -248,8 +248,8 @@ impl Default for C_with_incomplete_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_incomplete_array_2 { - a: ::std::os::raw::c_int, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_incomplete_array_2() { @@ -292,10 +292,10 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { } #[repr(C)] pub struct C_with_zero_length_array_and_incomplete_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { @@ -384,9 +384,9 @@ impl Default for C_with_zero_length_array_and_incomplete_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_zero_length_array_and_incomplete_array_2 { - a: ::std::os::raw::c_int, - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { @@ -457,7 +457,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { #[repr(C)] #[derive(Debug, Default, Hash, PartialOrd, Ord, PartialEq, Eq)] pub struct WithDtor { - b: ::std::os::raw::c_int, + pub b: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_WithDtor() { @@ -484,8 +484,8 @@ fn bindgen_test_layout_WithDtor() { } #[repr(C)] pub struct IncompleteArrayNonCopiable { - whatever: *mut ::std::os::raw::c_void, - incomplete_array: __IncompleteArrayField, + pub whatever: *mut ::std::os::raw::c_void, + pub incomplete_array: __IncompleteArrayField, } #[test] fn bindgen_test_layout_IncompleteArrayNonCopiable() { @@ -569,7 +569,7 @@ impl Default for Union { #[repr(C)] #[derive(Copy, Clone)] pub struct WithUnion { - data: Union, + pub data: Union, } #[test] fn bindgen_test_layout_WithUnion() { diff --git a/tests/expectations/tests/libclang-9/class_1_0.rs b/tests/expectations/tests/libclang-9/class_1_0.rs index 5d24acc7d..d527dfd75 100644 --- a/tests/expectations/tests/libclang-9/class_1_0.rs +++ b/tests/expectations/tests/libclang-9/class_1_0.rs @@ -81,8 +81,8 @@ impl ::std::cmp::Eq for __BindgenUnionField {} #[repr(C)] #[derive(Copy)] pub struct C { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], } #[test] fn bindgen_test_layout_C() { @@ -129,9 +129,9 @@ impl ::std::cmp::PartialEq for C { } #[repr(C)] pub struct C_with_zero_length_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array() { @@ -193,8 +193,8 @@ impl Default for C_with_zero_length_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_zero_length_array_2 { - a: ::std::os::raw::c_int, - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_2() { @@ -237,9 +237,9 @@ fn bindgen_test_layout_C_with_zero_length_array_2() { } #[repr(C)] pub struct C_with_incomplete_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_incomplete_array() { @@ -301,8 +301,8 @@ impl Default for C_with_incomplete_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_incomplete_array_2 { - a: ::std::os::raw::c_int, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_incomplete_array_2() { @@ -345,10 +345,10 @@ fn bindgen_test_layout_C_with_incomplete_array_2() { } #[repr(C)] pub struct C_with_zero_length_array_and_incomplete_array { - a: ::std::os::raw::c_int, - big_array: [::std::os::raw::c_char; 33usize], - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub big_array: [::std::os::raw::c_char; 33usize], + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() { @@ -437,9 +437,9 @@ impl Default for C_with_zero_length_array_and_incomplete_array { #[repr(C)] #[derive(Debug, Default)] pub struct C_with_zero_length_array_and_incomplete_array_2 { - a: ::std::os::raw::c_int, - zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, - incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub a: ::std::os::raw::c_int, + pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>, + pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { @@ -510,7 +510,7 @@ fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array_2() { #[repr(C)] #[derive(Debug, Default, Hash, PartialEq, Eq)] pub struct WithDtor { - b: ::std::os::raw::c_int, + pub b: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_WithDtor() { @@ -537,8 +537,8 @@ fn bindgen_test_layout_WithDtor() { } #[repr(C)] pub struct IncompleteArrayNonCopiable { - whatever: *mut ::std::os::raw::c_void, - incomplete_array: __IncompleteArrayField, + pub whatever: *mut ::std::os::raw::c_void, + pub incomplete_array: __IncompleteArrayField, } #[test] fn bindgen_test_layout_IncompleteArrayNonCopiable() { @@ -622,7 +622,7 @@ impl Clone for Union { #[repr(C)] #[derive(Debug, Default, Copy, Hash, PartialEq)] pub struct WithUnion { - data: Union, + pub data: Union, } #[test] fn bindgen_test_layout_WithUnion() { diff --git a/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs index 1be3afd5a..45bcb6f56 100644 --- a/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs +++ b/tests/expectations/tests/libclang-9/issue-769-bad-instantiation-test.rs @@ -12,7 +12,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { - member: T, + pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { diff --git a/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs index c49480a76..e62ea6817 100644 --- a/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs +++ b/tests/expectations/tests/libclang-9/partial-specialization-and-inheritance.rs @@ -13,7 +13,7 @@ pub struct Base { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Derived { - b: bool, + pub b: bool, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs index dd7a36d3c..38f3bfb1c 100644 --- a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs +++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { - ptr: MaybeWrapped<::std::os::raw::c_int>, + pub ptr: MaybeWrapped<::std::os::raw::c_int>, } #[test] fn bindgen_test_layout_Rooted() { diff --git a/tests/expectations/tests/libclang-9/zero-sized-array.rs b/tests/expectations/tests/libclang-9/zero-sized-array.rs index 9c9a8df7a..6514b930c 100644 --- a/tests/expectations/tests/libclang-9/zero-sized-array.rs +++ b/tests/expectations/tests/libclang-9/zero-sized-array.rs @@ -39,7 +39,7 @@ impl ::std::fmt::Debug for __IncompleteArrayField { #[repr(C)] #[derive(Debug, Default)] pub struct ZeroSizedArray { - arr: __IncompleteArrayField<::std::os::raw::c_char>, + pub arr: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_ZeroSizedArray() { @@ -70,7 +70,7 @@ fn bindgen_test_layout_ZeroSizedArray() { #[repr(C)] #[derive(Debug, Default)] pub struct ContainsZeroSizedArray { - zsa: ZeroSizedArray, + pub zsa: ZeroSizedArray, } #[test] fn bindgen_test_layout_ContainsZeroSizedArray() { @@ -103,7 +103,7 @@ fn bindgen_test_layout_ContainsZeroSizedArray() { #[repr(C)] #[derive(Debug, Default)] pub struct InheritsZeroSizedArray { - _base: ZeroSizedArray, + pub _base: ZeroSizedArray, } #[test] fn bindgen_test_layout_InheritsZeroSizedArray() { @@ -122,7 +122,7 @@ fn bindgen_test_layout_InheritsZeroSizedArray() { #[repr(C)] #[derive(Debug, Default)] pub struct DynamicallySizedArray { - arr: __IncompleteArrayField<::std::os::raw::c_char>, + pub arr: __IncompleteArrayField<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_DynamicallySizedArray() { @@ -154,7 +154,7 @@ fn bindgen_test_layout_DynamicallySizedArray() { #[repr(C)] #[derive(Debug, Default)] pub struct ContainsDynamicallySizedArray { - dsa: DynamicallySizedArray, + pub dsa: DynamicallySizedArray, } #[test] fn bindgen_test_layout_ContainsDynamicallySizedArray() { diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs index 3c31383fe..ea5a90b87 100644 --- a/tests/expectations/tests/msvc-no-usr.rs +++ b/tests/expectations/tests/msvc-no-usr.rs @@ -9,7 +9,7 @@ pub type size_t = ::std::os::raw::c_ulonglong; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct A { - foo: size_t, + pub foo: size_t, } #[test] fn bindgen_test_layout_A() { diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs index 4023ac165..9f5865fcc 100644 --- a/tests/expectations/tests/mutable.rs +++ b/tests/expectations/tests/mutable.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct C { - m_member: ::std::os::raw::c_int, - m_other: ::std::os::raw::c_int, + pub m_member: ::std::os::raw::c_int, + pub m_other: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_C() { @@ -47,7 +47,7 @@ fn bindgen_test_layout_C() { #[repr(C)] #[derive(Debug, Default)] pub struct NonCopiable { - m_member: ::std::os::raw::c_int, + pub m_member: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NonCopiable() { @@ -78,7 +78,7 @@ fn bindgen_test_layout_NonCopiable() { #[repr(C)] #[derive(Debug, Default)] pub struct NonCopiableWithNonCopiableMutableMember { - m_member: NonCopiable, + pub m_member: NonCopiable, } #[test] fn bindgen_test_layout_NonCopiableWithNonCopiableMutableMember() { diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs index 43b79f513..944ec5bb0 100644 --- a/tests/expectations/tests/namespace.rs +++ b/tests/expectations/tests/namespace.rs @@ -59,9 +59,9 @@ pub mod root { #[derive(Debug)] pub struct C { pub _base: root::_bindgen_mod_id_17::A, - m_c: T, - m_c_ptr: *mut T, - m_c_arr: [T; 10usize], + pub m_c: T, + pub m_c_ptr: *mut T, + pub m_c_arr: [T; 10usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for C { @@ -76,7 +76,7 @@ pub mod root { #[repr(C)] #[derive(Debug)] pub struct D { - m_c: root::C, + pub m_c: root::C, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs index b953ac71a..92cd6605b 100644 --- a/tests/expectations/tests/nested.rs +++ b/tests/expectations/tests/nested.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Calc { - w: ::std::os::raw::c_int, + pub w: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Calc() { diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs index b721dff86..86b9b8c68 100644 --- a/tests/expectations/tests/nested_within_namespace.rs +++ b/tests/expectations/tests/nested_within_namespace.rs @@ -15,12 +15,12 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar { - foo: ::std::os::raw::c_int, + pub foo: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Bar_Baz { - foo: ::std::os::raw::c_int, + pub foo: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Bar_Baz() { @@ -75,7 +75,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Baz { - baz: ::std::os::raw::c_int, + pub baz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_Baz() { diff --git a/tests/expectations/tests/no-hash-whitelisted.rs b/tests/expectations/tests/no-hash-whitelisted.rs index 26711d44b..1cd7f672b 100644 --- a/tests/expectations/tests/no-hash-whitelisted.rs +++ b/tests/expectations/tests/no-hash-whitelisted.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct NoHash { - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NoHash() { diff --git a/tests/expectations/tests/no-partialeq-whitelisted.rs b/tests/expectations/tests/no-partialeq-whitelisted.rs index 05945b284..cd3ed3b93 100644 --- a/tests/expectations/tests/no-partialeq-whitelisted.rs +++ b/tests/expectations/tests/no-partialeq-whitelisted.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct NoPartialEq { - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NoPartialEq() { diff --git a/tests/expectations/tests/no_copy.rs b/tests/expectations/tests/no_copy.rs index c2ae36fe5..daccf757e 100644 --- a/tests/expectations/tests/no_copy.rs +++ b/tests/expectations/tests/no_copy.rs @@ -9,5 +9,5 @@ #[repr(C)] #[derive(Debug, Default)] pub struct CopiableButWait { - whatever: ::std::os::raw::c_int, + pub whatever: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/no_copy_whitelisted.rs b/tests/expectations/tests/no_copy_whitelisted.rs index 8ae4b102d..fa53bb66f 100644 --- a/tests/expectations/tests/no_copy_whitelisted.rs +++ b/tests/expectations/tests/no_copy_whitelisted.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default)] pub struct NoCopy { - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NoCopy() { diff --git a/tests/expectations/tests/no_debug.rs b/tests/expectations/tests/no_debug.rs index 07eee2c37..21850ecb1 100644 --- a/tests/expectations/tests/no_debug.rs +++ b/tests/expectations/tests/no_debug.rs @@ -9,5 +9,5 @@ #[repr(C)] #[derive(Default, Copy, Clone)] pub struct DebugButWait { - whatever: ::std::os::raw::c_int, + pub whatever: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/no_debug_bypass_impl_debug.rs b/tests/expectations/tests/no_debug_bypass_impl_debug.rs index 959135934..adb80eaa7 100644 --- a/tests/expectations/tests/no_debug_bypass_impl_debug.rs +++ b/tests/expectations/tests/no_debug_bypass_impl_debug.rs @@ -7,7 +7,7 @@ #[repr(C)] pub struct Generic { - t: [T; 40usize], + pub t: [T; 40usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Generic { @@ -22,7 +22,7 @@ impl ::std::fmt::Debug for Generic { } #[repr(C)] pub struct NoDebug { - t: [T; 40usize], + pub t: [T; 40usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NoDebug { diff --git a/tests/expectations/tests/no_debug_whitelisted.rs b/tests/expectations/tests/no_debug_whitelisted.rs index bd577da65..e240d645f 100644 --- a/tests/expectations/tests/no_debug_whitelisted.rs +++ b/tests/expectations/tests/no_debug_whitelisted.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Default, Copy, Clone)] pub struct NoDebug { - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NoDebug() { diff --git a/tests/expectations/tests/no_default.rs b/tests/expectations/tests/no_default.rs index 7c577ff3c..27ea3035c 100644 --- a/tests/expectations/tests/no_default.rs +++ b/tests/expectations/tests/no_default.rs @@ -9,12 +9,12 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DefaultButWait { - whatever: ::std::os::raw::c_int, + pub whatever: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DefaultButWaitDerived { - whatever: DefaultButWait, + pub whatever: DefaultButWait, } impl Default for DefaultButWaitDerived { fn default() -> Self { diff --git a/tests/expectations/tests/no_default_bypass_derive_default.rs b/tests/expectations/tests/no_default_bypass_derive_default.rs index bb90f4a3b..4b97e3f48 100644 --- a/tests/expectations/tests/no_default_bypass_derive_default.rs +++ b/tests/expectations/tests/no_default_bypass_derive_default.rs @@ -7,7 +7,7 @@ #[repr(C)] pub struct Generic { - t: [T; 40usize], + pub t: [T; 40usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Generic { @@ -17,6 +17,6 @@ impl Default for Generic { } #[repr(C)] pub struct NoDefault { - t: [T; 40usize], + pub t: [T; 40usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/no_default_whitelisted.rs b/tests/expectations/tests/no_default_whitelisted.rs index c76073bc4..980f1575f 100644 --- a/tests/expectations/tests/no_default_whitelisted.rs +++ b/tests/expectations/tests/no_default_whitelisted.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct NoDefault { - i: ::std::os::raw::c_int, + pub i: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_NoDefault() { diff --git a/tests/expectations/tests/nsBaseHashtable.rs b/tests/expectations/tests/nsBaseHashtable.rs index 55ba037fd..e26190b0d 100644 --- a/tests/expectations/tests/nsBaseHashtable.rs +++ b/tests/expectations/tests/nsBaseHashtable.rs @@ -26,8 +26,8 @@ pub type nsBaseHashtable_EntryType = nsBaseHashtableET; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsBaseHashtable_LookupResult { - mEntry: *mut nsBaseHashtable_EntryType, - mTable: *mut nsBaseHashtable, + pub mEntry: *mut nsBaseHashtable_EntryType, + pub mTable: *mut nsBaseHashtable, } impl Default for nsBaseHashtable_LookupResult { fn default() -> Self { @@ -37,8 +37,8 @@ impl Default for nsBaseHashtable_LookupResult { #[repr(C)] #[derive(Debug)] pub struct nsBaseHashtable_EntryPtr { - mEntry: *mut nsBaseHashtable_EntryType, - mExistingEntry: bool, + pub mEntry: *mut nsBaseHashtable_EntryType, + pub mExistingEntry: bool, } impl Default for nsBaseHashtable_EntryPtr { fn default() -> Self { diff --git a/tests/expectations/tests/nsStyleAutoArray.rs b/tests/expectations/tests/nsStyleAutoArray.rs index 6e0ef03aa..091be3ddf 100644 --- a/tests/expectations/tests/nsStyleAutoArray.rs +++ b/tests/expectations/tests/nsStyleAutoArray.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsTArray { - mBuff: *mut T, + pub mBuff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for nsTArray { @@ -19,8 +19,8 @@ impl Default for nsTArray { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct nsStyleAutoArray { - mFirstElement: T, - mOtherElements: nsTArray, + pub mFirstElement: T, + pub mOtherElements: nsTArray, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(i32)] diff --git a/tests/expectations/tests/only_bitfields.rs b/tests/expectations/tests/only_bitfields.rs index 087525b7a..2f063b5b3 100644 --- a/tests/expectations/tests/only_bitfields.rs +++ b/tests/expectations/tests/only_bitfields.rs @@ -95,7 +95,7 @@ where #[derive(Debug, Default, Copy, Clone)] pub struct C { pub _bitfield_align_1: [u8; 0], - _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, } #[test] fn bindgen_test_layout_C() { @@ -112,33 +112,36 @@ fn bindgen_test_layout_C() { } impl C { #[inline] - fn a(&self) -> bool { + pub fn a(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } } #[inline] - fn set_a(&mut self, val: bool) { + pub fn set_a(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(0usize, 1u8, val as u64) } } #[inline] - fn b(&self) -> bool { + pub fn b(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 7u8) as u8) } } #[inline] - fn set_b(&mut self, val: bool) { + pub fn set_b(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_1.set(1usize, 7u8, val as u64) } } #[inline] - fn new_bitfield_1(a: bool, b: bool) -> __BindgenBitfieldUnit<[u8; 1usize]> { + pub fn new_bitfield_1( + a: bool, + b: bool, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); __bindgen_bitfield_unit.set(0usize, 1u8, { diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs index 736bcbdf9..7d3e83a86 100644 --- a/tests/expectations/tests/opaque-template-inst-member-2.rs +++ b/tests/expectations/tests/opaque-template-inst-member-2.rs @@ -16,8 +16,8 @@ pub struct OpaqueTemplate { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsOpaqueTemplate { - mBlah: u32, - mBaz: ::std::os::raw::c_int, + pub mBlah: u32, + pub mBaz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_ContainsOpaqueTemplate() { @@ -63,7 +63,7 @@ fn bindgen_test_layout_ContainsOpaqueTemplate() { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct InheritsOpaqueTemplate { pub _base: u8, - wow: *mut ::std::os::raw::c_char, + pub wow: *mut ::std::os::raw::c_char, } #[test] fn bindgen_test_layout_InheritsOpaqueTemplate() { diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs index 88bab6593..ea821fcd7 100644 --- a/tests/expectations/tests/opaque-template-inst-member.rs +++ b/tests/expectations/tests/opaque-template-inst-member.rs @@ -14,8 +14,8 @@ pub struct OpaqueTemplate { /// Debug/Hash because the instantiation's definition cannot derive Debug/Hash. #[repr(C)] pub struct ContainsOpaqueTemplate { - mBlah: [u32; 101usize], - mBaz: ::std::os::raw::c_int, + pub mBlah: [u32; 101usize], + pub mBaz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_ContainsOpaqueTemplate() { @@ -71,7 +71,7 @@ impl ::std::cmp::PartialEq for ContainsOpaqueTemplate { #[repr(C)] pub struct InheritsOpaqueTemplate { pub _base: [u8; 401usize], - wow: *mut ::std::os::raw::c_char, + pub wow: *mut ::std::os::raw::c_char, } #[test] fn bindgen_test_layout_InheritsOpaqueTemplate() { diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs index 938821803..7f1aac8e4 100644 --- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs +++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs @@ -15,7 +15,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Template { - member: T, + pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } @@ -87,7 +87,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsInstantiation { - not_opaque: root::zoidberg::Template, + pub not_opaque: root::zoidberg::Template, } #[test] fn bindgen_test_layout_ContainsInstantiation() { @@ -123,7 +123,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsOpaqueInstantiation { - opaque: u32, + pub opaque: u32, } #[test] fn bindgen_test_layout_ContainsOpaqueInstantiation() { diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs index 229bdf9ae..771a5191a 100644 --- a/tests/expectations/tests/opaque-template-instantiation.rs +++ b/tests/expectations/tests/opaque-template-instantiation.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Template { - member: T, + pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Template { @@ -19,7 +19,7 @@ impl Default for Template { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsInstantiation { - not_opaque: Template<::std::os::raw::c_char>, + pub not_opaque: Template<::std::os::raw::c_char>, } #[test] fn bindgen_test_layout_ContainsInstantiation() { @@ -55,7 +55,7 @@ impl Default for ContainsInstantiation { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct ContainsOpaqueInstantiation { - opaque: u32, + pub opaque: u32, } #[test] fn bindgen_test_layout_ContainsOpaqueInstantiation() { diff --git a/tests/expectations/tests/private_fields.rs b/tests/expectations/tests/private_fields.rs index 72a451a0d..f5edccae4 100644 --- a/tests/expectations/tests/private_fields.rs +++ b/tests/expectations/tests/private_fields.rs @@ -473,3 +473,50 @@ fn bindgen_test_layout_WithAnonStruct() { concat!("Alignment of ", stringify!(WithAnonStruct)) ); } +#[repr(C)] +#[derive(Copy, Clone)] +pub struct WithAnonUnion { + __bindgen_anon_1: WithAnonUnion__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union WithAnonUnion__bindgen_ty_1 { + _bindgen_union_align: u8, + pub _address: u8, +} +#[test] +fn bindgen_test_layout_WithAnonUnion__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(WithAnonUnion__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(WithAnonUnion__bindgen_ty_1)) + ); +} +impl Default for WithAnonUnion__bindgen_ty_1 { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} +#[test] +fn bindgen_test_layout_WithAnonUnion() { + assert_eq!( + ::std::mem::size_of::(), + 1usize, + concat!("Size of: ", stringify!(WithAnonUnion)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(WithAnonUnion)) + ); +} +impl Default for WithAnonUnion { + fn default() -> Self { + unsafe { ::std::mem::zeroed() } + } +} diff --git a/tests/expectations/tests/replace_template_alias.rs b/tests/expectations/tests/replace_template_alias.rs index 8ab99216c..0c5500eae 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; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JS_Rooted { - ptr: JS_detail_MaybeWrapped, + pub ptr: JS_detail_MaybeWrapped, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for JS_Rooted { diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs index 9f48e897a..7b7ec00e2 100644 --- a/tests/expectations/tests/replaces_double.rs +++ b/tests/expectations/tests/replaces_double.rs @@ -20,7 +20,7 @@ pub type Wrapper_Type = Wrapper_Wrapped; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { - ptr: Rooted_MaybeWrapped, + pub ptr: Rooted_MaybeWrapped, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } ///
diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs index 8eb0a5d22..5f2ec54d5 100644 --- a/tests/expectations/tests/sentry-defined-multiple-times.rs +++ b/tests/expectations/tests/sentry-defined-multiple-times.rs @@ -20,12 +20,12 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Wrapper_sentry { - i_am_wrapper_sentry: ::std::os::raw::c_int, + pub i_am_wrapper_sentry: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct sentry { - i_am_plain_sentry: bool, + pub i_am_plain_sentry: bool, } #[test] fn bindgen_test_layout_sentry() { @@ -74,7 +74,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct NotTemplateWrapper_sentry { - i_am_not_template_wrapper_sentry: ::std::os::raw::c_char, + pub i_am_not_template_wrapper_sentry: ::std::os::raw::c_char, } #[test] fn bindgen_test_layout_NotTemplateWrapper_sentry() { @@ -111,7 +111,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct InlineNotTemplateWrapper_sentry { - i_am_inline_not_template_wrapper_sentry: bool, + pub i_am_inline_not_template_wrapper_sentry: bool, } #[test] fn bindgen_test_layout_InlineNotTemplateWrapper_sentry() { @@ -167,7 +167,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct InlineTemplateWrapper_sentry { - i_am_inline_template_wrapper_sentry: ::std::os::raw::c_int, + pub i_am_inline_template_wrapper_sentry: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -214,7 +214,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct OuterDoubleWrapper_InnerDoubleWrapper_sentry { - i_am_double_wrapper_sentry: ::std::os::raw::c_int, + pub i_am_double_wrapper_sentry: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_OuterDoubleWrapper_InnerDoubleWrapper_sentry() { @@ -268,7 +268,7 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry { - i_am_double_wrapper_inline_sentry: ::std::os::raw::c_int, + pub i_am_double_wrapper_inline_sentry: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry( @@ -327,12 +327,12 @@ pub mod root { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct OutsideNamespaceWrapper_sentry { - i_am_outside_namespace_wrapper_sentry: ::std::os::raw::c_int, + pub i_am_outside_namespace_wrapper_sentry: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct sentry { - i_am_outside_namespace_sentry: ::std::os::raw::c_int, + pub i_am_outside_namespace_sentry: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_sentry() { diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs index ec3ee5669..6796bc9f3 100644 --- a/tests/expectations/tests/size_t_template.rs +++ b/tests/expectations/tests/size_t_template.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct C { - arr: [u32; 3usize], + pub arr: [u32; 3usize], } #[test] fn bindgen_test_layout_C() { diff --git a/tests/expectations/tests/template-param-usage-0.rs b/tests/expectations/tests/template-param-usage-0.rs index cead004f4..f473b74d7 100644 --- a/tests/expectations/tests/template-param-usage-0.rs +++ b/tests/expectations/tests/template-param-usage-0.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { - t: T, + pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for UsesTemplateParameter { diff --git a/tests/expectations/tests/template-param-usage-1.rs b/tests/expectations/tests/template-param-usage-1.rs index 86a97418c..4fc227c91 100644 --- a/tests/expectations/tests/template-param-usage-1.rs +++ b/tests/expectations/tests/template-param-usage-1.rs @@ -8,5 +8,5 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct DoesNotUseTemplateParameter { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } diff --git a/tests/expectations/tests/template-param-usage-10.rs b/tests/expectations/tests/template-param-usage-10.rs index a74370b39..0afc59525 100644 --- a/tests/expectations/tests/template-param-usage-10.rs +++ b/tests/expectations/tests/template-param-usage-10.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DoublyIndirectUsage { - doubly_indirect: DoublyIndirectUsage_IndirectUsage, + pub doubly_indirect: DoublyIndirectUsage_IndirectUsage, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } @@ -17,8 +17,8 @@ pub type DoublyIndirectUsage_Typedefed = U; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DoublyIndirectUsage_IndirectUsage { - member: DoublyIndirectUsage_Aliased, - another: DoublyIndirectUsage_Typedefed, + pub member: DoublyIndirectUsage_Aliased, + pub another: DoublyIndirectUsage_Typedefed, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/template-param-usage-12.rs b/tests/expectations/tests/template-param-usage-12.rs index a9149400a..9f964b295 100644 --- a/tests/expectations/tests/template-param-usage-12.rs +++ b/tests/expectations/tests/template-param-usage-12.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct BaseUsesT { - t: *mut T, + pub t: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseUsesT { @@ -20,7 +20,7 @@ impl Default for BaseUsesT { #[derive(Debug, Copy, Clone)] pub struct CrtpUsesU { pub _base: BaseUsesT>, - usage: U, + pub usage: U, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for CrtpUsesU { diff --git a/tests/expectations/tests/template-param-usage-13.rs b/tests/expectations/tests/template-param-usage-13.rs index c27e1c0f2..64e08da47 100644 --- a/tests/expectations/tests/template-param-usage-13.rs +++ b/tests/expectations/tests/template-param-usage-13.rs @@ -8,13 +8,13 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct BaseIgnoresT { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CrtpUsesU { pub _base: BaseIgnoresT, - usage: U, + pub usage: U, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for CrtpUsesU { diff --git a/tests/expectations/tests/template-param-usage-14.rs b/tests/expectations/tests/template-param-usage-14.rs index b22ae9fc6..8826105f9 100644 --- a/tests/expectations/tests/template-param-usage-14.rs +++ b/tests/expectations/tests/template-param-usage-14.rs @@ -8,13 +8,13 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct BaseIgnoresT { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CrtpIgnoresU { pub _base: BaseIgnoresT, - y: ::std::os::raw::c_int, + pub y: ::std::os::raw::c_int, } impl Default for CrtpIgnoresU { fn default() -> Self { diff --git a/tests/expectations/tests/template-param-usage-15.rs b/tests/expectations/tests/template-param-usage-15.rs index c8fc29e59..45f342293 100644 --- a/tests/expectations/tests/template-param-usage-15.rs +++ b/tests/expectations/tests/template-param-usage-15.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct BaseUsesT { - usage: *mut T, + pub usage: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for BaseUsesT { @@ -20,7 +20,7 @@ impl Default for BaseUsesT { #[derive(Debug, Copy, Clone)] pub struct CrtpIgnoresU { pub _base: BaseUsesT, - y: ::std::os::raw::c_int, + pub y: ::std::os::raw::c_int, } impl Default for CrtpIgnoresU { fn default() -> Self { diff --git a/tests/expectations/tests/template-param-usage-2.rs b/tests/expectations/tests/template-param-usage-2.rs index c665a1cd9..3270e1608 100644 --- a/tests/expectations/tests/template-param-usage-2.rs +++ b/tests/expectations/tests/template-param-usage-2.rs @@ -8,13 +8,13 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { - t: T, + pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter_AlsoUsesTemplateParameter { - also: T, + pub also: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for UsesTemplateParameter_AlsoUsesTemplateParameter { diff --git a/tests/expectations/tests/template-param-usage-3.rs b/tests/expectations/tests/template-param-usage-3.rs index 333bc0ff2..9d9d8f973 100644 --- a/tests/expectations/tests/template-param-usage-3.rs +++ b/tests/expectations/tests/template-param-usage-3.rs @@ -8,14 +8,14 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { - t: T, + pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter_AlsoUsesTemplateParameterAndMore { - also: T, - more: U, + pub also: T, + pub more: U, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/template-param-usage-4.rs b/tests/expectations/tests/template-param-usage-4.rs index 18f27e82c..38479aca4 100644 --- a/tests/expectations/tests/template-param-usage-4.rs +++ b/tests/expectations/tests/template-param-usage-4.rs @@ -8,13 +8,13 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct UsesTemplateParameter { - t: T, + pub t: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct UsesTemplateParameter_DoesNotUseTemplateParameters { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } impl Default for UsesTemplateParameter { fn default() -> Self { diff --git a/tests/expectations/tests/template-param-usage-5.rs b/tests/expectations/tests/template-param-usage-5.rs index 019baf5cc..697684180 100644 --- a/tests/expectations/tests/template-param-usage-5.rs +++ b/tests/expectations/tests/template-param-usage-5.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct IndirectlyUsesTemplateParameter { - aliased: IndirectlyUsesTemplateParameter_Aliased, + pub aliased: IndirectlyUsesTemplateParameter_Aliased, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } pub type IndirectlyUsesTemplateParameter_Aliased = T; diff --git a/tests/expectations/tests/template-param-usage-6.rs b/tests/expectations/tests/template-param-usage-6.rs index ff74ea6fc..3c0e51526 100644 --- a/tests/expectations/tests/template-param-usage-6.rs +++ b/tests/expectations/tests/template-param-usage-6.rs @@ -8,6 +8,6 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct DoesNotUseTemplateParameter { - x: ::std::os::raw::c_int, + pub x: ::std::os::raw::c_int, } pub type DoesNotUseTemplateParameter_ButAliasDoesUseIt = T; diff --git a/tests/expectations/tests/template-param-usage-7.rs b/tests/expectations/tests/template-param-usage-7.rs index 048739cbb..6f7544ff0 100644 --- a/tests/expectations/tests/template-param-usage-7.rs +++ b/tests/expectations/tests/template-param-usage-7.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DoesNotUseU { - t: T, - v: V, + pub t: T, + pub v: V, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/template-param-usage-8.rs b/tests/expectations/tests/template-param-usage-8.rs index 3a079fdf2..3a0100ffc 100644 --- a/tests/expectations/tests/template-param-usage-8.rs +++ b/tests/expectations/tests/template-param-usage-8.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct IndirectUsage { - member1: IndirectUsage_Typedefed, - member2: IndirectUsage_Aliased, + pub member1: IndirectUsage_Typedefed, + pub member2: IndirectUsage_Aliased, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/template-param-usage-9.rs b/tests/expectations/tests/template-param-usage-9.rs index 95fc09f98..a93e4b7c0 100644 --- a/tests/expectations/tests/template-param-usage-9.rs +++ b/tests/expectations/tests/template-param-usage-9.rs @@ -15,8 +15,8 @@ pub type DoesNotUse_Typedefed = U; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct DoesNotUse_IndirectUsage { - member: DoesNotUse_Aliased, - another: DoesNotUse_Typedefed, + pub member: DoesNotUse_Aliased, + pub another: DoesNotUse_Typedefed, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, pub _phantom_1: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs index 591b528d2..67a0f8568 100644 --- a/tests/expectations/tests/template.rs +++ b/tests/expectations/tests/template.rs @@ -8,9 +8,9 @@ #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct Foo { - m_member: T, - m_member_ptr: *mut T, - m_member_arr: [T; 1usize], + pub m_member: T, + pub m_member_ptr: *mut T, + pub m_member_arr: [T; 1usize], pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Foo { @@ -21,7 +21,7 @@ impl Default for Foo { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct B { - m_member: T, + pub m_member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for B { @@ -237,14 +237,14 @@ impl Default for C { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct D { - m_foo: D_MyFoo, + pub m_foo: D_MyFoo, } pub type D_MyFoo = Foo<::std::os::raw::c_int>; #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct D_U { - m_nested_foo: D_MyFoo, - m_baz: Z, + pub m_nested_foo: D_MyFoo, + pub m_baz: Z, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for D_U { @@ -260,9 +260,9 @@ impl Default for D { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Rooted { - prev: *mut T, - next: *mut Rooted<*mut ::std::os::raw::c_void>, - ptr: T, + pub prev: *mut T, + pub next: *mut Rooted<*mut ::std::os::raw::c_void>, + pub ptr: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { @@ -273,7 +273,7 @@ impl Default for Rooted { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct RootedContainer { - root: Rooted<*mut ::std::os::raw::c_void>, + pub root: Rooted<*mut ::std::os::raw::c_void>, } #[test] fn bindgen_test_layout_RootedContainer() { @@ -310,7 +310,7 @@ pub type WithDtorIntFwd = WithDtor<::std::os::raw::c_int>; #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct WithDtor { - member: T, + pub member: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for WithDtor { @@ -321,7 +321,7 @@ impl Default for WithDtor { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct PODButContainsDtor { - member: WithDtorIntFwd, + pub member: WithDtorIntFwd, } #[test] fn bindgen_test_layout_PODButContainsDtor() { @@ -363,7 +363,7 @@ pub struct Opaque { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct POD { - opaque_member: u32, + pub opaque_member: u32, } #[test] fn bindgen_test_layout_POD() { @@ -394,7 +394,7 @@ fn bindgen_test_layout_POD() { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct NestedReplaced { - buff: *mut T, + pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedReplaced { @@ -405,7 +405,7 @@ impl Default for NestedReplaced { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct NestedBase { - buff: *mut T, + pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedBase { @@ -416,9 +416,9 @@ impl Default for NestedBase { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct NestedContainer { - c: T, - nested: NestedReplaced, - inc: Incomplete, + pub c: T, + pub nested: NestedReplaced, + pub inc: Incomplete, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for NestedContainer { @@ -429,7 +429,7 @@ impl Default for NestedContainer { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Incomplete { - d: T, + pub d: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Incomplete { @@ -458,7 +458,7 @@ fn bindgen_test_layout_Untemplated() { #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct Templated { - m_untemplated: Untemplated, + pub m_untemplated: Untemplated, } /// If the replacement doesn't happen at the parse level the container would be /// copy and the replacement wouldn't, so this wouldn't compile. @@ -467,7 +467,7 @@ pub struct Templated { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ReplacedWithoutDestructor { - buff: *mut T, + pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ReplacedWithoutDestructor { @@ -478,7 +478,7 @@ impl Default for ReplacedWithoutDestructor { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ShouldNotBeCopiable { - m_member: ReplacedWithoutDestructor, + pub m_member: ReplacedWithoutDestructor, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ShouldNotBeCopiable { @@ -489,7 +489,7 @@ impl Default for ShouldNotBeCopiable { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ShouldNotBeCopiableAsWell { - m_member: ReplacedWithoutDestructorFwd, + pub m_member: ReplacedWithoutDestructorFwd, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ShouldNotBeCopiableAsWell { @@ -504,7 +504,7 @@ impl Default for ShouldNotBeCopiableAsWell { #[repr(C)] #[derive(Debug, Hash, PartialEq, Eq)] pub struct ReplacedWithoutDestructorFwd { - buff: *mut T, + pub buff: *mut T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for ReplacedWithoutDestructorFwd { diff --git a/tests/expectations/tests/type_alias_partial_template_especialization.rs b/tests/expectations/tests/type_alias_partial_template_especialization.rs index 4c9cd87d1..a80f46b63 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; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Rooted { - ptr: MaybeWrapped, + pub ptr: MaybeWrapped, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Rooted { diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs index 6577ee34b..6155ff33d 100644 --- a/tests/expectations/tests/typeref.rs +++ b/tests/expectations/tests/typeref.rs @@ -77,7 +77,7 @@ impl Default for mozilla_StyleShapeSource { #[repr(C)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Bar { - mFoo: *mut nsFoo, + pub mFoo: *mut nsFoo, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs index 5fdd8668c..75b41960e 100644 --- a/tests/expectations/tests/typeref_1_0.rs +++ b/tests/expectations/tests/typeref_1_0.rs @@ -122,7 +122,7 @@ pub struct mozilla_StyleShapeSource__bindgen_ty_1 { #[repr(C)] #[derive(Debug, Copy, Hash, PartialEq, Eq)] pub struct Bar { - mFoo: *mut nsFoo, + pub mFoo: *mut nsFoo, } #[test] fn bindgen_test_layout_Bar() { diff --git a/tests/expectations/tests/using.rs b/tests/expectations/tests/using.rs index a67f42d1b..28b4308b3 100644 --- a/tests/expectations/tests/using.rs +++ b/tests/expectations/tests/using.rs @@ -8,8 +8,8 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Point { - x: T, - y: T, + pub x: T, + pub y: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for Point { diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs index a10f21fff..8283b6d54 100644 --- a/tests/expectations/tests/virtual_inheritance.rs +++ b/tests/expectations/tests/virtual_inheritance.rs @@ -8,7 +8,7 @@ #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct A { - foo: ::std::os::raw::c_int, + pub foo: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_A() { @@ -34,7 +34,7 @@ pub struct B__bindgen_vtable(::std::os::raw::c_void); #[derive(Debug, Copy, Clone)] pub struct B { pub vtable_: *const B__bindgen_vtable, - bar: ::std::os::raw::c_int, + pub bar: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_B() { @@ -65,7 +65,7 @@ pub struct C__bindgen_vtable(::std::os::raw::c_void); #[derive(Debug, Copy, Clone)] pub struct C { pub vtable_: *const C__bindgen_vtable, - baz: ::std::os::raw::c_int, + pub baz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_C() { @@ -95,7 +95,7 @@ impl Default for C { pub struct D { pub _base: C, pub _base_1: B, - bazz: ::std::os::raw::c_int, + pub bazz: ::std::os::raw::c_int, } #[test] fn bindgen_test_layout_D() { diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs index e3bf6d3d6..d25c802e3 100644 --- a/tests/expectations/tests/weird_bitfields.rs +++ b/tests/expectations/tests/weird_bitfields.rs @@ -101,22 +101,22 @@ pub enum nsStyleSVGOpacitySource { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct Weird { - mStrokeDasharrayLength: ::std::os::raw::c_uint, + pub mStrokeDasharrayLength: ::std::os::raw::c_uint, pub _bitfield_align_1: [u16; 0], - _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, - mClipRule: ::std::os::raw::c_uchar, - mColorInterpolation: ::std::os::raw::c_uchar, - mColorInterpolationFilters: ::std::os::raw::c_uchar, - mFillRule: ::std::os::raw::c_uchar, - mImageRendering: ::std::os::raw::c_uchar, - mPaintOrder: ::std::os::raw::c_uchar, - mShapeRendering: ::std::os::raw::c_uchar, - mStrokeLinecap: ::std::os::raw::c_uchar, - mStrokeLinejoin: ::std::os::raw::c_uchar, - mTextAnchor: ::std::os::raw::c_uchar, - mTextRendering: ::std::os::raw::c_uchar, + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, + pub mClipRule: ::std::os::raw::c_uchar, + pub mColorInterpolation: ::std::os::raw::c_uchar, + pub mColorInterpolationFilters: ::std::os::raw::c_uchar, + pub mFillRule: ::std::os::raw::c_uchar, + pub mImageRendering: ::std::os::raw::c_uchar, + pub mPaintOrder: ::std::os::raw::c_uchar, + pub mShapeRendering: ::std::os::raw::c_uchar, + pub mStrokeLinecap: ::std::os::raw::c_uchar, + pub mStrokeLinejoin: ::std::os::raw::c_uchar, + pub mTextAnchor: ::std::os::raw::c_uchar, + pub mTextRendering: ::std::os::raw::c_uchar, pub _bitfield_align_2: [u8; 0], - _bitfield_2: __BindgenBitfieldUnit<[u8; 2usize]>, + pub _bitfield_2: __BindgenBitfieldUnit<[u8; 2usize]>, pub __bindgen_padding_0: [u8; 3usize], } #[test] @@ -291,33 +291,33 @@ impl Default for Weird { } impl Weird { #[inline] - fn bitTest(&self) -> ::std::os::raw::c_uint { + pub fn bitTest(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } } #[inline] - fn set_bitTest(&mut self, val: ::std::os::raw::c_uint) { + pub fn set_bitTest(&mut self, val: ::std::os::raw::c_uint) { unsafe { let val: u32 = ::std::mem::transmute(val); self._bitfield_1.set(0usize, 16u8, val as u64) } } #[inline] - fn bitTest2(&self) -> ::std::os::raw::c_uint { + pub fn bitTest2(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 15u8) as u32) } } #[inline] - fn set_bitTest2(&mut self, val: ::std::os::raw::c_uint) { + pub fn set_bitTest2(&mut self, val: ::std::os::raw::c_uint) { unsafe { let val: u32 = ::std::mem::transmute(val); self._bitfield_1.set(16usize, 15u8, val as u64) } } #[inline] - fn new_bitfield_1( + pub fn new_bitfield_1( bitTest: ::std::os::raw::c_uint, bitTest2: ::std::os::raw::c_uint, ) -> __BindgenBitfieldUnit<[u8; 4usize]> { @@ -334,72 +334,72 @@ impl Weird { __bindgen_bitfield_unit } #[inline] - fn mFillOpacitySource(&self) -> nsStyleSVGOpacitySource { + pub fn mFillOpacitySource(&self) -> nsStyleSVGOpacitySource { unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 3u8) as u32) } } #[inline] - fn set_mFillOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { + pub fn set_mFillOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { unsafe { let val: u32 = ::std::mem::transmute(val); self._bitfield_2.set(0usize, 3u8, val as u64) } } #[inline] - fn mStrokeOpacitySource(&self) -> nsStyleSVGOpacitySource { + pub fn mStrokeOpacitySource(&self) -> nsStyleSVGOpacitySource { unsafe { ::std::mem::transmute(self._bitfield_2.get(3usize, 3u8) as u32) } } #[inline] - fn set_mStrokeOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { + pub fn set_mStrokeOpacitySource(&mut self, val: nsStyleSVGOpacitySource) { unsafe { let val: u32 = ::std::mem::transmute(val); self._bitfield_2.set(3usize, 3u8, val as u64) } } #[inline] - fn mStrokeDasharrayFromObject(&self) -> bool { + pub fn mStrokeDasharrayFromObject(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_2.get(6usize, 1u8) as u8) } } #[inline] - fn set_mStrokeDasharrayFromObject(&mut self, val: bool) { + pub fn set_mStrokeDasharrayFromObject(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_2.set(6usize, 1u8, val as u64) } } #[inline] - fn mStrokeDashoffsetFromObject(&self) -> bool { + pub fn mStrokeDashoffsetFromObject(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_2.get(7usize, 1u8) as u8) } } #[inline] - fn set_mStrokeDashoffsetFromObject(&mut self, val: bool) { + pub fn set_mStrokeDashoffsetFromObject(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_2.set(7usize, 1u8, val as u64) } } #[inline] - fn mStrokeWidthFromObject(&self) -> bool { + pub fn mStrokeWidthFromObject(&self) -> bool { unsafe { ::std::mem::transmute(self._bitfield_2.get(8usize, 1u8) as u8) } } #[inline] - fn set_mStrokeWidthFromObject(&mut self, val: bool) { + pub fn set_mStrokeWidthFromObject(&mut self, val: bool) { unsafe { let val: u8 = ::std::mem::transmute(val); self._bitfield_2.set(8usize, 1u8, val as u64) } } #[inline] - fn new_bitfield_2( + pub fn new_bitfield_2( mFillOpacitySource: nsStyleSVGOpacitySource, mStrokeOpacitySource: nsStyleSVGOpacitySource, mStrokeDasharrayFromObject: bool, diff --git a/tests/expectations/tests/whitelist_basic.rs b/tests/expectations/tests/whitelist_basic.rs index 5dfd115ca..7806923c7 100644 --- a/tests/expectations/tests/whitelist_basic.rs +++ b/tests/expectations/tests/whitelist_basic.rs @@ -8,14 +8,14 @@ #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct WhitelistMe { - foo: ::std::os::raw::c_int, - bar: WhitelistMe_Inner, + pub foo: ::std::os::raw::c_int, + pub bar: WhitelistMe_Inner, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct WhitelistMe_Inner { - bar: T, + pub bar: T, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell>, } impl Default for WhitelistMe_Inner { diff --git a/tests/expectations/tests/whitelisted-item-references-no-hash.rs b/tests/expectations/tests/whitelisted-item-references-no-hash.rs index ea9e7fdf6..e1217bc50 100644 --- a/tests/expectations/tests/whitelisted-item-references-no-hash.rs +++ b/tests/expectations/tests/whitelisted-item-references-no-hash.rs @@ -26,7 +26,7 @@ fn bindgen_test_layout_NoHash() { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct WhitelistMe { - a: NoHash, + pub a: NoHash, } #[test] fn bindgen_test_layout_WhitelistMe() { diff --git a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs index 2c017d6d5..2aabc1018 100644 --- a/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs +++ b/tests/expectations/tests/whitelisted-item-references-no-partialeq.rs @@ -26,7 +26,7 @@ fn bindgen_test_layout_NoPartialEq() { #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct WhitelistMe { - a: NoPartialEq, + pub a: NoPartialEq, } #[test] fn bindgen_test_layout_WhitelistMe() { diff --git a/tests/expectations/tests/whitelisted_item_references_no_copy.rs b/tests/expectations/tests/whitelisted_item_references_no_copy.rs index 3285d2f64..d13ede59e 100644 --- a/tests/expectations/tests/whitelisted_item_references_no_copy.rs +++ b/tests/expectations/tests/whitelisted_item_references_no_copy.rs @@ -26,7 +26,7 @@ fn bindgen_test_layout_NoCopy() { #[repr(C)] #[derive(Debug, Default)] pub struct WhitelistMe { - a: NoCopy, + pub a: NoCopy, } #[test] fn bindgen_test_layout_WhitelistMe() { diff --git a/tests/headers/private_fields.hpp b/tests/headers/private_fields.hpp index 14889097a..9d55ebcac 100644 --- a/tests/headers/private_fields.hpp +++ b/tests/headers/private_fields.hpp @@ -1,3 +1,4 @@ +// bindgen-flags: --respect-cxx-access-specs class PubPriv { public: int x; @@ -36,4 +37,8 @@ class WithAnonStruct { struct { int b; }; +}; + +class WithAnonUnion { + union {}; }; \ No newline at end of file