Remove crate visibility usage in compiler

This commit is contained in:
Jacob Pratt 2022-05-20 19:51:09 -04:00
parent 536020c5f9
commit 49c82f31a8
No known key found for this signature in database
GPG key ID: B80E19E4662B5AA4
186 changed files with 865 additions and 800 deletions

View file

@ -31,7 +31,7 @@ pub struct UnmatchedBrace {
pub candidate_span: Option<Span>,
}
crate fn parse_token_trees<'a>(
pub(crate) fn parse_token_trees<'a>(
sess: &'a ParseSess,
src: &'a str,
start_pos: BytePos,

View file

@ -2,7 +2,6 @@
#![feature(array_windows)]
#![feature(box_patterns)]
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(let_else)]

View file

@ -284,7 +284,7 @@ impl<'a> Parser<'a> {
/// terminated by a semicolon.
///
/// Matches `inner_attrs*`.
crate fn parse_inner_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
pub(crate) fn parse_inner_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
let mut attrs: Vec<ast::Attribute> = vec![];
loop {
let start_pos: u32 = self.token_cursor.num_next_calls.try_into().unwrap();
@ -322,7 +322,7 @@ impl<'a> Parser<'a> {
Ok(attrs)
}
crate fn parse_unsuffixed_lit(&mut self) -> PResult<'a, ast::Lit> {
pub(crate) fn parse_unsuffixed_lit(&mut self) -> PResult<'a, ast::Lit> {
let lit = self.parse_lit()?;
debug!("checking if {:?} is unusuffixed", lit);
@ -358,7 +358,7 @@ impl<'a> Parser<'a> {
}
/// Matches `COMMASEP(meta_item_inner)`.
crate fn parse_meta_seq_top(&mut self) -> PResult<'a, Vec<ast::NestedMetaItem>> {
pub(crate) fn parse_meta_seq_top(&mut self) -> PResult<'a, Vec<ast::NestedMetaItem>> {
// Presumably, the majority of the time there will only be one attr.
let mut nmis = Vec::with_capacity(1);
while self.token.kind != token::Eof {
@ -401,7 +401,7 @@ impl<'a> Parser<'a> {
Ok(ast::MetaItem { path, kind, span })
}
crate fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> {
pub(crate) fn parse_meta_item_kind(&mut self) -> PResult<'a, ast::MetaItemKind> {
Ok(if self.eat(&token::Eq) {
ast::MetaItemKind::NameValue(self.parse_unsuffixed_lit()?)
} else if self.check(&token::OpenDelim(Delimiter::Parenthesis)) {

View file

@ -132,7 +132,7 @@ impl RecoverQPath for Expr {
}
/// Control whether the closing delimiter should be consumed when calling `Parser::consume_block`.
crate enum ConsumeClosingDelim {
pub(crate) enum ConsumeClosingDelim {
Yes,
No,
}
@ -2459,7 +2459,7 @@ impl<'a> Parser<'a> {
/// Some special error handling for the "top-level" patterns in a match arm,
/// `for` loop, `let`, &c. (in contrast to subpatterns within such).
crate fn maybe_recover_colon_colon_in_pat_typo(
pub(crate) fn maybe_recover_colon_colon_in_pat_typo(
&mut self,
mut first_pat: P<Pat>,
ra: RecoverColon,
@ -2575,7 +2575,7 @@ impl<'a> Parser<'a> {
first_pat
}
crate fn maybe_recover_unexpected_block_label(&mut self) -> bool {
pub(crate) fn maybe_recover_unexpected_block_label(&mut self) -> bool {
let Some(label) = self.eat_label().filter(|_| {
self.eat(&token::Colon) && self.token.kind == token::OpenDelim(Delimiter::Brace)
}) else {
@ -2596,7 +2596,7 @@ impl<'a> Parser<'a> {
/// Some special error handling for the "top-level" patterns in a match arm,
/// `for` loop, `let`, &c. (in contrast to subpatterns within such).
crate fn maybe_recover_unexpected_comma(
pub(crate) fn maybe_recover_unexpected_comma(
&mut self,
lo: Span,
rc: RecoverComma,
@ -2643,7 +2643,7 @@ impl<'a> Parser<'a> {
Err(err)
}
crate fn maybe_recover_bounds_doubled_colon(&mut self, ty: &Ty) -> PResult<'a, ()> {
pub(crate) fn maybe_recover_bounds_doubled_colon(&mut self, ty: &Ty) -> PResult<'a, ()> {
let TyKind::Path(qself, path) = &ty.kind else { return Ok(()) };
let qself_position = qself.as_ref().map(|qself| qself.position);
for (i, segments) in path.segments.windows(2).enumerate() {

View file

@ -2380,7 +2380,7 @@ impl<'a> Parser<'a> {
Ok(self.mk_expr(lo.to(self.prev_token.span), ExprKind::Loop(body, opt_label), attrs))
}
crate fn eat_label(&mut self) -> Option<Label> {
pub(crate) fn eat_label(&mut self) -> Option<Label> {
self.token.lifetime().map(|ident| {
self.bump();
Label { ident }
@ -3049,7 +3049,7 @@ impl<'a> Parser<'a> {
await_expr
}
crate fn mk_expr(&self, span: Span, kind: ExprKind, attrs: AttrVec) -> P<Expr> {
pub(crate) fn mk_expr(&self, span: Span, kind: ExprKind, attrs: AttrVec) -> P<Expr> {
P(Expr { kind, span, attrs, id: DUMMY_NODE_ID, tokens: None })
}

View file

@ -51,7 +51,7 @@ impl<'a> Parser<'a> {
})
}
crate fn parse_const_param(
pub(crate) fn parse_const_param(
&mut self,
preceding_attrs: Vec<Attribute>,
) -> PResult<'a, GenericParam> {

View file

@ -1415,7 +1415,7 @@ impl<'a> Parser<'a> {
}
}
crate fn make_unclosed_delims_error(
pub(crate) fn make_unclosed_delims_error(
unmatched: UnmatchedBrace,
sess: &ParseSess,
) -> Option<DiagnosticBuilder<'_, ErrorGuaranteed>> {

View file

@ -36,7 +36,7 @@ impl<'a> Parser<'a> {
/// If `force_capture` is true, forces collection of tokens regardless of whether
/// or not we have attributes
crate fn parse_stmt_without_recovery(
pub(crate) fn parse_stmt_without_recovery(
&mut self,
capture_semi: bool,
force_collect: ForceCollect,
@ -500,7 +500,7 @@ impl<'a> Parser<'a> {
/// Parses the rest of a block expression or function body.
/// Precondition: already parsed the '{'.
crate fn parse_block_tail(
pub(crate) fn parse_block_tail(
&mut self,
lo: Span,
s: BlockCheckMode,