parse type const items#22046
Conversation
This comment has been minimized.
This comment has been minimized.
Adds parser support for the unstable `type const` syntax from the `min_generic_const_args` feature, e.g. `type const FOO: i32 = 2;`. Closes rust-lang#22038. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7f5886f to
b4f32b4
Compare
|
Hello @yPin9, it seems I am still getting syntax errors in my rust-analyzer. How about you? |
Which version are you on? As this haven't been included in our stable releases (every Monday) yet, the issue wouldn't be fixed unless you are using the nightly release of rust-analyzer or have built it from the source |
Ah, when I ran |
|
Yeah, we usually do subtree updates to |
This is it rust-lang/rust#155556 |
thanks! I should update it quickly 😁 |
Adds parser support for the unstable
type constsyntax from themin_generic_const_argsfeature:Previously rust-analyzer reported 8 syntax errors on this valid (nightly) code.
Closes #22038.
Changes
rust.ungram: add optional'type'?before'const'in theConstrule.parser/grammar/items.rs: dispatchtypefollowed byconsttoconsts::konstin both item match sites (coverstype const FOOanddefault type const FOO).parser/grammar/items/consts.rs:konstnowp.eat(T![type])before bumpingconst.type_constadded;cargo xtask codegenregenerated AST nodes and test runner.Test plan
cargo test -p parser(including newtype_consttest)cargo test -p syntaxrust-analyzer parseon the full issue reproduction — zero errors, correctCONSTnode withTYPE_KW+CONST_KW.type const: i32 = 2;) still emits errors.Assisted-by: Claude Opus 4.6