Skip to content

Commit d8eb301

Browse files
authored
Rollup merge of rust-lang#76115 - calebcartwright:parser-fn-visibility, r=matklad
Restore public visibility on some parsing functions for rustfmt In rust-lang#74826 the visibility of several parsing functions was reduced. However, rustfmt is an external consumer of some of these functions as well and needs the visibility to be public, similar to other elements in rustc_parse such as `parse_ident` https://github.com/rust-lang/rust/blob/db534b3ac286cf45688c3bbae6aa6e77439e52d2/src/librustc_parse/parser/mod.rs#L433-L436
2 parents 67f1643 + 883b1e7 commit d8eb301

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_parse/src/parser/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ impl<'a> Parser<'a> {
10141014
/// If the following element can't be a tuple (i.e., it's a function definition), then
10151015
/// it's not a tuple struct field), and the contents within the parentheses isn't valid,
10161016
/// so emit a proper diagnostic.
1017-
pub(crate) fn parse_visibility(&mut self, fbt: FollowedByType) -> PResult<'a, Visibility> {
1017+
// Public for rustfmt usage.
1018+
pub fn parse_visibility(&mut self, fbt: FollowedByType) -> PResult<'a, Visibility> {
10181019
maybe_whole!(self, NtVis, |x| x);
10191020

10201021
self.expected_tokens.push(TokenType::Keyword(kw::Crate));

compiler/rustc_parse/src/parser/stmt.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ use std::mem;
2121
impl<'a> Parser<'a> {
2222
/// Parses a statement. This stops just before trailing semicolons on everything but items.
2323
/// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
24-
pub(super) fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> {
24+
// Public for rustfmt usage.
25+
pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> {
2526
Ok(self.parse_stmt_without_recovery().unwrap_or_else(|mut e| {
2627
e.emit();
2728
self.recover_stmt_(SemiColonMode::Break, BlockMode::Ignore);

0 commit comments

Comments
 (0)