aboutsummaryrefslogtreecommitdiff
path: root/crates/parser
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-29 01:28:27 +0100
committerGitHub <[email protected]>2021-04-29 01:28:27 +0100
commit9d199486dacb982535ed77a2e8aef830ac44a5b5 (patch)
treea86dcceb9494cd243a2e1f6c10edd1c7be1f8fb5 /crates/parser
parent49b219b1035e20143818d409404b5e6f19a7ad1d (diff)
parentcaee3a2eebd514f5a2f5e68a9fcd4428fa34d41c (diff)
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]>
Diffstat (limited to 'crates/parser')
-rw-r--r--crates/parser/src/grammar/type_args.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/parser/src/grammar/type_args.rs b/crates/parser/src/grammar/type_args.rs
index 42cd426bd..56266b8d4 100644
--- a/crates/parser/src/grammar/type_args.rs
+++ b/crates/parser/src/grammar/type_args.rs
@@ -59,6 +59,15 @@ fn generic_arg(p: &mut Parser) {
59 expressions::literal(p); 59 expressions::literal(p);
60 m.complete(p, CONST_ARG); 60 m.complete(p, CONST_ARG);
61 } 61 }
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 }
62 _ => { 71 _ => {
63 types::type_(p); 72 types::type_(p);
64 m.complete(p, TYPE_ARG); 73 m.complete(p, TYPE_ARG);