Skip to content

Commit b36f884

Browse files
committed
update parser to support associated const equality
1 parent bdecd93 commit b36f884

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

crates/parser/src/grammar/generic_args.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ fn generic_arg(p: &mut Parser) {
4040
name_ref(p);
4141
opt_generic_arg_list(p, false);
4242
match p.current() {
43-
// test assoc_type_eq
44-
// type T = StreamingIterator<Item<'a> = &'a T>;
4543
T![=] => {
4644
p.bump_any();
47-
types::type_(p);
45+
if types::TYPE_FIRST.contains(p.current()) {
46+
// test assoc_type_eq
47+
// type T = StreamingIterator<Item<'a> = &'a T>;
48+
types::type_(p);
49+
} else {
50+
// test assoc_const_eq
51+
// fn foo<F: Foo<N=3>>() {}
52+
// const TEST: usize = 3
53+
// fn bar<F: Foo<N={TEST}>>() {}
54+
const_arg(p);
55+
}
4856
m.complete(p, ASSOC_TYPE_ARG);
4957
}
5058
// test assoc_type_bound
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn foo<F: Foo<N=3>>() {}
2+
const TEST: usize = 3
3+
fn bar<F: Foo<N={TEST}>>() {}

0 commit comments

Comments
 (0)