From fe6c4115f6c8bb5b5f276bafcbd9cc3fc1d504d1 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 26 Dec 2018 21:24:49 +0100 Subject: Rename ImplItem to ImplBlock rustc uses the name ImplItem for items in impls, not the impl {} block itself, which could lead to confusion. --- crates/ra_syntax/src/ast.rs | 2 +- crates/ra_syntax/src/ast/generated.rs | 36 +++++++++++++------------- crates/ra_syntax/src/grammar.ron | 6 ++--- crates/ra_syntax/src/grammar/items.rs | 2 +- crates/ra_syntax/src/reparsing.rs | 2 +- crates/ra_syntax/src/syntax_kinds/generated.rs | 4 +-- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 3aaa5edda..7f986d322 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -279,7 +279,7 @@ impl<'a> NameRef<'a> { } } -impl<'a> ImplItem<'a> { +impl<'a> ImplBlock<'a> { pub fn target_type(self) -> Option> { match self.target() { (Some(t), None) | (_, Some(t)) => Some(t), diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c619fc130..c1c63f555 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -1407,42 +1407,42 @@ impl<'a> IfExpr<'a> { } } -// ImplItem +// ImplBlock #[derive(Debug, Clone, Copy,)] -pub struct ImplItemNode = OwnedRoot> { +pub struct ImplBlockNode = OwnedRoot> { pub(crate) syntax: SyntaxNode, } -pub type ImplItem<'a> = ImplItemNode>; +pub type ImplBlock<'a> = ImplBlockNode>; -impl, R2: TreeRoot> PartialEq> for ImplItemNode { - fn eq(&self, other: &ImplItemNode) -> bool { self.syntax == other.syntax } +impl, R2: TreeRoot> PartialEq> for ImplBlockNode { + fn eq(&self, other: &ImplBlockNode) -> bool { self.syntax == other.syntax } } -impl> Eq for ImplItemNode {} -impl> Hash for ImplItemNode { +impl> Eq for ImplBlockNode {} +impl> Hash for ImplBlockNode { fn hash(&self, state: &mut H) { self.syntax.hash(state) } } -impl<'a> AstNode<'a> for ImplItem<'a> { +impl<'a> AstNode<'a> for ImplBlock<'a> { fn cast(syntax: SyntaxNodeRef<'a>) -> Option { match syntax.kind() { - IMPL_ITEM => Some(ImplItem { syntax }), + IMPL_BLOCK => Some(ImplBlock { syntax }), _ => None, } } fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } } -impl> ImplItemNode { - pub fn borrowed(&self) -> ImplItem { - ImplItemNode { syntax: self.syntax.borrowed() } +impl> ImplBlockNode { + pub fn borrowed(&self) -> ImplBlock { + ImplBlockNode { syntax: self.syntax.borrowed() } } - pub fn owned(&self) -> ImplItemNode { - ImplItemNode { syntax: self.syntax.owned() } + pub fn owned(&self) -> ImplBlockNode { + ImplBlockNode { syntax: self.syntax.owned() } } } -impl<'a> ImplItem<'a> {} +impl<'a> ImplBlock<'a> {} // ImplTraitType #[derive(Debug, Clone, Copy,)] @@ -2157,7 +2157,7 @@ pub enum ModuleItem<'a> { FnDef(FnDef<'a>), TraitDef(TraitDef<'a>), TypeDef(TypeDef<'a>), - ImplItem(ImplItem<'a>), + ImplBlock(ImplBlock<'a>), UseItem(UseItem<'a>), ExternCrateItem(ExternCrateItem<'a>), ConstDef(ConstDef<'a>), @@ -2173,7 +2173,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { FN_DEF => Some(ModuleItem::FnDef(FnDef { syntax })), TRAIT_DEF => Some(ModuleItem::TraitDef(TraitDef { syntax })), TYPE_DEF => Some(ModuleItem::TypeDef(TypeDef { syntax })), - IMPL_ITEM => Some(ModuleItem::ImplItem(ImplItem { syntax })), + IMPL_BLOCK => Some(ModuleItem::ImplBlock(ImplBlock { syntax })), USE_ITEM => Some(ModuleItem::UseItem(UseItem { syntax })), EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), @@ -2189,7 +2189,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { ModuleItem::FnDef(inner) => inner.syntax(), ModuleItem::TraitDef(inner) => inner.syntax(), ModuleItem::TypeDef(inner) => inner.syntax(), - ModuleItem::ImplItem(inner) => inner.syntax(), + ModuleItem::ImplBlock(inner) => inner.syntax(), ModuleItem::UseItem(inner) => inner.syntax(), ModuleItem::ExternCrateItem(inner) => inner.syntax(), ModuleItem::ConstDef(inner) => inner.syntax(), diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 2abb9da61..9a4a96fac 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -128,7 +128,7 @@ Grammar( "STATIC_DEF", "CONST_DEF", "TRAIT_DEF", - "IMPL_ITEM", + "IMPL_BLOCK", "TYPE_DEF", "MACRO_CALL", "TOKEN_TREE", @@ -307,7 +307,7 @@ Grammar( "AttrsOwner", "DocCommentsOwner" ] ), - "ImplItem": (), + "ImplBlock": (collections: []), "ParenType": (options: ["TypeRef"]), "TupleType": ( collections: [["fields", "TypeRef"]] ), @@ -348,7 +348,7 @@ Grammar( ], ), "ModuleItem": ( - enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplItem", + enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplBlock", "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] ), diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/grammar/items.rs index aa5fe0777..b9a00b565 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/grammar/items.rs @@ -152,7 +152,7 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem { // unsafe default impl Foo {} IMPL_KW => { traits::impl_item(p); - IMPL_ITEM + IMPL_BLOCK } _ => { return if has_mods { diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/reparsing.rs index 208cae5c8..7ee71a1b6 100644 --- a/crates/ra_syntax/src/reparsing.rs +++ b/crates/ra_syntax/src/reparsing.rs @@ -100,7 +100,7 @@ fn find_reparsable_node( ITEM_LIST => { let parent = node.parent().unwrap(); match parent.kind() { - IMPL_ITEM => grammar::impl_item_list, + IMPL_BLOCK => grammar::impl_item_list, TRAIT_DEF => grammar::trait_item_list, MODULE => grammar::mod_item_list, _ => return None, diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs index 3a869ad34..ef4588d93 100644 --- a/crates/ra_syntax/src/syntax_kinds/generated.rs +++ b/crates/ra_syntax/src/syntax_kinds/generated.rs @@ -128,7 +128,7 @@ pub enum SyntaxKind { STATIC_DEF, CONST_DEF, TRAIT_DEF, - IMPL_ITEM, + IMPL_BLOCK, TYPE_DEF, MACRO_CALL, TOKEN_TREE, @@ -389,7 +389,7 @@ impl SyntaxKind { STATIC_DEF => &SyntaxInfo { name: "STATIC_DEF" }, CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, - IMPL_ITEM => &SyntaxInfo { name: "IMPL_ITEM" }, + IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" }, TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, -- cgit v1.2.3