Skip to content

Commit 0d236d6

Browse files
committed
revert pub(crate) change
1 parent a39e990 commit 0d236d6

40 files changed

+636
-696
lines changed

bindgen/clang.rs

Lines changed: 155 additions & 155 deletions
Large diffs are not rendered by default.

bindgen/codegen/dyngen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use proc_macro2::Ident;
55

66
/// Used to build the output tokens for dynamic bindings.
77
#[derive(Default)]
8-
pub(crate) struct DynamicItems {
8+
pub struct DynamicItems {
99
/// Tracks the tokens that will appears inside the library struct -- e.g.:
1010
/// ```ignore
1111
/// struct Lib {
@@ -69,11 +69,11 @@ pub(crate) struct DynamicItems {
6969
}
7070

7171
impl DynamicItems {
72-
pub(crate) fn new() -> Self {
72+
pub fn new() -> Self {
7373
Self::default()
7474
}
7575

76-
pub(crate) fn get_tokens(
76+
pub fn get_tokens(
7777
&self,
7878
lib_ident: Ident,
7979
ctx: &BindgenContext,

bindgen/codegen/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33

44
/// Errors that can occur during code generation.
55
#[derive(Clone, Debug, PartialEq, Eq)]
6-
pub(crate) enum Error {
6+
pub enum Error {
77
/// Tried to generate an opaque blob for a type that did not have a layout.
88
NoLayoutForOpaqueBlob,
99

@@ -30,4 +30,4 @@ impl fmt::Display for Error {
3030
impl error::Error for Error {}
3131

3232
/// A `Result` of `T` or an error of `bindgen::codegen::error::Error`.
33-
pub(crate) type Result<T> = ::std::result::Result<T, Error>;
33+
pub type Result<T> = ::std::result::Result<T, Error>;

bindgen/codegen/helpers.rs

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ use crate::ir::layout::Layout;
55
use proc_macro2::{Ident, Span, TokenStream};
66
use quote::TokenStreamExt;
77

8-
pub(crate) mod attributes {
8+
pub mod attributes {
99
use proc_macro2::{Ident, Span, TokenStream};
1010
use std::str::FromStr;
1111

12-
pub(crate) fn repr(which: &str) -> TokenStream {
12+
pub fn repr(which: &str) -> TokenStream {
1313
let which = Ident::new(which, Span::call_site());
1414
quote! {
1515
#[repr( #which )]
1616
}
1717
}
1818

19-
pub(crate) fn repr_list(which_ones: &[&str]) -> TokenStream {
19+
pub fn repr_list(which_ones: &[&str]) -> TokenStream {
2020
let which_ones = which_ones
2121
.iter()
2222
.cloned()
@@ -26,7 +26,7 @@ pub(crate) mod attributes {
2626
}
2727
}
2828

29-
pub(crate) fn derives(which_ones: &[&str]) -> TokenStream {
29+
pub fn derives(which_ones: &[&str]) -> TokenStream {
3030
let which_ones = which_ones
3131
.iter()
3232
.cloned()
@@ -36,33 +36,33 @@ pub(crate) mod attributes {
3636
}
3737
}
3838

39-
pub(crate) fn inline() -> TokenStream {
39+
pub fn inline() -> TokenStream {
4040
quote! {
4141
#[inline]
4242
}
4343
}
4444

45-
pub(crate) fn must_use() -> TokenStream {
45+
pub fn must_use() -> TokenStream {
4646
quote! {
4747
#[must_use]
4848
}
4949
}
5050

51-
pub(crate) fn non_exhaustive() -> TokenStream {
51+
pub fn non_exhaustive() -> TokenStream {
5252
quote! {
5353
#[non_exhaustive]
5454
}
5555
}
5656

57-
pub(crate) fn doc(comment: String) -> TokenStream {
57+
pub fn doc(comment: String) -> TokenStream {
5858
if comment.is_empty() {
5959
quote!()
6060
} else {
6161
quote!(#[doc = #comment])
6262
}
6363
}
6464

65-
pub(crate) fn link_name(name: &str) -> TokenStream {
65+
pub fn link_name(name: &str) -> TokenStream {
6666
// LLVM mangles the name by default but it's already mangled.
6767
// Prefixing the name with \u{1} should tell LLVM to not mangle it.
6868
let name = format!("\u{1}{}", name);
@@ -74,7 +74,7 @@ pub(crate) mod attributes {
7474

7575
/// Generates a proper type for a field or type with a given `Layout`, that is,
7676
/// a type with the correct size and alignment restrictions.
77-
pub(crate) fn blob(ctx: &BindgenContext, layout: Layout) -> TokenStream {
77+
pub fn blob(ctx: &BindgenContext, layout: Layout) -> TokenStream {
7878
let opaque = layout.opaque();
7979

8080
// FIXME(emilio, #412): We fall back to byte alignment, but there are
@@ -105,7 +105,7 @@ pub(crate) fn blob(ctx: &BindgenContext, layout: Layout) -> TokenStream {
105105
}
106106

107107
/// Integer type of the same size as the given `Layout`.
108-
pub(crate) fn integer_type(
108+
pub fn integer_type(
109109
ctx: &BindgenContext,
110110
layout: Layout,
111111
) -> Option<TokenStream> {
@@ -115,10 +115,7 @@ pub(crate) fn integer_type(
115115
}
116116

117117
/// Generates a bitfield allocation unit type for a type with the given `Layout`.
118-
pub(crate) fn bitfield_unit(
119-
ctx: &BindgenContext,
120-
layout: Layout,
121-
) -> TokenStream {
118+
pub fn bitfield_unit(ctx: &BindgenContext, layout: Layout) -> TokenStream {
122119
let mut tokens = quote! {};
123120

124121
if ctx.options().enable_cxx_namespaces {
@@ -133,15 +130,15 @@ pub(crate) fn bitfield_unit(
133130
tokens
134131
}
135132

136-
pub(crate) mod ast_ty {
133+
pub mod ast_ty {
137134
use crate::ir::context::BindgenContext;
138135
use crate::ir::function::FunctionSig;
139136
use crate::ir::layout::Layout;
140137
use crate::ir::ty::FloatKind;
141138
use proc_macro2::{self, TokenStream};
142139
use std::str::FromStr;
143140

144-
pub(crate) fn c_void(ctx: &BindgenContext) -> TokenStream {
141+
pub fn c_void(ctx: &BindgenContext) -> TokenStream {
145142
// ctypes_prefix takes precedence
146143
match ctx.options().ctypes_prefix {
147144
Some(ref prefix) => {
@@ -162,7 +159,7 @@ pub(crate) mod ast_ty {
162159
}
163160
}
164161

165-
pub(crate) fn raw_type(ctx: &BindgenContext, name: &str) -> TokenStream {
162+
pub fn raw_type(ctx: &BindgenContext, name: &str) -> TokenStream {
166163
let ident = ctx.rust_ident_raw(name);
167164
match ctx.options().ctypes_prefix {
168165
Some(ref prefix) => {
@@ -187,7 +184,7 @@ pub(crate) mod ast_ty {
187184
}
188185
}
189186

190-
pub(crate) fn float_kind_rust_type(
187+
pub fn float_kind_rust_type(
191188
ctx: &BindgenContext,
192189
fk: FloatKind,
193190
layout: Option<Layout>,
@@ -232,36 +229,33 @@ pub(crate) mod ast_ty {
232229
}
233230
}
234231

235-
pub(crate) fn int_expr(val: i64) -> TokenStream {
232+
pub fn int_expr(val: i64) -> TokenStream {
236233
// Don't use quote! { #val } because that adds the type suffix.
237234
let val = proc_macro2::Literal::i64_unsuffixed(val);
238235
quote!(#val)
239236
}
240237

241-
pub(crate) fn uint_expr(val: u64) -> TokenStream {
238+
pub fn uint_expr(val: u64) -> TokenStream {
242239
// Don't use quote! { #val } because that adds the type suffix.
243240
let val = proc_macro2::Literal::u64_unsuffixed(val);
244241
quote!(#val)
245242
}
246243

247-
pub(crate) fn byte_array_expr(bytes: &[u8]) -> TokenStream {
244+
pub fn byte_array_expr(bytes: &[u8]) -> TokenStream {
248245
let mut bytes: Vec<_> = bytes.to_vec();
249246
bytes.push(0);
250247
quote! { [ #(#bytes),* ] }
251248
}
252249

253-
pub(crate) fn cstr_expr(mut string: String) -> TokenStream {
250+
pub fn cstr_expr(mut string: String) -> TokenStream {
254251
string.push('\0');
255252
let b = proc_macro2::Literal::byte_string(string.as_bytes());
256253
quote! {
257254
#b
258255
}
259256
}
260257

261-
pub(crate) fn float_expr(
262-
ctx: &BindgenContext,
263-
f: f64,
264-
) -> Result<TokenStream, ()> {
258+
pub fn float_expr(ctx: &BindgenContext, f: f64) -> Result<TokenStream, ()> {
265259
if f.is_finite() {
266260
let val = proc_macro2::Literal::f64_unsuffixed(f);
267261

@@ -292,7 +286,7 @@ pub(crate) mod ast_ty {
292286
Err(())
293287
}
294288

295-
pub(crate) fn arguments_from_signature(
289+
pub fn arguments_from_signature(
296290
signature: &FunctionSig,
297291
ctx: &BindgenContext,
298292
) -> Vec<TokenStream> {

bindgen/codegen/impl_debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::ir::context::BindgenContext;
33
use crate::ir::item::{HasTypeParamInArray, IsOpaque, Item, ItemCanonicalName};
44
use crate::ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
55

6-
pub(crate) fn gen_debug_impl(
6+
pub fn gen_debug_impl(
77
ctx: &BindgenContext,
88
fields: &[Field],
99
item: &Item,
@@ -51,7 +51,7 @@ pub(crate) fn gen_debug_impl(
5151

5252
/// A trait for the things which we can codegen tokens that contribute towards a
5353
/// generated `impl Debug`.
54-
pub(crate) trait ImplDebug<'a> {
54+
pub trait ImplDebug<'a> {
5555
/// Any extra parameter required by this a particular `ImplDebug` implementation.
5656
type Extra;
5757

bindgen/codegen/impl_partialeq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
55

66
/// Generate a manual implementation of `PartialEq` trait for the
77
/// specified compound type.
8-
pub(crate) fn gen_partialeq_impl(
8+
pub fn gen_partialeq_impl(
99
ctx: &BindgenContext,
1010
comp_info: &CompInfo,
1111
item: &Item,

0 commit comments

Comments
 (0)