From 81359af733f7b13e0bd2196191f2ab294e1b57aa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 20:22:20 +0200 Subject: [PATCH] Simplify trait gramamr --- crates/ra_syntax/src/ast/generated/nodes.rs | 1 - xtask/src/codegen/gen_syntax.rs | 2 ++ xtask/src/codegen/rust.ungram | 11 +++++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 231a0f727e..01aefb60d7 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -267,7 +267,6 @@ impl Impl { pub fn unsafe_token(&self) -> Option { support::token(&self.syntax, T![unsafe]) } pub fn impl_token(&self) -> Option { support::token(&self.syntax, T![impl]) } pub fn const_token(&self) -> Option { support::token(&self.syntax, T![const]) } - pub fn ty(&self) -> Option { support::child(&self.syntax) } pub fn excl_token(&self) -> Option { support::token(&self.syntax, T![!]) } pub fn for_token(&self) -> Option { support::token(&self.syntax, T![for]) } pub fn assoc_item_list(&self) -> Option { support::child(&self.syntax) } diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index e6231ece22..4602ff1d72 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -591,6 +591,8 @@ fn lower_rule(acc: &mut Vec, grammar: &Grammar, label: Option<&String>, r | "index" | "base" | "value" + | "target_type" + | "target_trait" ); if manually_implemented { return; diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 7685f4f068..25d6f7a20a 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -194,12 +194,11 @@ AssocItem = | TypeAlias Impl = - Attr* Visibility? - 'default'? 'unsafe'? 'impl' 'const'? GenericParamList? ( - Type - | '!'? Type 'for' Type - ) WhereClause? - AssocItemList + Attr* Visibility? + 'default'? 'unsafe'? 'impl' 'const'? GenericParamList? + ('!'? target_trait:Type 'for')? target_type:Type + WhereClause? + AssocItemList ExternBlock = Attr* Abi ExternItemList