update parser to support associated const equality

This commit is contained in:
XFFXFF 2022-04-17 20:26:06 +08:00
parent bdecd9374e
commit 6580d75308
3 changed files with 119 additions and 3 deletions

View file

@ -40,11 +40,19 @@ fn generic_arg(p: &mut Parser) {
name_ref(p);
opt_generic_arg_list(p, false);
match p.current() {
// test assoc_type_eq
// type T = StreamingIterator<Item<'a> = &'a T>;
T![=] => {
p.bump_any();
types::type_(p);
if types::TYPE_FIRST.contains(p.current()) {
// test assoc_type_eq
// type T = StreamingIterator<Item<'a> = &'a T>;
types::type_(p);
} else {
// test assoc_const_eq
// fn foo<F: Foo<N=3>>() {}
// const TEST: usize = 3;
// fn bar<F: Foo<N={TEST}>>() {}
const_arg(p);
}
m.complete(p, ASSOC_TYPE_ARG);
}
// test assoc_type_bound