rust/compiler/rustc_parse/src/parser
David Tolnay 53521faf06
Remove MacCall special cases from Parser::parse_full_stmt
It is impossible for expr here to be a braced macro call. Expr comes
from `parse_stmt_without_recovery`, in which macro calls are parsed by
`parse_stmt_mac`. See this part:

    let kind = if (style == MacStmtStyle::Braces
        && self.token != token::Dot
        && self.token != token::Question)
        || self.token == token::Semi
        || self.token == token::Eof
    {
        StmtKind::MacCall(P(MacCallStmt { mac, style, attrs, tokens: None }))
    } else {
        // Since none of the above applied, this is an expression statement macro.
        let e = self.mk_expr(lo.to(hi), ExprKind::MacCall(mac));
        let e = self.maybe_recover_from_bad_qpath(e)?;
        let e = self.parse_expr_dot_or_call_with(e, lo, attrs)?;
        let e = self.parse_expr_assoc_with(
            0,
            LhsExpr::AlreadyParsed { expr: e, starts_statement: false },
        )?;
        StmtKind::Expr(e)
    };

A braced macro call at the head of a statement is always either extended
into ExprKind::Field / MethodCall / Await / Try / Binary, or else
returned as StmtKind::MacCall. We can never get a StmtKind::Expr
containing ExprKind::MacCall containing brace delimiter.
2024-05-11 15:49:51 -07:00
..
mut_visit Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
tokenstream Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
attr.rs Fix parse error message for meta items 2024-05-10 09:16:27 +02:00
attr_wrapper.rs Simplify static_assert_sizes. 2024-04-18 15:36:25 +10:00
diagnostics.rs Rollup merge of #124930 - compiler-errors:consume-arg, r=petrochenkov 2024-05-11 01:15:10 +01:00
expr.rs Remove MacCall special case from recovery after missing 'if' after 'else' 2024-05-11 15:49:51 -07:00
generics.rs Parsing , pre-lowering support for precise captures 2024-04-15 16:45:01 -04:00
item.rs Add ErrorGuaranteed to Recovered::Yes and use it more. 2024-05-09 20:12:07 +10:00
mod.rs Add ErrorGuaranteed to Recovered::Yes and use it more. 2024-05-09 20:12:07 +10:00
nonterminal.rs Rename ModSep to PathSep 2024-04-04 19:44:04 +02:00
pat.rs Rename BindingAnnotation to BindingMode 2024-04-17 09:34:39 -04:00
path.rs ignore generics args in attribute paths 2024-05-11 00:13:27 +08:00
stmt.rs Remove MacCall special cases from Parser::parse_full_stmt 2024-05-11 15:49:51 -07:00
tests.rs Move some tests from rustc_expand to rustc_parse. 2024-05-06 09:06:02 +10:00
ty.rs Auto merge of #123468 - compiler-errors:precise-capturing, r=oli-obk 2024-04-16 11:22:35 +00:00