From 49c82f31a85f04a709810de4ccfb8ba765c1377b Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Fri, 20 May 2022 19:51:09 -0400 Subject: Remove `crate` visibility usage in compiler --- compiler/rustc_parse/src/parser/attr.rs | 8 ++++---- compiler/rustc_parse/src/parser/diagnostics.rs | 10 +++++----- compiler/rustc_parse/src/parser/expr.rs | 4 ++-- compiler/rustc_parse/src/parser/generics.rs | 2 +- compiler/rustc_parse/src/parser/mod.rs | 2 +- compiler/rustc_parse/src/parser/stmt.rs | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 2f90a7c54ab..3ae8bb07cd0 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -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> { + pub(crate) fn parse_inner_attributes(&mut self) -> PResult<'a, Vec> { let mut attrs: Vec = 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> { + pub(crate) fn parse_meta_seq_top(&mut self) -> PResult<'a, Vec> { // 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)) { diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 3b2ce0de509..69e12063cc1 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -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, 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() { diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 6114e7aaa7b..b5467c659a2 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -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