Repository: rust-analyzer/rust-analyzer
Pull request #5601 (2020-07-30 15:39:40)

Finalize union grammar


bors r+
🤖


Patch:
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 1557b7c834..3a3d821090 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -63,8 +63,8 @@ impl HasSource for Struct {
     }
 }
 impl HasSource for Union {
-    type Ast = ast::UnionDef;
-    fn source(self, db: &dyn HirDatabase) -> InFile<ast::UnionDef> {
+    type Ast = ast::Union;
+    fn source(self, db: &dyn HirDatabase) -> InFile<ast::Union> {
         self.id.lookup(db.upcast()).source(db.upcast())
     }
 }
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 3e9c54a397..6c87754029 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -582,7 +582,7 @@ to_def_impls![
     (crate::Module, ast::Module, module_to_def),
     (crate::Struct, ast::StructDef, struct_to_def),
     (crate::Enum, ast::EnumDef, enum_to_def),
-    (crate::Union, ast::UnionDef, union_to_def),
+    (crate::Union, ast::Union, union_to_def),
     (crate::Trait, ast::TraitDef, trait_to_def),
     (crate::ImplDef, ast::ImplDef, impl_to_def),
     (crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 4f90f588e0..0093a86719 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -80,7 +80,7 @@ impl SourceToDefCtx<'_, '_> {
     pub(super) fn enum_to_def(&mut self, src: InFile<ast::EnumDef>) -> Option<EnumId> {
         self.to_def(src, keys::ENUM)
     }
-    pub(super) fn union_to_def(&mut self, src: InFile<ast::UnionDef>) -> Option<UnionId> {
+    pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> {
         self.to_def(src, keys::UNION)
     }
     pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> {
@@ -174,7 +174,7 @@ impl SourceToDefCtx<'_, '_> {
                         let def = self.enum_to_def(container.with_value(it))?;
                         def.into()
                     },
-                    ast::UnionDef(it) => {
+                    ast::Union(it) => {
                         let def = self.union_to_def(container.with_value(it))?;
                         VariantId::from(def).into()
                     },
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 576342af9a..d8963f63f3 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -660,7 +660,7 @@ impl ExprCollector<'_> {
                         let id = self.find_inner_item(&def)?;
                         (EnumLoc { container, id }.intern(self.db).into(), def.name())
                     }
-                    ast::Item::UnionDef(def) => {
+                    ast::Item::Union(def) => {
                         let id = self.find_inner_item(&def)?;
                         (UnionLoc { container, id }.intern(self.db).into(), def.name())
                     }
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs
index ea61ac2177..7bcc13b06f 100644
--- a/crates/ra_hir_def/src/item_tree.rs
+++ b/crates/ra_hir_def/src/item_tree.rs
@@ -415,7 +415,7 @@ mod_items! {
     ExternCrate in extern_crates -> ast::ExternCrate,
     Function in functions -> ast::Fn,
     Struct in structs -> ast::StructDef,
-    Union in unions -> ast::UnionDef,
+    Union in unions -> ast::Union,
     Enum in enums -> ast::EnumDef,
     Const in consts -> ast::ConstDef,
     Static in statics -> ast::StaticDef,
@@ -534,7 +534,7 @@ pub struct Union {
     pub visibility: RawVisibilityId,
     pub generic_params: GenericParamsId,
     pub fields: Fields,
-    pub ast_id: FileAstId<ast::UnionDef>,
+    pub ast_id: FileAstId<ast::Union>,
 }
 
 #[derive(Debug, Clone, Eq, PartialEq)]
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index df909ee9e4..2721a02a5d 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -79,7 +79,7 @@ impl Ctx {
         // Collect inner items for 1-to-1-lowered items.
         match item {
             ast::Item::StructDef(_)
-            | ast::Item::UnionDef(_)
+            | ast::Item::Union(_)
             | ast::Item::EnumDef(_)
             | ast::Item::Fn(_)
             | ast::Item::TypeAlias(_)
@@ -104,7 +104,7 @@ impl Ctx {
         let attrs = Attrs::new(item, &self.hygiene);
         let items = match item {
             ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into),
-            ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into),
+            ast::Item::Union(ast) => self.lower_union(ast).map(Into::into),
             ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
             ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
             ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
@@ -233,7 +233,7 @@ impl Ctx {
         res
     }
 
-    fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> {
+    fn lower_union(&mut self, union: &ast::Union) -> Option<FileItemTreeId<Union>> {
         let visibility = self.lower_visibility(union);
         let name = union.name()?.as_name();
         let generic_params = self.lower_generic_params(GenericsOwner::Union, union);
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs
index 9ca2762352..2282aed14d 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -21,7 +21,7 @@ pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
 pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
 pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
 pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
-pub const UNION: Key<ast::UnionDef, UnionId> = Key::new();
+pub const UNION: Key<ast::Union, UnionId> = Key::new();
 pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new();
 
 pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new();
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index 3e2f0a5206..ef3508494a 100644
--- a/crates/ra_hir_expand/src/builtin_derive.rs
+++ b/crates/ra_hir_expand/src/builtin_derive.rs
@@ -74,7 +74,7 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> {
         match node {
             ast::StructDef(it) => (it.name(), it.generic_param_list()),
             ast::EnumDef(it) => (it.name(), it.generic_param_list()),
-            ast::UnionDef(it) => (it.name(), it.generic_param_list()),
+            ast::Union(it) => (it.name(), it.generic_param_list()),
             _ => {
                 debug!("unexpected node is {:?}", node);
                 return Err(mbe::ExpandError::ConversionError)
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index 78a2598d6e..730df1414f 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -19,7 +19,7 @@ impl ShortLabel for ast::StructDef {
     }
 }
 
-impl ShortLabel for ast::UnionDef {
+impl ShortLabel for ast::Union {
     fn short_label(&self) -> Option<String> {
         short_label_from_node(self, "union ")
     }
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index a8fd1a2fd0..874cf72ef3 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -127,7 +127,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
                 decl_with_detail(it, Some(detail))
             },
             ast::StructDef(it) => decl(it),
-            ast::UnionDef(it) => decl(it),
+            ast::Union(it) => decl(it),
             ast::EnumDef(it) => decl(it),
             ast::EnumVariant(it) => decl(it),
             ast::TraitDef(it) => decl(it),
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs
index 16a61d071f..e41a4a12b5 100644
--- a/crates/ra_ide/src/goto_implementation.rs
+++ b/crates/ra_ide/src/goto_implementation.rs
@@ -46,7 +46,7 @@ fn impls_for_def(
     let ty = match node {
         ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db),
         ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db),
-        ast::AdtDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db),
+        ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db),
     };
 
     let impls = ImplDef::all_in_crate(sema.db, krate);
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index a04b9d893b..b0ab160ace 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -707,7 +707,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
     let tag = match parent.kind() {
         STRUCT_DEF => HighlightTag::Struct,
         ENUM_DEF => HighlightTag::Enum,
-        UNION_DEF => HighlightTag::Union,
+        UNION => HighlightTag::Union,
         TRAIT_DEF => HighlightTag::Trait,
         TYPE_ALIAS => HighlightTag::TypeAlias,
         TYPE_PARAM => HighlightTag::TypeParam,
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 30f18b9cfa..11de059583 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -154,7 +154,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
                 let def: hir::Struct = sema.to_def(&it)?;
                 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
             },
-            ast::UnionDef(it) => {
+            ast::Union(it) => {
                 let def: hir::Union = sema.to_def(&it)?;
                 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
             },
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs
index 0e96bf77e2..ec06e2d451 100644
--- a/crates/ra_parser/src/grammar/items/adt.rs
+++ b/crates/ra_parser/src/grammar/items/adt.rs
@@ -11,7 +11,7 @@ pub(super) fn struct_def(p: &mut Parser, m: Marker) {
 pub(super) fn union_def(p: &mut Parser, m: Marker) {
     assert!(p.at_contextual_kw("union"));
     p.bump_remap(T![union]);
-    struct_or_union(p, m, T![union], UNION_DEF);
+    struct_or_union(p, m, T![union], UNION);
 }
 
 fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) {
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 8586758b40..7efdeeac6f 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -124,7 +124,7 @@ pub enum SyntaxKind {
     R_DOLLAR,
     SOURCE_FILE,
     STRUCT_DEF,
-    UNION_DEF,
+    UNION,
     ENUM_DEF,
     FN,
     RET_TYPE,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 1776fb6e69..d153e8528a 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -199,14 +199,14 @@ impl TypeAlias {
     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
-pub struct UnionDef {
+pub struct Union {
     pub(crate) syntax: SyntaxNode,
 }
-impl ast::AttrsOwner for UnionDef {}
-impl ast::NameOwner for UnionDef {}
-impl ast::VisibilityOwner for UnionDef {}
-impl ast::GenericParamsOwner for UnionDef {}
-impl UnionDef {
+impl ast::AttrsOwner for Union {}
+impl ast::NameOwner for Union {}
+impl ast::VisibilityOwner for Union {}
+impl ast::GenericParamsOwner for Union {}
+impl Union {
     pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
     pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
 }
@@ -1284,7 +1284,7 @@ pub enum Item {
     StructDef(StructDef),
     TraitDef(TraitDef),
     TypeAlias(TypeAlias),
-    UnionDef(UnionDef),
+    Union(Union),
     Use(Use),
 }
 impl ast::AttrsOwner for Item {}
@@ -1393,7 +1393,7 @@ impl ast::VisibilityOwner for ExternItem {}
 pub enum AdtDef {
     StructDef(StructDef),
     EnumDef(EnumDef),
-    UnionDef(UnionDef),
+    Union(Union),
 }
 impl ast::AttrsOwner for AdtDef {}
 impl ast::GenericParamsOwner for AdtDef {}
@@ -1553,8 +1553,8 @@ impl AstNode for TypeAlias {
     }
     fn syntax(&self) -> &SyntaxNode { &self.syntax }
 }
-impl AstNode for UnionDef {
-    fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF }
+impl AstNode for Union {
+    fn can_cast(kind: SyntaxKind) -> bool { kind == UNION }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
             Some(Self { syntax })
@@ -2810,8 +2810,8 @@ impl From<TraitDef> for Item {
 impl From<TypeAlias> for Item {
     fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
 }
-impl From<UnionDef> for Item {
-    fn from(node: UnionDef) -> Item { Item::UnionDef(node) }
+impl From<Union> for Item {
+    fn from(node: Union) -> Item { Item::Union(node) }
 }
 impl From<Use> for Item {
     fn from(node: Use) -> Item { Item::Use(node) }
@@ -2820,7 +2820,7 @@ impl AstNode for Item {
     fn can_cast(kind: SyntaxKind) -> bool {
         match kind {
             CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
-            | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true,
+            | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true,
             _ => false,
         }
     }
@@ -2838,7 +2838,7 @@ impl AstNode for Item {
             STRUCT_DEF => Item::StructDef(StructDef { syntax }),
             TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
             TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
-            UNION_DEF => Item::UnionDef(UnionDef { syntax }),
+            UNION => Item::Union(Union { syntax }),
             USE => Item::Use(Use { syntax }),
             _ => return None,
         };
@@ -2858,7 +2858,7 @@ impl AstNode for Item {
             Item::StructDef(it) => &it.syntax,
             Item::TraitDef(it) => &it.syntax,
             Item::TypeAlias(it) => &it.syntax,
-            Item::UnionDef(it) => &it.syntax,
+            Item::Union(it) => &it.syntax,
             Item::Use(it) => &it.syntax,
         }
     }
@@ -3378,13 +3378,13 @@ impl From<StructDef> for AdtDef {
 impl From<EnumDef> for AdtDef {
     fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) }
 }
-impl From<UnionDef> for AdtDef {
-    fn from(node: UnionDef) -> AdtDef { AdtDef::UnionDef(node) }
+impl From<Union> for AdtDef {
+    fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
 }
 impl AstNode for AdtDef {
     fn can_cast(kind: SyntaxKind) -> bool {
         match kind {
-            STRUCT_DEF | ENUM_DEF | UNION_DEF => true,
+            STRUCT_DEF | ENUM_DEF | UNION => true,
             _ => false,
         }
     }
@@ -3392,7 +3392,7 @@ impl AstNode for AdtDef {
         let res = match syntax.kind() {
             STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }),
             ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }),
-            UNION_DEF => AdtDef::UnionDef(UnionDef { syntax }),
+            UNION => AdtDef::Union(Union { syntax }),
             _ => return None,
         };
         Some(res)
@@ -3401,7 +3401,7 @@ impl AstNode for AdtDef {
         match self {
             AdtDef::StructDef(it) => &it.syntax,
             AdtDef::EnumDef(it) => &it.syntax,
-            AdtDef::UnionDef(it) => &it.syntax,
+            AdtDef::Union(it) => &it.syntax,
         }
     }
 }
@@ -3525,7 +3525,7 @@ impl std::fmt::Display for TypeAlias {
         std::fmt::Display::fmt(self.syntax(), f)
     }
 }
-impl std::fmt::Display for UnionDef {
+impl std::fmt::Display for Union {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         std::fmt::Display::fmt(self.syntax(), f)
     }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index ffe6746d38..ce11a75138 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -476,7 +476,7 @@ impl ast::TokenTree {
 impl ast::DocCommentsOwner for ast::SourceFile {}
 impl ast::DocCommentsOwner for ast::Fn {}
 impl ast::DocCommentsOwner for ast::StructDef {}
-impl ast::DocCommentsOwner for ast::UnionDef {}
+impl ast::DocCommentsOwner for ast::Union {}
 impl ast::DocCommentsOwner for ast::RecordField {}
 impl ast::DocCommentsOwner for ast::TupleField {}
 impl ast::DocCommentsOwner for ast::EnumDef {}
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 3a0780eb5f..6f91861271 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -927,7 +927,7 @@ pub(crate) fn handle_code_lens(
                         SyntaxKind::TRAIT_DEF
                             | SyntaxKind::STRUCT_DEF
                             | SyntaxKind::ENUM_DEF
-                            | SyntaxKind::UNION_DEF
+                            | SyntaxKind::UNION
                     )
                 })
                 .map(|it| {
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 47e9d0c215..e21618cbd8 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -94,7 +94,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
     nodes: &[
         "SOURCE_FILE",
         "STRUCT_DEF",
-        "UNION_DEF",
+        "UNION",
         "ENUM_DEF",
         "FN",
         "RET_TYPE",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index 28b50f021a..65082f3d91 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -16,7 +16,7 @@ Item =
 | StructDef
 | TraitDef
 | TypeAlias
-| UnionDef
+| Union
 | Use
 
 Module =
@@ -98,7 +98,7 @@ FieldList =
   RecordFieldList
 | TupleFieldList
 
-UnionDef =
+Union =
   Attr* Visibility? 'union' Name GenericParamList? WhereClause?
   RecordFieldList
 
@@ -455,7 +455,7 @@ MetaItem =
 AdtDef =
   StructDef
 | EnumDef
-| UnionDef
+| Union
 
 TypeRef =
   ParenType


Test patch:
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index a8f5da1c12..0be0219486 100644
--- a/crates/ra_hir_def/src/item_tree/tests.rs
+++ b/crates/ra_hir_def/src/item_tree/tests.rs
@@ -252,7 +252,7 @@ fn smoke() {
             #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }]
             Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::EnumDef>(6) }
             #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }]
-            Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::UnionDef>(7) }
+            Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Union>(7) }
         "##]],
     );
 }
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast
index 2726516b8e..6589e47951 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast
@@ -1,5 +1,5 @@
 SOURCE_FILE@0..51
-  UNION_DEF@0..12
+  UNION@0..12
     UNION_KW@0..5 "union"
     WHITESPACE@5..6 " "
     NAME@6..9
@@ -9,7 +9,7 @@ SOURCE_FILE@0..51
       L_CURLY@10..11 "{"
       R_CURLY@11..12 "}"
   WHITESPACE@12..13 "\n"
-  UNION_DEF@13..50
+  UNION@13..50
     UNION_KW@13..18 "union"
     WHITESPACE@18..19 " "
     NAME@19..22
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
index 2aa075993f..b04a505ead 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -1560,7 +1560,7 @@ SOURCE_FILE@0..3813
     BLOCK_EXPR@2845..2906
       L_CURLY@2845..2846 "{"
       WHITESPACE@2846..2851 "\n    "
-      UNION_DEF@2851..2904
+      UNION@2851..2904
         UNION_KW@2851..2856 "union"
         WHITESPACE@2856..2857 " "
         NAME@2857..2862