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;
42
42
/// _ => m! {} - 1, // binary subtraction operator
43
43
/// }
44
44
/// ```
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 {
46
47
!matches ! (
47
48
e. kind,
48
49
ast:: ExprKind :: If ( ..)
Original file line number Diff line number Diff line change @@ -1101,7 +1101,7 @@ impl<'a> State<'a> {
1101
1101
false ,
1102
1102
FixupContext { stmt : true , ..FixupContext :: default ( ) } ,
1103
1103
) ;
1104
- if classify:: expr_requires_semi_to_be_stmt ( expr) {
1104
+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) {
1105
1105
self . word ( ";" ) ;
1106
1106
}
1107
1107
}
Original file line number Diff line number Diff line change @@ -470,8 +470,8 @@ impl<'a> State<'a> {
470
470
//
471
471
// Same applies to a small set of other expression kinds which eagerly
472
472
// 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) ;
475
475
if needs_par {
476
476
self . popen ( ) ;
477
477
fixup = FixupContext :: default ( ) ;
Original file line number Diff line number Diff line change @@ -674,7 +674,7 @@ trait UnusedDelimLint {
674
674
ExprKind :: Index ( base, _subscript, _) => base,
675
675
_ => break ,
676
676
} ;
677
- if !classify:: expr_requires_semi_to_be_stmt ( innermost) {
677
+ if !classify:: expr_requires_semi_to_be_stmt_FIXME ( innermost) {
678
678
return true ;
679
679
}
680
680
}
Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ impl<'a> Parser<'a> {
470
470
/// Checks if this expression is a successfully parsed statement.
471
471
fn expr_is_complete ( & self , e : & Expr ) -> bool {
472
472
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)
474
474
}
475
475
476
476
/// Parses `x..y`, `x..=y`, and `x..`/`x..=`.
@@ -2567,7 +2567,7 @@ impl<'a> Parser<'a> {
2567
2567
// If it's not a free-standing expression, and is followed by a block,
2568
2568
// then it's very likely the condition to an `else if`.
2569
2569
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) =>
2571
2571
{
2572
2572
self . dcx ( ) . emit_err ( errors:: ExpectedElseBlock {
2573
2573
first_tok_span,
@@ -2989,7 +2989,7 @@ impl<'a> Parser<'a> {
2989
2989
err
2990
2990
} ) ?;
2991
2991
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)
2993
2993
&& this. token != token:: CloseDelim ( Delimiter :: Brace ) ;
2994
2994
2995
2995
if !require_comma {
Original file line number Diff line number Diff line change @@ -637,7 +637,7 @@ impl<'a> Parser<'a> {
637
637
match & mut stmt. kind {
638
638
// Expression without semicolon.
639
639
StmtKind :: Expr ( expr)
640
- if classify:: expr_requires_semi_to_be_stmt ( expr)
640
+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr)
641
641
&& !expr. attrs . is_empty ( )
642
642
&& ![ token:: Eof , token:: Semi , token:: CloseDelim ( Delimiter :: Brace ) ]
643
643
. contains ( & self . token . kind ) =>
@@ -651,7 +651,8 @@ impl<'a> Parser<'a> {
651
651
652
652
// Expression without semicolon.
653
653
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) =>
655
656
{
656
657
// Just check for errors and recover; do not eat semicolon yet.
657
658
// `expect_one_of` returns PResult<'a, bool /* recovered */>
You can’t perform that action at this time.
0 commit comments