rust/tests/ui/macros/macro-stmt-2.rs
Nicholas Nethercote 141719f68a Remove NtItem and NtStmt.
This involves replacing `nt_pretty_printing_compatibility_hack` with
`stream_pretty_printing_compatibility_hack`.

The handling of statements in `transcribe` is slightly different to
other nonterminal kinds, due to the lack of `from_ast` implementation
for empty statements.

Notable test changes:
- `tests/ui/proc-macro/expand-to-derive.rs`: the diff looks large but
  the only difference is the insertion of a single invisible-delimited
  group around a metavar.
2025-03-07 14:51:07 +11:00

12 lines
348 B
Rust

//@ check-pass
//
// This shows a tricky case for #124141, where `declare!(_x)` was incorrectly
// being categorised as a `StmtKind::Expr` instead of a `StmtKind::MacCall` in
// `parse_stmt_mac`.
macro_rules! as_stmt { ($s:stmt) => { $s }; }
macro_rules! declare { ($name:ident) => { let $name = 0u32; }; }
fn main() { as_stmt!(declare!(_x)); }