diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-18 14:53:52 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-07 14:51:07 +1100 |
| commit | 141719f68a3084f3b96f644c34734af077b9d197 (patch) | |
| tree | e225e18d7f27af1ef8accd3f1d1aa4989b46f334 /compiler/rustc_parse/src/parser/mod.rs | |
| parent | 98a48781feb1220c0cf2feea23f9ef92cdfa7437 (diff) | |
| download | rust-141719f68a3084f3b96f644c34734af077b9d197.tar.gz rust-141719f68a3084f3b96f644c34734af077b9d197.zip | |
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.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 7dabc28c645..0bb6e2ab126 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1076,10 +1076,12 @@ impl<'a> Parser<'a> { let initial_semicolon = self.token.span; while self.eat(exp!(Semi)) { - let _ = self.parse_stmt_without_recovery(false, ForceCollect::No).unwrap_or_else(|e| { - e.cancel(); - None - }); + let _ = self + .parse_stmt_without_recovery(false, ForceCollect::No, false) + .unwrap_or_else(|e| { + e.cancel(); + None + }); } expect_err @@ -1746,6 +1748,8 @@ pub enum ParseNtResult { Tt(TokenTree), Ident(Ident, IdentIsRaw), Lifetime(Ident, IdentIsRaw), + Item(P<ast::Item>), + Stmt(P<ast::Stmt>), Pat(P<ast::Pat>, NtPatKind), Ty(P<ast::Ty>), Meta(P<ast::AttrItem>), |
