From aa433c67d85c5e56c1343ac5eb62872502ca8d55 Mon Sep 17 00:00:00 2001 From: Emil Lauridsen Date: Thu, 9 Jan 2020 18:29:43 +0100 Subject: Parse trait aliases --- crates/ra_parser/src/grammar/items/traits.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/ra_parser/src') diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs index 964fd3041..03dae3cdb 100644 --- a/crates/ra_parser/src/grammar/items/traits.rs +++ b/crates/ra_parser/src/grammar/items/traits.rs @@ -10,6 +10,16 @@ pub(super) fn trait_def(p: &mut Parser) { p.bump(T![trait]); name_r(p, ITEM_RECOVERY_SET); type_params::opt_type_param_list(p); + // test trait_alias + // trait Z = T; + // trait Z = T where U: Copy; + // trait Z = where Self: T; + if p.eat(T![=]) { + type_params::bounds_without_colon(p); + type_params::opt_where_clause(p); + p.expect(T![;]); + return; + } if p.at(T![:]) { type_params::bounds(p); } -- cgit v1.2.3