Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/generic_args.rs')
-rw-r--r--crates/parser/src/grammar/generic_args.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs
index 1148c6c35c..bba312009b 100644
--- a/crates/parser/src/grammar/generic_args.rs
+++ b/crates/parser/src/grammar/generic_args.rs
@@ -72,28 +72,24 @@ fn lifetime_arg(p: &mut Parser) {
m.complete(p, LIFETIME_ARG);
}
-// test const_arg
-// type T = S<92>;
-pub(super) fn const_arg(p: &mut Parser) {
- let m = p.start();
+pub(super) fn const_arg_content(p: &mut Parser) {
+ // The tests in here are really for `const_arg`, which wraps the content
+ // CONST_ARG.
match p.current() {
// test const_arg_block
// type T = S<{90 + 2}>;
T!['{'] => {
expressions::block_expr(p);
- m.complete(p, CONST_ARG);
}
// test const_arg_literal
// type T = S<"hello", 0xdeadbeef>;
k if k.is_literal() => {
expressions::literal(p);
- m.complete(p, CONST_ARG);
}
// test const_arg_bool_literal
// type T = S<true>;
T![true] | T![false] => {
expressions::literal(p);
- m.complete(p, CONST_ARG);
}
// test const_arg_negative_number
// type T = S<-92>;
@@ -102,19 +98,25 @@ pub(super) fn const_arg(p: &mut Parser) {
p.bump(T![-]);
expressions::literal(p);
lm.complete(p, PREFIX_EXPR);
- m.complete(p, CONST_ARG);
}
// test const_arg_path
- // struct S<const N: u32 = u32::MAX>;
+ // type T = S<u32::MAX>;
_ => {
let lm = p.start();
paths::use_path(p);
lm.complete(p, PATH_EXPR);
- m.complete(p, CONST_ARG);
}
}
}
+// test const_arg
+// type T = S<92>;
+pub(super) fn const_arg(p: &mut Parser) {
+ let m = p.start();
+ const_arg_content(p);
+ m.complete(p, CONST_ARG);
+}
+
fn type_arg(p: &mut Parser) {
let m = p.start();
types::type_(p);