File tree Expand file tree Collapse file tree 6 files changed +12
-10
lines changed
rustc_ast_pretty/src/pprust Expand file tree Collapse file tree 6 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ use crate::ast;
4242/// _ => m! {} - 1, // binary subtraction operator
4343/// }
4444/// ```
45- pub fn expr_requires_semi_to_be_stmt ( e : & ast:: Expr ) -> bool {
45+ #[ allow( non_snake_case) ]
46+ pub fn expr_requires_semi_to_be_stmt_FIXME ( e : & ast:: Expr ) -> bool {
4647 !matches ! (
4748 e. kind,
4849 ast:: ExprKind :: If ( ..)
Original file line number Diff line number Diff line change @@ -1101,7 +1101,7 @@ impl<'a> State<'a> {
11011101 false ,
11021102 FixupContext { stmt : true , ..FixupContext :: default ( ) } ,
11031103 ) ;
1104- if classify:: expr_requires_semi_to_be_stmt ( expr) {
1104+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) {
11051105 self . word ( ";" ) ;
11061106 }
11071107 }
Original file line number Diff line number Diff line change @@ -470,8 +470,8 @@ impl<'a> State<'a> {
470470 //
471471 // Same applies to a small set of other expression kinds which eagerly
472472 // terminate a statement which opens with them.
473- let needs_par =
474- fixup . leftmost_subexpression_in_stmt && !classify:: expr_requires_semi_to_be_stmt ( expr) ;
473+ let needs_par = fixup . leftmost_subexpression_in_stmt
474+ && !classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) ;
475475 if needs_par {
476476 self . popen ( ) ;
477477 fixup = FixupContext :: default ( ) ;
Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ trait UnusedDelimLint {
674674 ExprKind :: Index ( base, _subscript, _) => base,
675675 _ => break ,
676676 } ;
677- if !classify:: expr_requires_semi_to_be_stmt ( innermost) {
677+ if !classify:: expr_requires_semi_to_be_stmt_FIXME ( innermost) {
678678 return true ;
679679 }
680680 }
Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ impl<'a> Parser<'a> {
470470 /// Checks if this expression is a successfully parsed statement.
471471 fn expr_is_complete ( & self , e : & Expr ) -> bool {
472472 self . restrictions . contains ( Restrictions :: STMT_EXPR )
473- && !classify:: expr_requires_semi_to_be_stmt ( e)
473+ && !classify:: expr_requires_semi_to_be_stmt_FIXME ( e)
474474 }
475475
476476 /// Parses `x..y`, `x..=y`, and `x..`/`x..=`.
@@ -2567,7 +2567,7 @@ impl<'a> Parser<'a> {
25672567 // If it's not a free-standing expression, and is followed by a block,
25682568 // then it's very likely the condition to an `else if`.
25692569 if self . check ( & TokenKind :: OpenDelim ( Delimiter :: Brace ) )
2570- && classify:: expr_requires_semi_to_be_stmt ( & cond) =>
2570+ && classify:: expr_requires_semi_to_be_stmt_FIXME ( & cond) =>
25712571 {
25722572 self . dcx ( ) . emit_err ( errors:: ExpectedElseBlock {
25732573 first_tok_span,
@@ -2989,7 +2989,7 @@ impl<'a> Parser<'a> {
29892989 err
29902990 } ) ?;
29912991
2992- let require_comma = classify:: expr_requires_semi_to_be_stmt ( & expr)
2992+ let require_comma = classify:: expr_requires_semi_to_be_stmt_FIXME ( & expr)
29932993 && this. token != token:: CloseDelim ( Delimiter :: Brace ) ;
29942994
29952995 if !require_comma {
Original file line number Diff line number Diff line change @@ -637,7 +637,7 @@ impl<'a> Parser<'a> {
637637 match & mut stmt. kind {
638638 // Expression without semicolon.
639639 StmtKind :: Expr ( expr)
640- if classify:: expr_requires_semi_to_be_stmt ( expr)
640+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr)
641641 && !expr. attrs . is_empty ( )
642642 && ![ token:: Eof , token:: Semi , token:: CloseDelim ( Delimiter :: Brace ) ]
643643 . contains ( & self . token . kind ) =>
@@ -651,7 +651,8 @@ impl<'a> Parser<'a> {
651651
652652 // Expression without semicolon.
653653 StmtKind :: Expr ( expr)
654- if self . token != token:: Eof && classify:: expr_requires_semi_to_be_stmt ( expr) =>
654+ if self . token != token:: Eof
655+ && classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) =>
655656 {
656657 // Just check for errors and recover; do not eat semicolon yet.
657658 // `expect_one_of` returns PResult<'a, bool /* recovered */>
You can’t perform that action at this time.
0 commit comments