rust/compiler/rustc_parse/src/parser
Matthias Krüger 0bb15457de
Rollup merge of #149174 - GrigorenkoPV:const_block_item, r=me,ytmimi
`const` blocks as a `mod` item

Tracking issue: rust-lang/rust#149226

This adds support for writing `const { ... }` as an item in a module. In the current implementation, this is a unique AST item that gets lowered to `const _: () = const { ... };` in HIR.

rustfmt support included.

TODO:
- `pub const { ... }` does not make sense (see rust-lang/rust#147136). Reject it. Should this be rejected by the parser or smth?
- Improve diagnostics (preferably they should not mention the fake `_` ident).
2026-01-24 15:35:08 +01:00
..
tokenstream Use Iterator::eq and (dogfood) eq_by in compiler and library 2025-09-29 08:08:05 +03:00
asm.rs Don't use matches! when == suffices 2025-12-26 20:28:19 +00:00
attr.rs Audit AllowConstBlockItems 2026-01-21 19:36:14 +03:00
attr_wrapper.rs Make attr path symbols rather than idents 2025-12-22 16:26:14 +01:00
cfg_select.rs Move parse_cfg_select to rustc_builtin_macros 2025-11-09 16:08:00 +01:00
diagnostics.rs Parse ident with allowing recovery when trying to recover in diagnosing 2026-01-19 10:08:45 +08:00
expr.rs Fix parsing of mgca const blocks in array repeat exprs 2025-12-30 11:30:31 -08:00
generics.rs Do not recover from Trait() if generic list is unterminated 2026-01-15 19:32:39 +00:00
item.rs const_block_items: do not create an AnonConst 2026-01-21 19:36:27 +03:00
mod.rs Audit AllowConstBlockItems 2026-01-21 19:36:14 +03:00
nonterminal.rs Audit AllowConstBlockItems 2026-01-21 19:36:14 +03:00
pat.rs Remove all allows for diagnostic_outside_of_impl and untranslatable_diagnostic throughout the codebase 2026-01-19 17:39:49 +01:00
path.rs Fix parsing of mgca const blocks in array repeat exprs 2025-12-30 11:30:31 -08:00
stmt.rs Audit AllowConstBlockItems 2026-01-21 19:36:14 +03:00
tests.rs Rollup merge of #149174 - GrigorenkoPV:const_block_item, r=me,ytmimi 2026-01-24 15:35:08 +01:00
token_type.rs Use default field values in Parser 2026-01-15 19:46:54 +00:00
ty.rs Do not recover from Trait() if generic list is unterminated 2026-01-15 19:32:39 +00:00