From dd496223f50232fe98312ee8edc89eb4b5ee3d85 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Tue, 15 Dec 2020 19:23:51 +0100 Subject: Node-ify lifetimes --- crates/parser/src/grammar/items/traits.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/parser/src/grammar/items') diff --git a/crates/parser/src/grammar/items/traits.rs b/crates/parser/src/grammar/items/traits.rs index 8394020da..ab9a12b4d 100644 --- a/crates/parser/src/grammar/items/traits.rs +++ b/crates/parser/src/grammar/items/traits.rs @@ -98,10 +98,10 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool { // `<` `>` - empty generic parameters // `<` `#` - generic parameters with attributes // `<` `const` - const generic parameters - // `<` (LIFETIME|IDENT) `>` - single generic parameter - // `<` (LIFETIME|IDENT) `,` - first generic parameter in a list - // `<` (LIFETIME|IDENT) `:` - generic parameter with bounds - // `<` (LIFETIME|IDENT) `=` - generic parameter with a default + // `<` (LIFETIME_IDENT|IDENT) `>` - single generic parameter + // `<` (LIFETIME_IDENT|IDENT) `,` - first generic parameter in a list + // `<` (LIFETIME_IDENT|IDENT) `:` - generic parameter with bounds + // `<` (LIFETIME_IDENT|IDENT) `=` - generic parameter with a default // The only truly ambiguous case is // `<` IDENT `>` `::` IDENT ... // we disambiguate it in favor of generics (`impl ::absolute::Path { ... }`) @@ -113,7 +113,7 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool { if p.nth(1) == T![#] || p.nth(1) == T![>] || p.nth(1) == CONST_KW { return true; } - (p.nth(1) == LIFETIME || p.nth(1) == IDENT) + (p.nth(1) == LIFETIME_IDENT || p.nth(1) == IDENT) && (p.nth(2) == T![>] || p.nth(2) == T![,] || p.nth(2) == T![:] || p.nth(2) == T![=]) } -- cgit v1.2.3