Unnamed repository; edit this file 'description' to name the repository.
Merge rust-analyzer/ungrammar#17
17: Add inline const expression and pattern r=matklad a=Veykril To be able to address https://github.com/rust-analyzer/rust-analyzer/issues/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 <[email protected]>
bors[bot] 2020-12-23
parent 7403d0e · parent d75b89b · commit fcd7be9
-rw-r--r--lib/ungrammar/Cargo.toml2
-rw-r--r--lib/ungrammar/rust.ungram8
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/ungrammar/Cargo.toml b/lib/ungrammar/Cargo.toml
index 1ba385676d..10aff55025 100644
--- a/lib/ungrammar/Cargo.toml
+++ b/lib/ungrammar/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ungrammar"
description = "A DSL for describing concrete syntax trees"
-version = "1.4.0"
+version = "1.5.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/matklad/ungrammar"
authors = ["Aleksey Kladov <[email protected]>"]
diff --git a/lib/ungrammar/rust.ungram b/lib/ungrammar/rust.ungram
index fdb381f98d..a954d9efd2 100644
--- a/lib/ungrammar/rust.ungram
+++ b/lib/ungrammar/rust.ungram
@@ -372,13 +372,13 @@ BlockExpr =
'}'
RefExpr =
- Attr* '&' ('raw' |'mut' | 'const') Expr
+ Attr* '&' ('raw' | 'mut' | 'const') Expr
TryExpr =
Attr* Expr '?'
EffectExpr =
- Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
+ Attr* Label? ('try' | 'unsafe' | 'async' | 'const') BlockExpr
PrefixExpr =
Attr* op:('-' | '!' | '*') Expr
@@ -582,6 +582,7 @@ Pat =
| SlicePat
| TuplePat
| TupleStructPat
+| ConstBlockPat
LiteralPat =
Literal
@@ -636,3 +637,6 @@ RestPat =
MacroPat =
MacroCall
+
+ConstBlockPat =
+ 'const' BlockExpr