Skip to content

Commit 30d6f63

Browse files
committed
Adjust some pubs.
1 parent 8dc84fa commit 30d6f63

32 files changed

+81
-81
lines changed

compiler/rustc_builtin_macros/src/alloc_error_handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::symbol::{kw, sym, Ident};
99
use rustc_span::Span;
1010
use thin_vec::{thin_vec, ThinVec};
1111

12-
pub fn expand(
12+
pub(crate) fn expand(
1313
ecx: &mut ExtCtxt<'_>,
1414
_span: Span,
1515
meta_item: &ast::MetaItem,

compiler/rustc_builtin_macros/src/assert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_span::symbol::{sym, Ident, Symbol};
1515
use rustc_span::{Span, DUMMY_SP};
1616
use thin_vec::thin_vec;
1717

18-
pub fn expand_assert<'cx>(
18+
pub(crate) fn expand_assert<'cx>(
1919
cx: &'cx mut ExtCtxt<'_>,
2020
span: Span,
2121
tts: TokenStream,

compiler/rustc_builtin_macros/src/cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_errors::PResult;
1111
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
1212
use rustc_span::Span;
1313

14-
pub fn expand_cfg(
14+
pub(crate) fn expand_cfg(
1515
cx: &mut ExtCtxt<'_>,
1616
sp: Span,
1717
tts: TokenStream,

compiler/rustc_builtin_macros/src/compile_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_ast::tokenstream::TokenStream;
55
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
66
use rustc_span::Span;
77

8-
pub fn expand_compile_error<'cx>(
8+
pub(crate) fn expand_compile_error<'cx>(
99
cx: &'cx mut ExtCtxt<'_>,
1010
sp: Span,
1111
tts: TokenStream,

compiler/rustc_builtin_macros/src/concat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpa
66
use rustc_session::errors::report_lit_error;
77
use rustc_span::symbol::Symbol;
88

9-
pub fn expand_concat(
9+
pub(crate) fn expand_concat(
1010
cx: &mut ExtCtxt<'_>,
1111
sp: rustc_span::Span,
1212
tts: TokenStream,

compiler/rustc_builtin_macros/src/concat_bytes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn handle_array_element(
107107
None
108108
}
109109

110-
pub fn expand_concat_bytes(
110+
pub(crate) fn expand_concat_bytes(
111111
cx: &mut ExtCtxt<'_>,
112112
sp: Span,
113113
tts: TokenStream,

compiler/rustc_builtin_macros/src/concat_idents.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::Span;
88

99
use crate::errors;
1010

11-
pub fn expand_concat_idents<'cx>(
11+
pub(crate) fn expand_concat_idents<'cx>(
1212
cx: &'cx mut ExtCtxt<'_>,
1313
sp: Span,
1414
tts: TokenStream,

compiler/rustc_builtin_macros/src/deriving/bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_ast::MetaItem;
55
use rustc_expand::base::{Annotatable, ExtCtxt};
66
use rustc_span::Span;
77

8-
pub fn expand_deriving_copy(
8+
pub(crate) fn expand_deriving_copy(
99
cx: &ExtCtxt<'_>,
1010
span: Span,
1111
mitem: &MetaItem,
@@ -28,7 +28,7 @@ pub fn expand_deriving_copy(
2828
trait_def.expand(cx, mitem, item, push);
2929
}
3030

31-
pub fn expand_deriving_const_param_ty(
31+
pub(crate) fn expand_deriving_const_param_ty(
3232
cx: &ExtCtxt<'_>,
3333
span: Span,
3434
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::symbol::{kw, sym, Ident};
88
use rustc_span::Span;
99
use thin_vec::{thin_vec, ThinVec};
1010

11-
pub fn expand_deriving_clone(
11+
pub(crate) fn expand_deriving_clone(
1212
cx: &ExtCtxt<'_>,
1313
span: Span,
1414
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::symbol::sym;
99
use rustc_span::Span;
1010
use thin_vec::{thin_vec, ThinVec};
1111

12-
pub fn expand_deriving_eq(
12+
pub(crate) fn expand_deriving_eq(
1313
cx: &ExtCtxt<'_>,
1414
span: Span,
1515
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::symbol::{sym, Ident};
77
use rustc_span::Span;
88
use thin_vec::thin_vec;
99

10-
pub fn expand_deriving_ord(
10+
pub(crate) fn expand_deriving_ord(
1111
cx: &ExtCtxt<'_>,
1212
span: Span,
1313
mitem: &MetaItem,
@@ -39,7 +39,7 @@ pub fn expand_deriving_ord(
3939
trait_def.expand(cx, mitem, item, push)
4040
}
4141

42-
pub fn cs_cmp(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
42+
pub(crate) fn cs_cmp(cx: &ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> BlockOrExpr {
4343
let test_id = Ident::new(sym::cmp, span);
4444
let equal_path = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal]));
4545
let cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]);

compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::symbol::sym;
88
use rustc_span::Span;
99
use thin_vec::thin_vec;
1010

11-
pub fn expand_deriving_partial_eq(
11+
pub(crate) fn expand_deriving_partial_eq(
1212
cx: &ExtCtxt<'_>,
1313
span: Span,
1414
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::symbol::{sym, Ident};
77
use rustc_span::Span;
88
use thin_vec::thin_vec;
99

10-
pub fn expand_deriving_partial_ord(
10+
pub(crate) fn expand_deriving_partial_ord(
1111
cx: &ExtCtxt<'_>,
1212
span: Span,
1313
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::symbol::{sym, Ident, Symbol};
88
use rustc_span::Span;
99
use thin_vec::{thin_vec, ThinVec};
1010

11-
pub fn expand_deriving_debug(
11+
pub(crate) fn expand_deriving_debug(
1212
cx: &ExtCtxt<'_>,
1313
span: Span,
1414
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/decodable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_span::symbol::{sym, Ident, Symbol};
1010
use rustc_span::Span;
1111
use thin_vec::{thin_vec, ThinVec};
1212

13-
pub fn expand_deriving_rustc_decodable(
13+
pub(crate) fn expand_deriving_rustc_decodable(
1414
cx: &ExtCtxt<'_>,
1515
span: Span,
1616
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_span::{ErrorGuaranteed, Span};
1212
use smallvec::SmallVec;
1313
use thin_vec::{thin_vec, ThinVec};
1414

15-
pub fn expand_deriving_default(
15+
pub(crate) fn expand_deriving_default(
1616
cx: &ExtCtxt<'_>,
1717
span: Span,
1818
mitem: &ast::MetaItem,

compiler/rustc_builtin_macros/src/deriving/encodable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use rustc_span::symbol::{sym, Ident, Symbol};
9494
use rustc_span::Span;
9595
use thin_vec::{thin_vec, ThinVec};
9696

97-
pub fn expand_deriving_rustc_encodable(
97+
pub(crate) fn expand_deriving_rustc_encodable(
9898
cx: &ExtCtxt<'_>,
9999
span: Span,
100100
mitem: &MetaItem,

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@
174174
//! )
175175
//! ```
176176
177-
pub use StaticFields::*;
178-
pub use SubstructureFields::*;
177+
pub(crate) use StaticFields::*;
178+
pub(crate) use SubstructureFields::*;
179179

180180
use crate::{deriving, errors};
181181
use rustc_ast::ptr::P;
@@ -195,9 +195,9 @@ use std::vec;
195195
use thin_vec::{thin_vec, ThinVec};
196196
use ty::{Bounds, Path, Ref, Self_, Ty};
197197

198-
pub mod ty;
198+
pub(crate) mod ty;
199199

200-
pub struct TraitDef<'a> {
200+
pub(crate) struct TraitDef<'a> {
201201
/// The span for the current #[derive(Foo)] header.
202202
pub span: Span,
203203

@@ -224,7 +224,7 @@ pub struct TraitDef<'a> {
224224
pub is_const: bool,
225225
}
226226

227-
pub struct MethodDef<'a> {
227+
pub(crate) struct MethodDef<'a> {
228228
/// name of the method
229229
pub name: Symbol,
230230
/// List of generics, e.g., `R: rand::Rng`
@@ -248,7 +248,7 @@ pub struct MethodDef<'a> {
248248

249249
/// How to handle fieldless enum variants.
250250
#[derive(PartialEq)]
251-
pub enum FieldlessVariantsStrategy {
251+
pub(crate) enum FieldlessVariantsStrategy {
252252
/// Combine fieldless variants into a single match arm.
253253
/// This assumes that relevant information has been handled
254254
/// by looking at the enum's discriminant.
@@ -263,7 +263,7 @@ pub enum FieldlessVariantsStrategy {
263263
}
264264

265265
/// All the data about the data structure/method being derived upon.
266-
pub struct Substructure<'a> {
266+
pub(crate) struct Substructure<'a> {
267267
/// ident of self
268268
pub type_ident: Ident,
269269
/// Verbatim access to any non-selflike arguments, i.e. arguments that
@@ -273,7 +273,7 @@ pub struct Substructure<'a> {
273273
}
274274

275275
/// Summary of the relevant parts of a struct/enum field.
276-
pub struct FieldInfo {
276+
pub(crate) struct FieldInfo {
277277
pub span: Span,
278278
/// None for tuple structs/normal enum variants, Some for normal
279279
/// structs/struct enum variants.
@@ -287,21 +287,21 @@ pub struct FieldInfo {
287287
}
288288

289289
#[derive(Copy, Clone)]
290-
pub enum IsTuple {
290+
pub(crate) enum IsTuple {
291291
No,
292292
Yes,
293293
}
294294

295295
/// Fields for a static method
296-
pub enum StaticFields {
296+
pub(crate) enum StaticFields {
297297
/// Tuple and unit structs/enum variants like this.
298298
Unnamed(Vec<Span>, IsTuple),
299299
/// Normal structs/struct variants.
300300
Named(Vec<(Ident, Span)>),
301301
}
302302

303303
/// A summary of the possible sets of fields.
304-
pub enum SubstructureFields<'a> {
304+
pub(crate) enum SubstructureFields<'a> {
305305
/// A non-static method where `Self` is a struct.
306306
Struct(&'a ast::VariantData, Vec<FieldInfo>),
307307

@@ -329,10 +329,10 @@ pub enum SubstructureFields<'a> {
329329

330330
/// Combine the values of all the fields together. The last argument is
331331
/// all the fields of all the structures.
332-
pub type CombineSubstructureFunc<'a> =
332+
pub(crate) type CombineSubstructureFunc<'a> =
333333
Box<dyn FnMut(&ExtCtxt<'_>, Span, &Substructure<'_>) -> BlockOrExpr + 'a>;
334334

335-
pub fn combine_substructure(
335+
pub(crate) fn combine_substructure(
336336
f: CombineSubstructureFunc<'_>,
337337
) -> RefCell<CombineSubstructureFunc<'_>> {
338338
RefCell::new(f)
@@ -349,7 +349,7 @@ struct TypeParameter {
349349
/// avoiding the insertion of any unnecessary blocks.
350350
///
351351
/// The statements come before the expression.
352-
pub struct BlockOrExpr(ThinVec<ast::Stmt>, Option<P<Expr>>);
352+
pub(crate) struct BlockOrExpr(ThinVec<ast::Stmt>, Option<P<Expr>>);
353353

354354
impl BlockOrExpr {
355355
pub fn new_stmts(stmts: ThinVec<ast::Stmt>) -> BlockOrExpr {
@@ -1647,7 +1647,7 @@ impl<'a> TraitDef<'a> {
16471647
/// The function passed to `cs_fold` is called repeatedly with a value of this
16481648
/// type. It describes one part of the code generation. The result is always an
16491649
/// expression.
1650-
pub enum CsFold<'a> {
1650+
pub(crate) enum CsFold<'a> {
16511651
/// The basic case: a field expression for one or more selflike args. E.g.
16521652
/// for `PartialEq::eq` this is something like `self.x == other.x`.
16531653
Single(&'a FieldInfo),
@@ -1662,7 +1662,7 @@ pub enum CsFold<'a> {
16621662

16631663
/// Folds over fields, combining the expressions for each field in a sequence.
16641664
/// Statics may not be folded over.
1665-
pub fn cs_fold<F>(
1665+
pub(crate) fn cs_fold<F>(
16661666
use_foldl: bool,
16671667
cx: &ExtCtxt<'_>,
16681668
trait_span: Span,

compiler/rustc_builtin_macros/src/deriving/generic/ty.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A mini version of ast::Ty, which is easier to use, and features an explicit `Self` type to use
22
//! when specifying impls to be derived.
33
4-
pub use Ty::*;
4+
pub(crate) use Ty::*;
55

66
use rustc_ast::ptr::P;
77
use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind};
@@ -14,14 +14,14 @@ use thin_vec::ThinVec;
1414
/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
1515
/// for type parameters.
1616
#[derive(Clone)]
17-
pub struct Path {
17+
pub(crate) struct Path {
1818
path: Vec<Symbol>,
1919
params: Vec<Box<Ty>>,
2020
kind: PathKind,
2121
}
2222

2323
#[derive(Clone)]
24-
pub enum PathKind {
24+
pub(crate) enum PathKind {
2525
Local,
2626
Global,
2727
Std,
@@ -72,7 +72,7 @@ impl Path {
7272

7373
/// A type. Supports pointers, Self, and literals.
7474
#[derive(Clone)]
75-
pub enum Ty {
75+
pub(crate) enum Ty {
7676
Self_,
7777
/// A reference.
7878
Ref(Box<Ty>, ast::Mutability),
@@ -83,7 +83,7 @@ pub enum Ty {
8383
Unit,
8484
}
8585

86-
pub fn self_ref() -> Ty {
86+
pub(crate) fn self_ref() -> Ty {
8787
Ref(Box::new(Self_), ast::Mutability::Not)
8888
}
8989

@@ -163,7 +163,7 @@ fn mk_ty_param(
163163

164164
/// Bounds on type parameters.
165165
#[derive(Clone)]
166-
pub struct Bounds {
166+
pub(crate) struct Bounds {
167167
pub bounds: Vec<(Symbol, Vec<Path>)>,
168168
}
169169

@@ -196,7 +196,7 @@ impl Bounds {
196196
}
197197
}
198198

199-
pub fn get_explicit_self(cx: &ExtCtxt<'_>, span: Span) -> (P<Expr>, ast::ExplicitSelf) {
199+
pub(crate) fn get_explicit_self(cx: &ExtCtxt<'_>, span: Span) -> (P<Expr>, ast::ExplicitSelf) {
200200
// This constructs a fresh `self` path.
201201
let self_path = cx.expr_self(span);
202202
let self_ty = respan(span, SelfKind::Region(None, ast::Mutability::Not));

compiler/rustc_builtin_macros/src/deriving/hash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::symbol::sym;
77
use rustc_span::Span;
88
use thin_vec::thin_vec;
99

10-
pub fn expand_deriving_hash(
10+
pub(crate) fn expand_deriving_hash(
1111
cx: &ExtCtxt<'_>,
1212
span: Span,
1313
mitem: &MetaItem,

0 commit comments

Comments
 (0)