Skip to content

Commit 9d19948

Browse files
Merge #8684
8684: Correctly parse negated literals as const args r=jonas-schievink a=jonas-schievink Previously we didn't accept `S::<-0>;` bors r+ Co-authored-by: Jonas Schievink <[email protected]>
2 parents 49b219b + caee3a2 commit 9d19948

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

crates/parser/src/grammar/type_args.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ fn generic_arg(p: &mut Parser) {
5959
expressions::literal(p);
6060
m.complete(p, CONST_ARG);
6161
}
62+
// test const_generic_negated_literal
63+
// fn f() { S::<-1> }
64+
T![-] => {
65+
let lm = p.start();
66+
p.bump(T![-]);
67+
expressions::literal(p);
68+
lm.complete(p, PREFIX_EXPR);
69+
m.complete(p, CONST_ARG);
70+
}
6271
_ => {
6372
types::type_(p);
6473
m.complete(p, TYPE_ARG);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn f() { S::<-1> }

0 commit comments

Comments
 (0)