Skip to content

Commit 49c82f3

Browse files
committed
Remove crate visibility usage in compiler
1 parent 536020c commit 49c82f3

File tree

186 files changed

+865
-800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+865
-800
lines changed

compiler/rustc_ast/src/attr/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub fn mk_nested_word_item(ident: Ident) -> NestedMetaItem {
340340
NestedMetaItem::MetaItem(mk_word_item(ident))
341341
}
342342

343-
crate fn mk_attr_id() -> AttrId {
343+
pub(crate) fn mk_attr_id() -> AttrId {
344344
use std::sync::atomic::AtomicU32;
345345
use std::sync::atomic::Ordering;
346346

compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![feature(box_patterns)]
1313
#![feature(const_default_impls)]
1414
#![feature(const_trait_impl)]
15-
#![feature(crate_visibility_modifier)]
1615
#![feature(if_let_guard)]
1716
#![feature(label_break_value)]
1817
#![feature(let_chains)]

compiler/rustc_ast/src/token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl LitKind {
134134
}
135135
}
136136

137-
crate fn may_have_suffix(self) -> bool {
137+
pub(crate) fn may_have_suffix(self) -> bool {
138138
matches!(self, Integer | Float | Err)
139139
}
140140
}

compiler/rustc_ast_lowering/src/asm.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ use std::collections::hash_map::Entry;
1717
use std::fmt::Write;
1818

1919
impl<'a, 'hir> LoweringContext<'a, 'hir> {
20-
crate fn lower_inline_asm(&mut self, sp: Span, asm: &InlineAsm) -> &'hir hir::InlineAsm<'hir> {
20+
pub(crate) fn lower_inline_asm(
21+
&mut self,
22+
sp: Span,
23+
asm: &InlineAsm,
24+
) -> &'hir hir::InlineAsm<'hir> {
2125
// Rustdoc needs to support asm! from foreign architectures: don't try
2226
// lowering the register constraints in this case.
2327
let asm_arch = if self.sess.opts.actually_rustdoc { None } else { self.sess.asm_arch };

compiler/rustc_ast_lowering/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
848848
}
849849

850850
/// Construct `ExprKind::Err` for the given `span`.
851-
crate fn expr_err(&mut self, span: Span) -> hir::Expr<'hir> {
851+
pub(crate) fn expr_err(&mut self, span: Span) -> hir::Expr<'hir> {
852852
self.expr(span, hir::ExprKind::Err, AttrVec::new())
853853
}
854854

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
//! get confused if the spans from leaf AST nodes occur in multiple places
3131
//! in the HIR, especially for multiple identifiers.
3232
33-
#![feature(crate_visibility_modifier)]
3433
#![feature(box_patterns)]
3534
#![feature(let_chains)]
3635
#![feature(let_else)]

compiler/rustc_ast_lowering/src/pat.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use rustc_span::symbol::Ident;
1212
use rustc_span::{source_map::Spanned, Span};
1313

1414
impl<'a, 'hir> LoweringContext<'a, 'hir> {
15-
crate fn lower_pat(&mut self, pattern: &Pat) -> &'hir hir::Pat<'hir> {
15+
pub(crate) fn lower_pat(&mut self, pattern: &Pat) -> &'hir hir::Pat<'hir> {
1616
self.arena.alloc(self.lower_pat_mut(pattern))
1717
}
1818

19-
crate fn lower_pat_mut(&mut self, mut pattern: &Pat) -> hir::Pat<'hir> {
19+
pub(crate) fn lower_pat_mut(&mut self, mut pattern: &Pat) -> hir::Pat<'hir> {
2020
ensure_sufficient_stack(|| {
2121
// loop here to avoid recursion
2222
let node = loop {
@@ -290,7 +290,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
290290
}
291291

292292
/// Emit a friendly error for extra `..` patterns in a tuple/tuple struct/slice pattern.
293-
crate fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str) {
293+
pub(crate) fn ban_extra_rest_pat(&self, sp: Span, prev_sp: Span, ctx: &str) {
294294
self.diagnostic()
295295
.struct_span_err(sp, &format!("`..` can only be used once per {} pattern", ctx))
296296
.span_label(sp, &format!("can only be used once per {} pattern", ctx))

compiler/rustc_ast_lowering/src/path.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use smallvec::smallvec;
1515
use tracing::debug;
1616

1717
impl<'a, 'hir> LoweringContext<'a, 'hir> {
18-
crate fn lower_qpath(
18+
pub(crate) fn lower_qpath(
1919
&mut self,
2020
id: NodeId,
2121
qself: &Option<QSelf>,
@@ -142,7 +142,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
142142
);
143143
}
144144

145-
crate fn lower_path_extra(
145+
pub(crate) fn lower_path_extra(
146146
&mut self,
147147
res: Res,
148148
p: &Path,
@@ -163,7 +163,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
163163
})
164164
}
165165

166-
crate fn lower_path(
166+
pub(crate) fn lower_path(
167167
&mut self,
168168
id: NodeId,
169169
p: &Path,
@@ -174,7 +174,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
174174
self.lower_path_extra(res, p, param_mode)
175175
}
176176

177-
crate fn lower_path_segment(
177+
pub(crate) fn lower_path_segment(
178178
&mut self,
179179
path_span: Span,
180180
segment: &PathSegment,
@@ -381,7 +381,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
381381
}
382382

383383
/// An associated type binding `Output = $ty`.
384-
crate fn output_ty_binding(
384+
pub(crate) fn output_ty_binding(
385385
&mut self,
386386
span: Span,
387387
ty: &'hir hir::Ty<'hir>,

compiler/rustc_ast_pretty/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(associated_type_bounds)]
2-
#![feature(crate_visibility_modifier)]
32
#![feature(box_patterns)]
43
#![feature(with_negative_coherence)]
54
#![recursion_limit = "256"]

compiler/rustc_ast_pretty/src/pprust/state.rs

+31-26
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub struct State<'a> {
9595
ann: &'a (dyn PpAnn + 'a),
9696
}
9797

98-
crate const INDENT_UNIT: isize = 4;
98+
pub(crate) const INDENT_UNIT: isize = 4;
9999

100100
/// Requires you to pass an input filename and reader so that
101101
/// it can scan the input text for comments to copy forward.
@@ -955,8 +955,13 @@ impl<'a> State<'a> {
955955
State { s: pp::Printer::new(), comments: None, ann: &NoAnn }
956956
}
957957

958-
crate fn commasep_cmnt<T, F, G>(&mut self, b: Breaks, elts: &[T], mut op: F, mut get_span: G)
959-
where
958+
pub(crate) fn commasep_cmnt<T, F, G>(
959+
&mut self,
960+
b: Breaks,
961+
elts: &[T],
962+
mut op: F,
963+
mut get_span: G,
964+
) where
960965
F: FnMut(&mut State<'_>, &T),
961966
G: FnMut(&T) -> rustc_span::Span,
962967
{
@@ -976,7 +981,7 @@ impl<'a> State<'a> {
976981
self.end();
977982
}
978983

979-
crate fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<ast::Expr>]) {
984+
pub(crate) fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<ast::Expr>]) {
980985
self.commasep_cmnt(b, exprs, |s, e| s.print_expr(e), |e| e.span)
981986
}
982987

@@ -1109,7 +1114,7 @@ impl<'a> State<'a> {
11091114
self.print_trait_ref(&t.trait_ref)
11101115
}
11111116

1112-
crate fn print_stmt(&mut self, st: &ast::Stmt) {
1117+
pub(crate) fn print_stmt(&mut self, st: &ast::Stmt) {
11131118
self.maybe_print_comment(st.span.lo());
11141119
match st.kind {
11151120
ast::StmtKind::Local(ref loc) => {
@@ -1164,19 +1169,19 @@ impl<'a> State<'a> {
11641169
self.maybe_print_trailing_comment(st.span, None)
11651170
}
11661171

1167-
crate fn print_block(&mut self, blk: &ast::Block) {
1172+
pub(crate) fn print_block(&mut self, blk: &ast::Block) {
11681173
self.print_block_with_attrs(blk, &[])
11691174
}
11701175

1171-
crate fn print_block_unclosed_indent(&mut self, blk: &ast::Block) {
1176+
pub(crate) fn print_block_unclosed_indent(&mut self, blk: &ast::Block) {
11721177
self.print_block_maybe_unclosed(blk, &[], false)
11731178
}
11741179

1175-
crate fn print_block_with_attrs(&mut self, blk: &ast::Block, attrs: &[ast::Attribute]) {
1180+
pub(crate) fn print_block_with_attrs(&mut self, blk: &ast::Block, attrs: &[ast::Attribute]) {
11761181
self.print_block_maybe_unclosed(blk, attrs, true)
11771182
}
11781183

1179-
crate fn print_block_maybe_unclosed(
1184+
pub(crate) fn print_block_maybe_unclosed(
11801185
&mut self,
11811186
blk: &ast::Block,
11821187
attrs: &[ast::Attribute],
@@ -1210,7 +1215,7 @@ impl<'a> State<'a> {
12101215
}
12111216

12121217
/// Print a `let pat = expr` expression.
1213-
crate fn print_let(&mut self, pat: &ast::Pat, expr: &ast::Expr) {
1218+
pub(crate) fn print_let(&mut self, pat: &ast::Pat, expr: &ast::Expr) {
12141219
self.word("let ");
12151220
self.print_pat(pat);
12161221
self.space();
@@ -1219,7 +1224,7 @@ impl<'a> State<'a> {
12191224
self.print_expr_cond_paren(expr, Self::cond_needs_par(expr) || npals())
12201225
}
12211226

1222-
crate fn print_mac(&mut self, m: &ast::MacCall) {
1227+
pub(crate) fn print_mac(&mut self, m: &ast::MacCall) {
12231228
self.print_mac_common(
12241229
Some(MacHeader::Path(&m.path)),
12251230
true,
@@ -1360,15 +1365,15 @@ impl<'a> State<'a> {
13601365
self.pclose();
13611366
}
13621367

1363-
crate fn print_local_decl(&mut self, loc: &ast::Local) {
1368+
pub(crate) fn print_local_decl(&mut self, loc: &ast::Local) {
13641369
self.print_pat(&loc.pat);
13651370
if let Some(ref ty) = loc.ty {
13661371
self.word_space(":");
13671372
self.print_type(ty);
13681373
}
13691374
}
13701375

1371-
crate fn print_name(&mut self, name: Symbol) {
1376+
pub(crate) fn print_name(&mut self, name: Symbol) {
13721377
self.word(name.to_string());
13731378
self.ann.post(self, AnnNode::Name(&name))
13741379
}
@@ -1392,7 +1397,7 @@ impl<'a> State<'a> {
13921397
}
13931398
}
13941399

1395-
crate fn print_pat(&mut self, pat: &ast::Pat) {
1400+
pub(crate) fn print_pat(&mut self, pat: &ast::Pat) {
13961401
self.maybe_print_comment(pat.span.lo());
13971402
self.ann.pre(self, AnnNode::Pat(pat));
13981403
/* Pat isn't normalized, but the beauty of it
@@ -1551,7 +1556,7 @@ impl<'a> State<'a> {
15511556
}
15521557
}
15531558

1554-
crate fn print_asyncness(&mut self, asyncness: ast::Async) {
1559+
pub(crate) fn print_asyncness(&mut self, asyncness: ast::Async) {
15551560
if asyncness.is_async() {
15561561
self.word_nbsp("async");
15571562
}
@@ -1584,11 +1589,11 @@ impl<'a> State<'a> {
15841589
}
15851590
}
15861591

1587-
crate fn print_lifetime(&mut self, lifetime: ast::Lifetime) {
1592+
pub(crate) fn print_lifetime(&mut self, lifetime: ast::Lifetime) {
15881593
self.print_name(lifetime.ident.name)
15891594
}
15901595

1591-
crate fn print_lifetime_bounds(
1596+
pub(crate) fn print_lifetime_bounds(
15921597
&mut self,
15931598
lifetime: ast::Lifetime,
15941599
bounds: &ast::GenericBounds,
@@ -1608,7 +1613,7 @@ impl<'a> State<'a> {
16081613
}
16091614
}
16101615

1611-
crate fn print_generic_params(&mut self, generic_params: &[ast::GenericParam]) {
1616+
pub(crate) fn print_generic_params(&mut self, generic_params: &[ast::GenericParam]) {
16121617
if generic_params.is_empty() {
16131618
return;
16141619
}
@@ -1662,12 +1667,12 @@ impl<'a> State<'a> {
16621667
}
16631668
}
16641669

1665-
crate fn print_mt(&mut self, mt: &ast::MutTy, print_const: bool) {
1670+
pub(crate) fn print_mt(&mut self, mt: &ast::MutTy, print_const: bool) {
16661671
self.print_mutability(mt.mutbl, print_const);
16671672
self.print_type(&mt.ty)
16681673
}
16691674

1670-
crate fn print_param(&mut self, input: &ast::Param, is_closure: bool) {
1675+
pub(crate) fn print_param(&mut self, input: &ast::Param, is_closure: bool) {
16711676
self.ibox(INDENT_UNIT);
16721677

16731678
self.print_outer_attributes_inline(&input.attrs);
@@ -1695,7 +1700,7 @@ impl<'a> State<'a> {
16951700
self.end();
16961701
}
16971702

1698-
crate fn print_fn_ret_ty(&mut self, fn_ret_ty: &ast::FnRetTy) {
1703+
pub(crate) fn print_fn_ret_ty(&mut self, fn_ret_ty: &ast::FnRetTy) {
16991704
if let ast::FnRetTy::Ty(ty) = fn_ret_ty {
17001705
self.space_if_not_bol();
17011706
self.ibox(INDENT_UNIT);
@@ -1706,7 +1711,7 @@ impl<'a> State<'a> {
17061711
}
17071712
}
17081713

1709-
crate fn print_ty_fn(
1714+
pub(crate) fn print_ty_fn(
17101715
&mut self,
17111716
ext: ast::Extern,
17121717
unsafety: ast::Unsafe,
@@ -1730,7 +1735,7 @@ impl<'a> State<'a> {
17301735
self.end();
17311736
}
17321737

1733-
crate fn print_fn_header_info(&mut self, header: ast::FnHeader) {
1738+
pub(crate) fn print_fn_header_info(&mut self, header: ast::FnHeader) {
17341739
self.print_constness(header.constness);
17351740
self.print_asyncness(header.asyncness);
17361741
self.print_unsafety(header.unsafety);
@@ -1750,21 +1755,21 @@ impl<'a> State<'a> {
17501755
self.word("fn")
17511756
}
17521757

1753-
crate fn print_unsafety(&mut self, s: ast::Unsafe) {
1758+
pub(crate) fn print_unsafety(&mut self, s: ast::Unsafe) {
17541759
match s {
17551760
ast::Unsafe::No => {}
17561761
ast::Unsafe::Yes(_) => self.word_nbsp("unsafe"),
17571762
}
17581763
}
17591764

1760-
crate fn print_constness(&mut self, s: ast::Const) {
1765+
pub(crate) fn print_constness(&mut self, s: ast::Const) {
17611766
match s {
17621767
ast::Const::No => {}
17631768
ast::Const::Yes(_) => self.word_nbsp("const"),
17641769
}
17651770
}
17661771

1767-
crate fn print_is_auto(&mut self, s: ast::IsAuto) {
1772+
pub(crate) fn print_is_auto(&mut self, s: ast::IsAuto) {
17681773
match s {
17691774
ast::IsAuto::Yes => self.word_nbsp("auto"),
17701775
ast::IsAuto::No => {}

0 commit comments

Comments
 (0)