Remove crate
visibility usage in compiler
This commit is contained in:
parent
536020c5f9
commit
49c82f31a8
186 changed files with 865 additions and 800 deletions
|
@ -1,5 +1,4 @@
|
|||
#![feature(associated_type_bounds)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(with_negative_coherence)]
|
||||
#![recursion_limit = "256"]
|
||||
|
|
|
@ -95,7 +95,7 @@ pub struct State<'a> {
|
|||
ann: &'a (dyn PpAnn + 'a),
|
||||
}
|
||||
|
||||
crate const INDENT_UNIT: isize = 4;
|
||||
pub(crate) const INDENT_UNIT: isize = 4;
|
||||
|
||||
/// Requires you to pass an input filename and reader so that
|
||||
/// it can scan the input text for comments to copy forward.
|
||||
|
@ -955,8 +955,13 @@ impl<'a> State<'a> {
|
|||
State { s: pp::Printer::new(), comments: None, ann: &NoAnn }
|
||||
}
|
||||
|
||||
crate fn commasep_cmnt<T, F, G>(&mut self, b: Breaks, elts: &[T], mut op: F, mut get_span: G)
|
||||
where
|
||||
pub(crate) fn commasep_cmnt<T, F, G>(
|
||||
&mut self,
|
||||
b: Breaks,
|
||||
elts: &[T],
|
||||
mut op: F,
|
||||
mut get_span: G,
|
||||
) where
|
||||
F: FnMut(&mut State<'_>, &T),
|
||||
G: FnMut(&T) -> rustc_span::Span,
|
||||
{
|
||||
|
@ -976,7 +981,7 @@ impl<'a> State<'a> {
|
|||
self.end();
|
||||
}
|
||||
|
||||
crate fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<ast::Expr>]) {
|
||||
pub(crate) fn commasep_exprs(&mut self, b: Breaks, exprs: &[P<ast::Expr>]) {
|
||||
self.commasep_cmnt(b, exprs, |s, e| s.print_expr(e), |e| e.span)
|
||||
}
|
||||
|
||||
|
@ -1109,7 +1114,7 @@ impl<'a> State<'a> {
|
|||
self.print_trait_ref(&t.trait_ref)
|
||||
}
|
||||
|
||||
crate fn print_stmt(&mut self, st: &ast::Stmt) {
|
||||
pub(crate) fn print_stmt(&mut self, st: &ast::Stmt) {
|
||||
self.maybe_print_comment(st.span.lo());
|
||||
match st.kind {
|
||||
ast::StmtKind::Local(ref loc) => {
|
||||
|
@ -1164,19 +1169,19 @@ impl<'a> State<'a> {
|
|||
self.maybe_print_trailing_comment(st.span, None)
|
||||
}
|
||||
|
||||
crate fn print_block(&mut self, blk: &ast::Block) {
|
||||
pub(crate) fn print_block(&mut self, blk: &ast::Block) {
|
||||
self.print_block_with_attrs(blk, &[])
|
||||
}
|
||||
|
||||
crate fn print_block_unclosed_indent(&mut self, blk: &ast::Block) {
|
||||
pub(crate) fn print_block_unclosed_indent(&mut self, blk: &ast::Block) {
|
||||
self.print_block_maybe_unclosed(blk, &[], false)
|
||||
}
|
||||
|
||||
crate fn print_block_with_attrs(&mut self, blk: &ast::Block, attrs: &[ast::Attribute]) {
|
||||
pub(crate) fn print_block_with_attrs(&mut self, blk: &ast::Block, attrs: &[ast::Attribute]) {
|
||||
self.print_block_maybe_unclosed(blk, attrs, true)
|
||||
}
|
||||
|
||||
crate fn print_block_maybe_unclosed(
|
||||
pub(crate) fn print_block_maybe_unclosed(
|
||||
&mut self,
|
||||
blk: &ast::Block,
|
||||
attrs: &[ast::Attribute],
|
||||
|
@ -1210,7 +1215,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
/// Print a `let pat = expr` expression.
|
||||
crate fn print_let(&mut self, pat: &ast::Pat, expr: &ast::Expr) {
|
||||
pub(crate) fn print_let(&mut self, pat: &ast::Pat, expr: &ast::Expr) {
|
||||
self.word("let ");
|
||||
self.print_pat(pat);
|
||||
self.space();
|
||||
|
@ -1219,7 +1224,7 @@ impl<'a> State<'a> {
|
|||
self.print_expr_cond_paren(expr, Self::cond_needs_par(expr) || npals())
|
||||
}
|
||||
|
||||
crate fn print_mac(&mut self, m: &ast::MacCall) {
|
||||
pub(crate) fn print_mac(&mut self, m: &ast::MacCall) {
|
||||
self.print_mac_common(
|
||||
Some(MacHeader::Path(&m.path)),
|
||||
true,
|
||||
|
@ -1360,7 +1365,7 @@ impl<'a> State<'a> {
|
|||
self.pclose();
|
||||
}
|
||||
|
||||
crate fn print_local_decl(&mut self, loc: &ast::Local) {
|
||||
pub(crate) fn print_local_decl(&mut self, loc: &ast::Local) {
|
||||
self.print_pat(&loc.pat);
|
||||
if let Some(ref ty) = loc.ty {
|
||||
self.word_space(":");
|
||||
|
@ -1368,7 +1373,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_name(&mut self, name: Symbol) {
|
||||
pub(crate) fn print_name(&mut self, name: Symbol) {
|
||||
self.word(name.to_string());
|
||||
self.ann.post(self, AnnNode::Name(&name))
|
||||
}
|
||||
|
@ -1392,7 +1397,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_pat(&mut self, pat: &ast::Pat) {
|
||||
pub(crate) fn print_pat(&mut self, pat: &ast::Pat) {
|
||||
self.maybe_print_comment(pat.span.lo());
|
||||
self.ann.pre(self, AnnNode::Pat(pat));
|
||||
/* Pat isn't normalized, but the beauty of it
|
||||
|
@ -1551,7 +1556,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_asyncness(&mut self, asyncness: ast::Async) {
|
||||
pub(crate) fn print_asyncness(&mut self, asyncness: ast::Async) {
|
||||
if asyncness.is_async() {
|
||||
self.word_nbsp("async");
|
||||
}
|
||||
|
@ -1584,11 +1589,11 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_lifetime(&mut self, lifetime: ast::Lifetime) {
|
||||
pub(crate) fn print_lifetime(&mut self, lifetime: ast::Lifetime) {
|
||||
self.print_name(lifetime.ident.name)
|
||||
}
|
||||
|
||||
crate fn print_lifetime_bounds(
|
||||
pub(crate) fn print_lifetime_bounds(
|
||||
&mut self,
|
||||
lifetime: ast::Lifetime,
|
||||
bounds: &ast::GenericBounds,
|
||||
|
@ -1608,7 +1613,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_generic_params(&mut self, generic_params: &[ast::GenericParam]) {
|
||||
pub(crate) fn print_generic_params(&mut self, generic_params: &[ast::GenericParam]) {
|
||||
if generic_params.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
@ -1662,12 +1667,12 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_mt(&mut self, mt: &ast::MutTy, print_const: bool) {
|
||||
pub(crate) fn print_mt(&mut self, mt: &ast::MutTy, print_const: bool) {
|
||||
self.print_mutability(mt.mutbl, print_const);
|
||||
self.print_type(&mt.ty)
|
||||
}
|
||||
|
||||
crate fn print_param(&mut self, input: &ast::Param, is_closure: bool) {
|
||||
pub(crate) fn print_param(&mut self, input: &ast::Param, is_closure: bool) {
|
||||
self.ibox(INDENT_UNIT);
|
||||
|
||||
self.print_outer_attributes_inline(&input.attrs);
|
||||
|
@ -1695,7 +1700,7 @@ impl<'a> State<'a> {
|
|||
self.end();
|
||||
}
|
||||
|
||||
crate fn print_fn_ret_ty(&mut self, fn_ret_ty: &ast::FnRetTy) {
|
||||
pub(crate) fn print_fn_ret_ty(&mut self, fn_ret_ty: &ast::FnRetTy) {
|
||||
if let ast::FnRetTy::Ty(ty) = fn_ret_ty {
|
||||
self.space_if_not_bol();
|
||||
self.ibox(INDENT_UNIT);
|
||||
|
@ -1706,7 +1711,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_ty_fn(
|
||||
pub(crate) fn print_ty_fn(
|
||||
&mut self,
|
||||
ext: ast::Extern,
|
||||
unsafety: ast::Unsafe,
|
||||
|
@ -1730,7 +1735,7 @@ impl<'a> State<'a> {
|
|||
self.end();
|
||||
}
|
||||
|
||||
crate fn print_fn_header_info(&mut self, header: ast::FnHeader) {
|
||||
pub(crate) fn print_fn_header_info(&mut self, header: ast::FnHeader) {
|
||||
self.print_constness(header.constness);
|
||||
self.print_asyncness(header.asyncness);
|
||||
self.print_unsafety(header.unsafety);
|
||||
|
@ -1750,21 +1755,21 @@ impl<'a> State<'a> {
|
|||
self.word("fn")
|
||||
}
|
||||
|
||||
crate fn print_unsafety(&mut self, s: ast::Unsafe) {
|
||||
pub(crate) fn print_unsafety(&mut self, s: ast::Unsafe) {
|
||||
match s {
|
||||
ast::Unsafe::No => {}
|
||||
ast::Unsafe::Yes(_) => self.word_nbsp("unsafe"),
|
||||
}
|
||||
}
|
||||
|
||||
crate fn print_constness(&mut self, s: ast::Const) {
|
||||
pub(crate) fn print_constness(&mut self, s: ast::Const) {
|
||||
match s {
|
||||
ast::Const::No => {}
|
||||
ast::Const::Yes(_) => self.word_nbsp("const"),
|
||||
}
|
||||
}
|
||||
|
||||
crate fn print_is_auto(&mut self, s: ast::IsAuto) {
|
||||
pub(crate) fn print_is_auto(&mut self, s: ast::IsAuto) {
|
||||
match s {
|
||||
ast::IsAuto::Yes => self.word_nbsp("auto"),
|
||||
ast::IsAuto::No => {}
|
||||
|
|
|
@ -19,7 +19,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_foreign_item(&mut self, item: &ast::ForeignItem) {
|
||||
pub(crate) fn print_foreign_item(&mut self, item: &ast::ForeignItem) {
|
||||
let ast::Item { id, span, ident, ref attrs, ref kind, ref vis, tokens: _ } = *item;
|
||||
self.ann.pre(self, AnnNode::SubItem(id));
|
||||
self.hardbreak_if_not_bol();
|
||||
|
@ -128,7 +128,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
/// Pretty-prints an item.
|
||||
crate fn print_item(&mut self, item: &ast::Item) {
|
||||
pub(crate) fn print_item(&mut self, item: &ast::Item) {
|
||||
self.hardbreak_if_not_bol();
|
||||
self.maybe_print_comment(item.span.lo());
|
||||
self.print_outer_attributes(&item.attrs);
|
||||
|
@ -400,7 +400,7 @@ impl<'a> State<'a> {
|
|||
self.bclose(span, empty)
|
||||
}
|
||||
|
||||
crate fn print_visibility(&mut self, vis: &ast::Visibility) {
|
||||
pub(crate) fn print_visibility(&mut self, vis: &ast::Visibility) {
|
||||
match vis.kind {
|
||||
ast::VisibilityKind::Public => self.word_nbsp("pub"),
|
||||
ast::VisibilityKind::Crate(sugar) => match sugar {
|
||||
|
@ -484,7 +484,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_variant(&mut self, v: &ast::Variant) {
|
||||
pub(crate) fn print_variant(&mut self, v: &ast::Variant) {
|
||||
self.head("");
|
||||
self.print_visibility(&v.vis);
|
||||
let generics = ast::Generics::default();
|
||||
|
@ -496,7 +496,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_assoc_item(&mut self, item: &ast::AssocItem) {
|
||||
pub(crate) fn print_assoc_item(&mut self, item: &ast::AssocItem) {
|
||||
let ast::Item { id, span, ident, ref attrs, ref kind, ref vis, tokens: _ } = *item;
|
||||
self.ann.pre(self, AnnNode::SubItem(id));
|
||||
self.hardbreak_if_not_bol();
|
||||
|
@ -562,7 +562,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
crate fn print_fn(
|
||||
pub(crate) fn print_fn(
|
||||
&mut self,
|
||||
decl: &ast::FnDecl,
|
||||
header: ast::FnHeader,
|
||||
|
@ -579,7 +579,7 @@ impl<'a> State<'a> {
|
|||
self.print_where_clause(&generics.where_clause)
|
||||
}
|
||||
|
||||
crate fn print_fn_params_and_ret(&mut self, decl: &ast::FnDecl, is_closure: bool) {
|
||||
pub(crate) fn print_fn_params_and_ret(&mut self, decl: &ast::FnDecl, is_closure: bool) {
|
||||
let (open, close) = if is_closure { ("|", "|") } else { ("(", ")") };
|
||||
self.word(open);
|
||||
self.commasep(Inconsistent, &decl.inputs, |s, param| s.print_param(param, is_closure));
|
||||
|
@ -591,7 +591,7 @@ impl<'a> State<'a> {
|
|||
self.print_where_clause_parts(where_clause.has_where_token, &where_clause.predicates);
|
||||
}
|
||||
|
||||
crate fn print_where_clause_parts(
|
||||
pub(crate) fn print_where_clause_parts(
|
||||
&mut self,
|
||||
has_where_token: bool,
|
||||
predicates: &[ast::WherePredicate],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue