Skip to content

Commit 2d3670b

Browse files
bors[bot]Veykril
andauthored
17: Add inline const expression and pattern r=matklad a=Veykril To be able to address rust-lang/rust-analyzer#6848 in the (near) future. The name `ConstBlockPattern` was chosen since that's what the [rfc](https://rust-lang.github.io/rfcs/2920-inline-const.html) calls it. CodeGen with this breaks RA in one file https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/hir_def/src/body/lower.rs#L825, that is if the `"CONST_BLOCK_PAT"` has been added to KINDS_SRC. I figure adding this now is a good time as the rust.ungrammar is being changed for lifetimes and macros2.0 anyways. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 parents edb64ad + eb04a44 commit 2d3670b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/tools/rust-analyzer/lib/ungrammar/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ungrammar"
33
description = "A DSL for describing concrete syntax trees"
4-
version = "1.4.0"
4+
version = "1.5.0"
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/matklad/ungrammar"
77
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]

src/tools/rust-analyzer/lib/ungrammar/rust.ungram

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,13 +372,13 @@ BlockExpr =
372372
'}'
373373

374374
RefExpr =
375-
Attr* '&' ('raw' |'mut' | 'const') Expr
375+
Attr* '&' ('raw' | 'mut' | 'const') Expr
376376

377377
TryExpr =
378378
Attr* Expr '?'
379379

380380
EffectExpr =
381-
Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
381+
Attr* Label? ('try' | 'unsafe' | 'async' | 'const') BlockExpr
382382

383383
PrefixExpr =
384384
Attr* op:('-' | '!' | '*') Expr
@@ -582,6 +582,7 @@ Pat =
582582
| SlicePat
583583
| TuplePat
584584
| TupleStructPat
585+
| ConstBlockPat
585586

586587
LiteralPat =
587588
Literal
@@ -636,3 +637,6 @@ RestPat =
636637

637638
MacroPat =
638639
MacroCall
640+
641+
ConstBlockPat =
642+
'const' BlockExpr

0 commit comments

Comments
 (0)