File tree Expand file tree Collapse file tree 6 files changed +11
-9
lines changed
rustc_ast_pretty/src/pprust Expand file tree Collapse file tree 6 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ use crate::{ast, token::Delimiter};
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 @@ -1253,7 +1253,7 @@ impl<'a> State<'a> {
1253
1253
ast:: StmtKind :: Expr ( expr) => {
1254
1254
self . space_if_not_bol ( ) ;
1255
1255
self . print_expr_outer_attr_style ( expr, false , FixupContext :: new_stmt ( ) ) ;
1256
- if classify:: expr_requires_semi_to_be_stmt ( expr) {
1256
+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) {
1257
1257
self . word ( ";" ) ;
1258
1258
}
1259
1259
}
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ impl FixupContext {
128
128
/// The documentation on `FixupContext::leftmost_subexpression_in_stmt` has
129
129
/// examples.
130
130
pub fn would_cause_statement_boundary ( self , expr : & Expr ) -> bool {
131
- self . leftmost_subexpression_in_stmt && !classify:: expr_requires_semi_to_be_stmt ( expr)
131
+ self . leftmost_subexpression_in_stmt && !classify:: expr_requires_semi_to_be_stmt_FIXME ( expr)
132
132
}
133
133
134
134
/// Determine whether parentheses are needed around the given `let`
Original file line number Diff line number Diff line change @@ -686,7 +686,7 @@ trait UnusedDelimLint {
686
686
ExprKind :: Index ( base, _subscript, _) => base,
687
687
_ => break ,
688
688
} ;
689
- if !classify:: expr_requires_semi_to_be_stmt ( innermost) {
689
+ if !classify:: expr_requires_semi_to_be_stmt_FIXME ( innermost) {
690
690
return true ;
691
691
}
692
692
}
Original file line number Diff line number Diff line change @@ -484,7 +484,7 @@ impl<'a> Parser<'a> {
484
484
/// Checks if this expression is a successfully parsed statement.
485
485
fn expr_is_complete ( & self , e : & Expr ) -> bool {
486
486
self . restrictions . contains ( Restrictions :: STMT_EXPR )
487
- && !classify:: expr_requires_semi_to_be_stmt ( e)
487
+ && !classify:: expr_requires_semi_to_be_stmt_FIXME ( e)
488
488
}
489
489
490
490
/// Parses `x..y`, `x..=y`, and `x..`/`x..=`.
@@ -2672,7 +2672,7 @@ impl<'a> Parser<'a> {
2672
2672
// If it's not a free-standing expression, and is followed by a block,
2673
2673
// then it's very likely the condition to an `else if`.
2674
2674
if self . check ( & TokenKind :: OpenDelim ( Delimiter :: Brace ) )
2675
- && classify:: expr_requires_semi_to_be_stmt ( & cond) =>
2675
+ && classify:: expr_requires_semi_to_be_stmt_FIXME ( & cond) =>
2676
2676
{
2677
2677
self . dcx ( ) . emit_err ( errors:: ExpectedElseBlock {
2678
2678
first_tok_span,
@@ -3114,7 +3114,7 @@ impl<'a> Parser<'a> {
3114
3114
err
3115
3115
} ) ?;
3116
3116
3117
- let require_comma = classify:: expr_requires_semi_to_be_stmt ( & expr)
3117
+ let require_comma = classify:: expr_requires_semi_to_be_stmt_FIXME ( & expr)
3118
3118
&& this. token != token:: CloseDelim ( Delimiter :: Brace ) ;
3119
3119
3120
3120
if !require_comma {
Original file line number Diff line number Diff line change @@ -649,7 +649,7 @@ impl<'a> Parser<'a> {
649
649
match & mut stmt. kind {
650
650
// Expression without semicolon.
651
651
StmtKind :: Expr ( expr)
652
- if classify:: expr_requires_semi_to_be_stmt ( expr)
652
+ if classify:: expr_requires_semi_to_be_stmt_FIXME ( expr)
653
653
&& !expr. attrs . is_empty ( )
654
654
&& ![ token:: Eof , token:: Semi , token:: CloseDelim ( Delimiter :: Brace ) ]
655
655
. contains ( & self . token . kind ) =>
@@ -663,7 +663,8 @@ impl<'a> Parser<'a> {
663
663
664
664
// Expression without semicolon.
665
665
StmtKind :: Expr ( expr)
666
- if self . token != token:: Eof && classify:: expr_requires_semi_to_be_stmt ( expr) =>
666
+ if self . token != token:: Eof
667
+ && classify:: expr_requires_semi_to_be_stmt_FIXME ( expr) =>
667
668
{
668
669
// Just check for errors and recover; do not eat semicolon yet.
669
670
You can’t perform that action at this time.
0 commit comments