aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/has_source.rs4
-rw-r--r--crates/ra_hir/src/semantics.rs2
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_def/src/item_tree.rs4
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs6
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs2
-rw-r--r--crates/ra_hir_def/src/keys.rs2
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs2
-rw-r--r--crates/ra_ide/src/display/short_label.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs2
-rw-r--r--crates/ra_ide/src/goto_implementation.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs2
-rw-r--r--crates/ra_ide_db/src/defs.rs2
-rw-r--r--crates/ra_parser/src/grammar/items/adt.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs42
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast2
-rw-r--r--crates/rust-analyzer/src/handlers.rs2
-rw-r--r--xtask/src/ast_src.rs2
-rw-r--r--xtask/src/codegen/rust.ungram6
23 files changed, 51 insertions, 51 deletions
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 1557b7c83..3a3d82109 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 {
63 } 63 }
64} 64}
65impl HasSource for Union { 65impl HasSource for Union {
66 type Ast = ast::UnionDef; 66 type Ast = ast::Union;
67 fn source(self, db: &dyn HirDatabase) -> InFile<ast::UnionDef> { 67 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Union> {
68 self.id.lookup(db.upcast()).source(db.upcast()) 68 self.id.lookup(db.upcast()).source(db.upcast())
69 } 69 }
70} 70}
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 3e9c54a39..6c8775402 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -582,7 +582,7 @@ to_def_impls![
582 (crate::Module, ast::Module, module_to_def), 582 (crate::Module, ast::Module, module_to_def),
583 (crate::Struct, ast::StructDef, struct_to_def), 583 (crate::Struct, ast::StructDef, struct_to_def),
584 (crate::Enum, ast::EnumDef, enum_to_def), 584 (crate::Enum, ast::EnumDef, enum_to_def),
585 (crate::Union, ast::UnionDef, union_to_def), 585 (crate::Union, ast::Union, union_to_def),
586 (crate::Trait, ast::TraitDef, trait_to_def), 586 (crate::Trait, ast::TraitDef, trait_to_def),
587 (crate::ImplDef, ast::ImplDef, impl_to_def), 587 (crate::ImplDef, ast::ImplDef, impl_to_def),
588 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), 588 (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 4f90f588e..0093a8671 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<'_, '_> {
80 pub(super) fn enum_to_def(&mut self, src: InFile<ast::EnumDef>) -> Option<EnumId> { 80 pub(super) fn enum_to_def(&mut self, src: InFile<ast::EnumDef>) -> Option<EnumId> {
81 self.to_def(src, keys::ENUM) 81 self.to_def(src, keys::ENUM)
82 } 82 }
83 pub(super) fn union_to_def(&mut self, src: InFile<ast::UnionDef>) -> Option<UnionId> { 83 pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> {
84 self.to_def(src, keys::UNION) 84 self.to_def(src, keys::UNION)
85 } 85 }
86 pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> { 86 pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> {
@@ -174,7 +174,7 @@ impl SourceToDefCtx<'_, '_> {
174 let def = self.enum_to_def(container.with_value(it))?; 174 let def = self.enum_to_def(container.with_value(it))?;
175 def.into() 175 def.into()
176 }, 176 },
177 ast::UnionDef(it) => { 177 ast::Union(it) => {
178 let def = self.union_to_def(container.with_value(it))?; 178 let def = self.union_to_def(container.with_value(it))?;
179 VariantId::from(def).into() 179 VariantId::from(def).into()
180 }, 180 },
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 576342af9..d8963f63f 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<'_> {
660 let id = self.find_inner_item(&def)?; 660 let id = self.find_inner_item(&def)?;
661 (EnumLoc { container, id }.intern(self.db).into(), def.name()) 661 (EnumLoc { container, id }.intern(self.db).into(), def.name())
662 } 662 }
663 ast::Item::UnionDef(def) => { 663 ast::Item::Union(def) => {
664 let id = self.find_inner_item(&def)?; 664 let id = self.find_inner_item(&def)?;
665 (UnionLoc { container, id }.intern(self.db).into(), def.name()) 665 (UnionLoc { container, id }.intern(self.db).into(), def.name())
666 } 666 }
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs
index ea61ac217..7bcc13b06 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! {
415 ExternCrate in extern_crates -> ast::ExternCrate, 415 ExternCrate in extern_crates -> ast::ExternCrate,
416 Function in functions -> ast::Fn, 416 Function in functions -> ast::Fn,
417 Struct in structs -> ast::StructDef, 417 Struct in structs -> ast::StructDef,
418 Union in unions -> ast::UnionDef, 418 Union in unions -> ast::Union,
419 Enum in enums -> ast::EnumDef, 419 Enum in enums -> ast::EnumDef,
420 Const in consts -> ast::ConstDef, 420 Const in consts -> ast::ConstDef,
421 Static in statics -> ast::StaticDef, 421 Static in statics -> ast::StaticDef,
@@ -534,7 +534,7 @@ pub struct Union {
534 pub visibility: RawVisibilityId, 534 pub visibility: RawVisibilityId,
535 pub generic_params: GenericParamsId, 535 pub generic_params: GenericParamsId,
536 pub fields: Fields, 536 pub fields: Fields,
537 pub ast_id: FileAstId<ast::UnionDef>, 537 pub ast_id: FileAstId<ast::Union>,
538} 538}
539 539
540#[derive(Debug, Clone, Eq, PartialEq)] 540#[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 df909ee9e..2721a02a5 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 {
79 // Collect inner items for 1-to-1-lowered items. 79 // Collect inner items for 1-to-1-lowered items.
80 match item { 80 match item {
81 ast::Item::StructDef(_) 81 ast::Item::StructDef(_)
82 | ast::Item::UnionDef(_) 82 | ast::Item::Union(_)
83 | ast::Item::EnumDef(_) 83 | ast::Item::EnumDef(_)
84 | ast::Item::Fn(_) 84 | ast::Item::Fn(_)
85 | ast::Item::TypeAlias(_) 85 | ast::Item::TypeAlias(_)
@@ -104,7 +104,7 @@ impl Ctx {
104 let attrs = Attrs::new(item, &self.hygiene); 104 let attrs = Attrs::new(item, &self.hygiene);
105 let items = match item { 105 let items = match item {
106 ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), 106 ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into),
107 ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), 107 ast::Item::Union(ast) => self.lower_union(ast).map(Into::into),
108 ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), 108 ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
109 ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), 109 ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
110 ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), 110 ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
@@ -233,7 +233,7 @@ impl Ctx {
233 res 233 res
234 } 234 }
235 235
236 fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> { 236 fn lower_union(&mut self, union: &ast::Union) -> Option<FileItemTreeId<Union>> {
237 let visibility = self.lower_visibility(union); 237 let visibility = self.lower_visibility(union);
238 let name = union.name()?.as_name(); 238 let name = union.name()?.as_name();
239 let generic_params = self.lower_generic_params(GenericsOwner::Union, union); 239 let generic_params = self.lower_generic_params(GenericsOwner::Union, union);
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index a8f5da1c1..0be021948 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() {
252 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }] 252 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }]
253 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) } 253 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) }
254 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] 254 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }]
255 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) } 255 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) }
256 "##]], 256 "##]],
257 ); 257 );
258} 258}
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs
index 9ca276235..2282aed14 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();
21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); 21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); 22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
23pub const STRUCT: Key<ast::StructDef, StructId> = Key::new(); 23pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
24pub const UNION: Key<ast::UnionDef, UnionId> = Key::new(); 24pub const UNION: Key<ast::Union, UnionId> = Key::new();
25pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); 25pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new();
26 26
27pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); 27pub 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 3e2f0a520..ef3508494 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> {
74 match node { 74 match node {
75 ast::StructDef(it) => (it.name(), it.generic_param_list()), 75 ast::StructDef(it) => (it.name(), it.generic_param_list()),
76 ast::EnumDef(it) => (it.name(), it.generic_param_list()), 76 ast::EnumDef(it) => (it.name(), it.generic_param_list()),
77 ast::UnionDef(it) => (it.name(), it.generic_param_list()), 77 ast::Union(it) => (it.name(), it.generic_param_list()),
78 _ => { 78 _ => {
79 debug!("unexpected node is {:?}", node); 79 debug!("unexpected node is {:?}", node);
80 return Err(mbe::ExpandError::ConversionError) 80 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 78a2598d6..730df1414 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 {
19 } 19 }
20} 20}
21 21
22impl ShortLabel for ast::UnionDef { 22impl ShortLabel for ast::Union {
23 fn short_label(&self) -> Option<String> { 23 fn short_label(&self) -> Option<String> {
24 short_label_from_node(self, "union ") 24 short_label_from_node(self, "union ")
25 } 25 }
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index a8fd1a2fd..874cf72ef 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> {
127 decl_with_detail(it, Some(detail)) 127 decl_with_detail(it, Some(detail))
128 }, 128 },
129 ast::StructDef(it) => decl(it), 129 ast::StructDef(it) => decl(it),
130 ast::UnionDef(it) => decl(it), 130 ast::Union(it) => decl(it),
131 ast::EnumDef(it) => decl(it), 131 ast::EnumDef(it) => decl(it),
132 ast::EnumVariant(it) => decl(it), 132 ast::EnumVariant(it) => decl(it),
133 ast::TraitDef(it) => decl(it), 133 ast::TraitDef(it) => decl(it),
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs
index 16a61d071..e41a4a12b 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(
46 let ty = match node { 46 let ty = match node {
47 ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db), 47 ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db),
48 ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db), 48 ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db),
49 ast::AdtDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db), 49 ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db),
50 }; 50 };
51 51
52 let impls = ImplDef::all_in_crate(sema.db, krate); 52 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 a04b9d893..b0ab160ac 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 {
707 let tag = match parent.kind() { 707 let tag = match parent.kind() {
708 STRUCT_DEF => HighlightTag::Struct, 708 STRUCT_DEF => HighlightTag::Struct,
709 ENUM_DEF => HighlightTag::Enum, 709 ENUM_DEF => HighlightTag::Enum,
710 UNION_DEF => HighlightTag::Union, 710 UNION => HighlightTag::Union,
711 TRAIT_DEF => HighlightTag::Trait, 711 TRAIT_DEF => HighlightTag::Trait,
712 TYPE_ALIAS => HighlightTag::TypeAlias, 712 TYPE_ALIAS => HighlightTag::TypeAlias,
713 TYPE_PARAM => HighlightTag::TypeParam, 713 TYPE_PARAM => HighlightTag::TypeParam,
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 30f18b9cf..11de05958 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
154 let def: hir::Struct = sema.to_def(&it)?; 154 let def: hir::Struct = sema.to_def(&it)?;
155 Some(NameClass::Definition(Definition::ModuleDef(def.into()))) 155 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
156 }, 156 },
157 ast::UnionDef(it) => { 157 ast::Union(it) => {
158 let def: hir::Union = sema.to_def(&it)?; 158 let def: hir::Union = sema.to_def(&it)?;
159 Some(NameClass::Definition(Definition::ModuleDef(def.into()))) 159 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
160 }, 160 },
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs
index 0e96bf77e..ec06e2d45 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) {
11pub(super) fn union_def(p: &mut Parser, m: Marker) { 11pub(super) fn union_def(p: &mut Parser, m: Marker) {
12 assert!(p.at_contextual_kw("union")); 12 assert!(p.at_contextual_kw("union"));
13 p.bump_remap(T![union]); 13 p.bump_remap(T![union]);
14 struct_or_union(p, m, T![union], UNION_DEF); 14 struct_or_union(p, m, T![union], UNION);
15} 15}
16 16
17fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { 17fn 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 8586758b4..7efdeeac6 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 {
124 R_DOLLAR, 124 R_DOLLAR,
125 SOURCE_FILE, 125 SOURCE_FILE,
126 STRUCT_DEF, 126 STRUCT_DEF,
127 UNION_DEF, 127 UNION,
128 ENUM_DEF, 128 ENUM_DEF,
129 FN, 129 FN,
130 RET_TYPE, 130 RET_TYPE,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 1776fb6e6..d153e8528 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 {
199 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 199 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
200} 200}
201#[derive(Debug, Clone, PartialEq, Eq, Hash)] 201#[derive(Debug, Clone, PartialEq, Eq, Hash)]
202pub struct UnionDef { 202pub struct Union {
203 pub(crate) syntax: SyntaxNode, 203 pub(crate) syntax: SyntaxNode,
204} 204}
205impl ast::AttrsOwner for UnionDef {} 205impl ast::AttrsOwner for Union {}
206impl ast::NameOwner for UnionDef {} 206impl ast::NameOwner for Union {}
207impl ast::VisibilityOwner for UnionDef {} 207impl ast::VisibilityOwner for Union {}
208impl ast::GenericParamsOwner for UnionDef {} 208impl ast::GenericParamsOwner for Union {}
209impl UnionDef { 209impl Union {
210 pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } 210 pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
211 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } 211 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
212} 212}
@@ -1284,7 +1284,7 @@ pub enum Item {
1284 StructDef(StructDef), 1284 StructDef(StructDef),
1285 TraitDef(TraitDef), 1285 TraitDef(TraitDef),
1286 TypeAlias(TypeAlias), 1286 TypeAlias(TypeAlias),
1287 UnionDef(UnionDef), 1287 Union(Union),
1288 Use(Use), 1288 Use(Use),
1289} 1289}
1290impl ast::AttrsOwner for Item {} 1290impl ast::AttrsOwner for Item {}
@@ -1393,7 +1393,7 @@ impl ast::VisibilityOwner for ExternItem {}
1393pub enum AdtDef { 1393pub enum AdtDef {
1394 StructDef(StructDef), 1394 StructDef(StructDef),
1395 EnumDef(EnumDef), 1395 EnumDef(EnumDef),
1396 UnionDef(UnionDef), 1396 Union(Union),
1397} 1397}
1398impl ast::AttrsOwner for AdtDef {} 1398impl ast::AttrsOwner for AdtDef {}
1399impl ast::GenericParamsOwner for AdtDef {} 1399impl ast::GenericParamsOwner for AdtDef {}
@@ -1553,8 +1553,8 @@ impl AstNode for TypeAlias {
1553 } 1553 }
1554 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1554 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1555} 1555}
1556impl AstNode for UnionDef { 1556impl AstNode for Union {
1557 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } 1557 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION }
1558 fn cast(syntax: SyntaxNode) -> Option<Self> { 1558 fn cast(syntax: SyntaxNode) -> Option<Self> {
1559 if Self::can_cast(syntax.kind()) { 1559 if Self::can_cast(syntax.kind()) {
1560 Some(Self { syntax }) 1560 Some(Self { syntax })
@@ -2810,8 +2810,8 @@ impl From<TraitDef> for Item {
2810impl From<TypeAlias> for Item { 2810impl From<TypeAlias> for Item {
2811 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } 2811 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
2812} 2812}
2813impl From<UnionDef> for Item { 2813impl From<Union> for Item {
2814 fn from(node: UnionDef) -> Item { Item::UnionDef(node) } 2814 fn from(node: Union) -> Item { Item::Union(node) }
2815} 2815}
2816impl From<Use> for Item { 2816impl From<Use> for Item {
2817 fn from(node: Use) -> Item { Item::Use(node) } 2817 fn from(node: Use) -> Item { Item::Use(node) }
@@ -2820,7 +2820,7 @@ impl AstNode for Item {
2820 fn can_cast(kind: SyntaxKind) -> bool { 2820 fn can_cast(kind: SyntaxKind) -> bool {
2821 match kind { 2821 match kind {
2822 CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL 2822 CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
2823 | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true, 2823 | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true,
2824 _ => false, 2824 _ => false,
2825 } 2825 }
2826 } 2826 }
@@ -2838,7 +2838,7 @@ impl AstNode for Item {
2838 STRUCT_DEF => Item::StructDef(StructDef { syntax }), 2838 STRUCT_DEF => Item::StructDef(StructDef { syntax }),
2839 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), 2839 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
2840 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), 2840 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
2841 UNION_DEF => Item::UnionDef(UnionDef { syntax }), 2841 UNION => Item::Union(Union { syntax }),
2842 USE => Item::Use(Use { syntax }), 2842 USE => Item::Use(Use { syntax }),
2843 _ => return None, 2843 _ => return None,
2844 }; 2844 };
@@ -2858,7 +2858,7 @@ impl AstNode for Item {
2858 Item::StructDef(it) => &it.syntax, 2858 Item::StructDef(it) => &it.syntax,
2859 Item::TraitDef(it) => &it.syntax, 2859 Item::TraitDef(it) => &it.syntax,
2860 Item::TypeAlias(it) => &it.syntax, 2860 Item::TypeAlias(it) => &it.syntax,
2861 Item::UnionDef(it) => &it.syntax, 2861 Item::Union(it) => &it.syntax,
2862 Item::Use(it) => &it.syntax, 2862 Item::Use(it) => &it.syntax,
2863 } 2863 }
2864 } 2864 }
@@ -3378,13 +3378,13 @@ impl From<StructDef> for AdtDef {
3378impl From<EnumDef> for AdtDef { 3378impl From<EnumDef> for AdtDef {
3379 fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } 3379 fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) }
3380} 3380}
3381impl From<UnionDef> for AdtDef { 3381impl From<Union> for AdtDef {
3382 fn from(node: UnionDef) -> AdtDef { AdtDef::UnionDef(node) } 3382 fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
3383} 3383}
3384impl AstNode for AdtDef { 3384impl AstNode for AdtDef {
3385 fn can_cast(kind: SyntaxKind) -> bool { 3385 fn can_cast(kind: SyntaxKind) -> bool {
3386 match kind { 3386 match kind {
3387 STRUCT_DEF | ENUM_DEF | UNION_DEF => true, 3387 STRUCT_DEF | ENUM_DEF | UNION => true,
3388 _ => false, 3388 _ => false,
3389 } 3389 }
3390 } 3390 }
@@ -3392,7 +3392,7 @@ impl AstNode for AdtDef {
3392 let res = match syntax.kind() { 3392 let res = match syntax.kind() {
3393 STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), 3393 STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }),
3394 ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), 3394 ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }),
3395 UNION_DEF => AdtDef::UnionDef(UnionDef { syntax }), 3395 UNION => AdtDef::Union(Union { syntax }),
3396 _ => return None, 3396 _ => return None,
3397 }; 3397 };
3398 Some(res) 3398 Some(res)
@@ -3401,7 +3401,7 @@ impl AstNode for AdtDef {
3401 match self { 3401 match self {
3402 AdtDef::StructDef(it) => &it.syntax, 3402 AdtDef::StructDef(it) => &it.syntax,
3403 AdtDef::EnumDef(it) => &it.syntax, 3403 AdtDef::EnumDef(it) => &it.syntax,
3404 AdtDef::UnionDef(it) => &it.syntax, 3404 AdtDef::Union(it) => &it.syntax,
3405 } 3405 }
3406 } 3406 }
3407} 3407}
@@ -3525,7 +3525,7 @@ impl std::fmt::Display for TypeAlias {
3525 std::fmt::Display::fmt(self.syntax(), f) 3525 std::fmt::Display::fmt(self.syntax(), f)
3526 } 3526 }
3527} 3527}
3528impl std::fmt::Display for UnionDef { 3528impl std::fmt::Display for Union {
3529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3530 std::fmt::Display::fmt(self.syntax(), f) 3530 std::fmt::Display::fmt(self.syntax(), f)
3531 } 3531 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index ffe6746d3..ce11a7513 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 {
476impl ast::DocCommentsOwner for ast::SourceFile {} 476impl ast::DocCommentsOwner for ast::SourceFile {}
477impl ast::DocCommentsOwner for ast::Fn {} 477impl ast::DocCommentsOwner for ast::Fn {}
478impl ast::DocCommentsOwner for ast::StructDef {} 478impl ast::DocCommentsOwner for ast::StructDef {}
479impl ast::DocCommentsOwner for ast::UnionDef {} 479impl ast::DocCommentsOwner for ast::Union {}
480impl ast::DocCommentsOwner for ast::RecordField {} 480impl ast::DocCommentsOwner for ast::RecordField {}
481impl ast::DocCommentsOwner for ast::TupleField {} 481impl ast::DocCommentsOwner for ast::TupleField {}
482impl ast::DocCommentsOwner for ast::EnumDef {} 482impl ast::DocCommentsOwner for ast::EnumDef {}
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 2726516b8..6589e4795 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 @@
1[email protected] 1[email protected]
2 UNION_DEF@0..12 2 [email protected]
3 [email protected] "union" 3 [email protected] "union"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
@@ -9,7 +9,7 @@ [email protected]
9 [email protected] "{" 9 [email protected] "{"
10 [email protected] "}" 10 [email protected] "}"
11 [email protected] "\n" 11 [email protected] "\n"
12 UNION_DEF@13..50 12 [email protected]
13 [email protected] "union" 13 [email protected] "union"
14 [email protected] " " 14 [email protected] " "
15 [email protected] 15 [email protected]
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 2aa075993..b04a505ea 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 @@ [email protected]
1560 [email protected] 1560 [email protected]
1561 [email protected] "{" 1561 [email protected] "{"
1562 [email protected] "\n " 1562 [email protected] "\n "
1563 UNION_DEF@2851..2904 1563 [email protected]
1564 [email protected] "union" 1564 [email protected] "union"
1565 [email protected] " " 1565 [email protected] " "
1566 [email protected] 1566 [email protected]
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 3a0780eb5..6f9186127 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(
927 SyntaxKind::TRAIT_DEF 927 SyntaxKind::TRAIT_DEF
928 | SyntaxKind::STRUCT_DEF 928 | SyntaxKind::STRUCT_DEF
929 | SyntaxKind::ENUM_DEF 929 | SyntaxKind::ENUM_DEF
930 | SyntaxKind::UNION_DEF 930 | SyntaxKind::UNION
931 ) 931 )
932 }) 932 })
933 .map(|it| { 933 .map(|it| {
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 47e9d0c21..e21618cbd 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -94,7 +94,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
94 nodes: &[ 94 nodes: &[
95 "SOURCE_FILE", 95 "SOURCE_FILE",
96 "STRUCT_DEF", 96 "STRUCT_DEF",
97 "UNION_DEF", 97 "UNION",
98 "ENUM_DEF", 98 "ENUM_DEF",
99 "FN", 99 "FN",
100 "RET_TYPE", 100 "RET_TYPE",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index 28b50f021..65082f3d9 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -16,7 +16,7 @@ Item =
16| StructDef 16| StructDef
17| TraitDef 17| TraitDef
18| TypeAlias 18| TypeAlias
19| UnionDef 19| Union
20| Use 20| Use
21 21
22Module = 22Module =
@@ -98,7 +98,7 @@ FieldList =
98 RecordFieldList 98 RecordFieldList
99| TupleFieldList 99| TupleFieldList
100 100
101UnionDef = 101Union =
102 Attr* Visibility? 'union' Name GenericParamList? WhereClause? 102 Attr* Visibility? 'union' Name GenericParamList? WhereClause?
103 RecordFieldList 103 RecordFieldList
104 104
@@ -455,7 +455,7 @@ MetaItem =
455AdtDef = 455AdtDef =
456 StructDef 456 StructDef
457| EnumDef 457| EnumDef
458| UnionDef 458| Union
459 459
460TypeRef = 460TypeRef =
461 ParenType 461 ParenType