From 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:50:40 +0200 Subject: Rename StructDef -> Struct --- .../ra_assists/src/handlers/change_visibility.rs | 4 +-- crates/ra_assists/src/handlers/generate_new.rs | 6 ++-- crates/ra_assists/src/handlers/move_bounds.rs | 2 +- crates/ra_hir/src/has_source.rs | 4 +-- crates/ra_hir/src/semantics.rs | 2 +- crates/ra_hir/src/semantics/source_to_def.rs | 6 ++-- crates/ra_hir_def/src/body/lower.rs | 2 +- crates/ra_hir_def/src/item_tree.rs | 4 +-- crates/ra_hir_def/src/item_tree/lower.rs | 6 ++-- crates/ra_hir_def/src/item_tree/tests.rs | 6 ++-- crates/ra_hir_def/src/keys.rs | 2 +- crates/ra_hir_expand/src/builtin_derive.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 4 +-- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 4 +-- crates/ra_ide/src/goto_implementation.rs | 2 +- crates/ra_ide/src/hover.rs | 34 +++++++++--------- crates/ra_ide/src/references.rs | 16 ++++----- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide_db/src/defs.rs | 2 +- crates/ra_ide_db/src/symbol_index.rs | 4 +-- crates/ra_mbe/src/syntax_bridge.rs | 2 +- crates/ra_mbe/src/tests.rs | 4 +-- crates/ra_parser/src/grammar/items/adt.rs | 2 +- crates/ra_parser/src/syntax_kind/generated.rs | 4 +-- crates/ra_syntax/src/ast.rs | 2 +- crates/ra_syntax/src/ast/generated/nodes.rs | 42 +++++++++++----------- crates/ra_syntax/src/ast/node_ext.rs | 4 +-- crates/ra_syntax/src/parsing/text_tree_sink.rs | 4 +-- .../err/0000_struct_field_missing_comma.rast | 2 +- .../parser/err/0001_item_recovery_in_file.rast | 2 +- .../test_data/parser/err/0003_C++_semicolon.rast | 2 +- .../parser/err/0006_named_field_recovery.rast | 2 +- .../parser/err/0007_stray_curly_in_file.rast | 2 +- .../err/0009_broken_struct_type_parameter.rast | 4 +-- .../test_data/parser/err/0011_extern_struct.rast | 2 +- .../test_data/parser/err/0013_invalid_type.rast | 2 +- .../test_data/parser/err/0022_bad_exprs.rast | 2 +- .../parser/inline/ok/0007_type_param_bounds.rast | 2 +- .../parser/inline/ok/0022_crate_visibility.rast | 8 ++--- .../parser/inline/ok/0040_crate_keyword_vis.rast | 4 +-- .../parser/inline/ok/0054_record_field_attrs.rast | 2 +- .../parser/inline/ok/0062_mod_contents.rast | 2 +- .../parser/inline/ok/0083_struct_items.rast | 10 +++--- .../parser/inline/ok/0090_type_param_default.rast | 2 +- .../parser/inline/ok/0114_tuple_struct_where.rast | 4 +-- .../parser/inline/ok/0115_tuple_field_attrs.rast | 2 +- .../inline/ok/0134_nocontentexpr_after_item.rast | 2 +- .../parser/inline/ok/0147_const_param.rast | 2 +- .../test_data/parser/ok/0001_struct_item.rast | 2 +- .../parser/ok/0002_struct_item_field.rast | 2 +- .../test_data/parser/ok/0008_mod_item.rast | 2 +- .../test_data/parser/ok/0016_struct_flavors.rast | 10 +++--- .../parser/ok/0018_struct_type_params.rast | 30 ++++++++-------- .../parser/ok/0020_type_param_bounds.rast | 20 +++++------ .../parser/ok/0040_raw_struct_item_field.rast | 2 +- .../test_data/parser/ok/0042_ufcs_call_list.rast | 2 +- .../parser/ok/0043_complex_assignment.rast | 2 +- crates/rust-analyzer/src/handlers.rs | 2 +- crates/rust-analyzer/src/to_proto.rs | 2 +- xtask/src/ast_src.rs | 2 +- xtask/src/codegen/gen_syntax.rs | 2 +- xtask/src/codegen/rust.ungram | 6 ++-- 63 files changed, 163 insertions(+), 163 deletions(-) diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 72d06d55b..12c40a3cc 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs @@ -1,7 +1,7 @@ use ra_syntax::{ ast::{self, NameOwner, VisibilityOwner}, AstNode, - SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY}, + SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT, TRAIT_DEF, VISIBILITY}, T, }; use test_utils::mark; @@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { let (offset, target) = if let Some(keyword) = item_keyword { let parent = keyword.parent(); - let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF]; + let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT, ENUM_DEF, TRAIT_DEF]; // Parent is not a definition, can't add visibility if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { return None; diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs index 340f9b103..22b47d254 100644 --- a/crates/ra_assists/src/handlers/generate_new.rs +++ b/crates/ra_assists/src/handlers/generate_new.rs @@ -31,7 +31,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; // // ``` pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - let strukt = ctx.find_node_at_offset::()?; + let strukt = ctx.find_node_at_offset::()?; // We want to only apply this to non-union structs with named fields let field_list = match strukt.kind() { @@ -91,7 +91,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> // Generates the surrounding `impl Type { }` including type and lifetime // parameters -fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { +fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String { let type_params = strukt.generic_param_list(); let mut buf = String::with_capacity(code.len()); buf.push_str("\n\nimpl"); @@ -122,7 +122,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { // // FIXME: change the new fn checking to a more semantic approach when that's more // viable (e.g. we process proc macros, etc) -fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option> { +fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option> { let db = ctx.db(); let module = strukt.syntax().ancestors().find(|node| { ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 15327facb..3b82477c5 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs @@ -41,7 +41,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), - ast::StructDef(it) => { + ast::Struct(it) => { it.syntax().children_with_tokens() .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? }, diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 3a3d82109..811a12e00 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs @@ -57,8 +57,8 @@ impl HasSource for Field { } } impl HasSource for Struct { - type Ast = ast::StructDef; - fn source(self, db: &dyn HirDatabase) -> InFile { + type Ast = ast::Struct; + fn source(self, db: &dyn HirDatabase) -> InFile { 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 6c8775402..7df018b05 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -580,7 +580,7 @@ macro_rules! to_def_impls { to_def_impls![ (crate::Module, ast::Module, module_to_def), - (crate::Struct, ast::StructDef, struct_to_def), + (crate::Struct, ast::Struct, struct_to_def), (crate::Enum, ast::EnumDef, enum_to_def), (crate::Union, ast::Union, union_to_def), (crate::Trait, ast::TraitDef, trait_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 0093a8671..75b773352 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -74,7 +74,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn fn_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::FUNCTION) } - pub(super) fn struct_to_def(&mut self, src: InFile) -> Option { + pub(super) fn struct_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::STRUCT) } pub(super) fn enum_to_def(&mut self, src: InFile) -> Option { @@ -166,7 +166,7 @@ impl SourceToDefCtx<'_, '_> { let def = self.fn_to_def(container.with_value(it))?; DefWithBodyId::from(def).into() }, - ast::StructDef(it) => { + ast::Struct(it) => { let def = self.struct_to_def(container.with_value(it))?; VariantId::from(def).into() }, @@ -205,7 +205,7 @@ impl SourceToDefCtx<'_, '_> { let res: GenericDefId = match_ast! { match (container.value) { ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), - ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(), + ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index d8963f63f..840841d87 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -652,7 +652,7 @@ impl ExprCollector<'_> { let id = self.find_inner_item(&def)?; (StaticLoc { container, id }.intern(self.db).into(), def.name()) } - ast::Item::StructDef(def) => { + ast::Item::Struct(def) => { let id = self.find_inner_item(&def)?; (StructLoc { 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 7bcc13b06..6b96a4c20 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs @@ -414,7 +414,7 @@ mod_items! { Import in imports -> ast::Use, ExternCrate in extern_crates -> ast::ExternCrate, Function in functions -> ast::Fn, - Struct in structs -> ast::StructDef, + Struct in structs -> ast::Struct, Union in unions -> ast::Union, Enum in enums -> ast::EnumDef, Const in consts -> ast::ConstDef, @@ -514,7 +514,7 @@ pub struct Struct { pub visibility: RawVisibilityId, pub generic_params: GenericParamsId, pub fields: Fields, - pub ast_id: FileAstId, + pub ast_id: FileAstId, pub kind: StructDefKind, } diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 2721a02a5..a85618015 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -78,7 +78,7 @@ impl Ctx { // Collect inner items for 1-to-1-lowered items. match item { - ast::Item::StructDef(_) + ast::Item::Struct(_) | ast::Item::Union(_) | ast::Item::EnumDef(_) | ast::Item::Fn(_) @@ -103,7 +103,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::Struct(ast) => self.lower_struct(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), @@ -165,7 +165,7 @@ impl Ctx { } } - fn lower_struct(&mut self, strukt: &ast::StructDef) -> Option> { + fn lower_struct(&mut self, strukt: &ast::Struct) -> Option> { let visibility = self.lower_visibility(strukt); let name = strukt.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Struct, strukt); diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs index 0be021948..db37223da 100644 --- a/crates/ra_hir_def/src/item_tree/tests.rs +++ b/crates/ra_hir_def/src/item_tree/tests.rs @@ -244,11 +244,11 @@ fn smoke() { > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }] > Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::(11) } #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct0"))] }, input: None }]) }] - Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::(3), kind: Unit } + Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::(3), kind: Unit } #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct1"))] }, input: None }]) }] - Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::(0..1)), ast_id: FileAstId::(4), kind: Tuple } + Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::(0..1)), ast_id: FileAstId::(4), kind: Tuple } #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }] - Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::(1..2)), ast_id: FileAstId::(5), kind: Record } + Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::(1..2)), ast_id: FileAstId::(5), kind: Record } #[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::(0..1), ast_id: FileAstId::(6) } #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index 2282aed14..d9ec0f305 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -20,7 +20,7 @@ pub const STATIC: Key = Key::new(); pub const TYPE_ALIAS: Key = Key::new(); pub const IMPL: Key = Key::new(); pub const TRAIT: Key = Key::new(); -pub const STRUCT: Key = Key::new(); +pub const STRUCT: Key = Key::new(); pub const UNION: Key = Key::new(); pub const ENUM: Key = Key::new(); diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index ef3508494..489ec0513 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs @@ -72,7 +72,7 @@ fn parse_adt(tt: &tt::Subtree) -> Result { let node = item.syntax(); let (name, params) = match_ast! { match node { - ast::StructDef(it) => (it.name(), it.generic_param_list()), + ast::Struct(it) => (it.name(), it.generic_param_list()), ast::EnumDef(it) => (it.name(), it.generic_param_list()), ast::Union(it) => (it.name(), it.generic_param_list()), _ => { diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 797d2d8e3..5686faaab 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -380,7 +380,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option match_ast! { match node { ast::Fn(it) => it.doc_comment_text(), - ast::StructDef(it) => it.doc_comment_text(), + ast::Struct(it) => it.doc_comment_text(), ast::EnumDef(it) => it.doc_comment_text(), ast::TraitDef(it) => it.doc_comment_text(), ast::Module(it) => it.doc_comment_text(), @@ -405,7 +405,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> match_ast! { match node { ast::Fn(it) => it.short_label(), - ast::StructDef(it) => it.short_label(), + ast::Struct(it) => it.short_label(), ast::EnumDef(it) => it.short_label(), ast::TraitDef(it) => it.short_label(), ast::Module(it) => it.short_label(), diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 730df1414..504b884c5 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -13,7 +13,7 @@ impl ShortLabel for ast::Fn { } } -impl ShortLabel for ast::StructDef { +impl ShortLabel for ast::Struct { fn short_label(&self) -> Option { short_label_from_node(self, "struct ") } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 874cf72ef..6f198fcbc 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -126,7 +126,7 @@ fn structure_node(node: &SyntaxNode) -> Option { decl_with_detail(it, Some(detail)) }, - ast::StructDef(it) => decl(it), + ast::Struct(it) => decl(it), ast::Union(it) => decl(it), ast::EnumDef(it) => decl(it), ast::EnumVariant(it) => decl(it), @@ -238,7 +238,7 @@ fn very_obsolete() {} label: "Foo", navigation_range: 8..11, node_range: 1..26, - kind: STRUCT_DEF, + kind: STRUCT, detail: None, deprecated: false, }, diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index e41a4a12b..699fad57d 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs @@ -44,7 +44,7 @@ fn impls_for_def( krate: Crate, ) -> Option> { let ty = match node { - ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db), + ast::AdtDef::Struct(def) => sema.to_def(def)?.ty(sema.db), ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db), ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db), }; diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 4ef7efd26..83228af2e 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -1443,7 +1443,7 @@ fn main() { let s<|>t = S{ f1:0 }; } 7..8, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1482,7 +1482,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } 24..25, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1501,7 +1501,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } 7..10, ), name: "Arg", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct Arg", @@ -1540,7 +1540,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 24..25, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1559,7 +1559,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } 7..10, ), name: "Arg", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct Arg", @@ -1601,7 +1601,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 7..8, ), name: "A", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct A", @@ -1620,7 +1620,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 22..23, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -1639,7 +1639,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } 53..54, ), name: "C", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "pub struct C", @@ -1737,7 +1737,7 @@ fn main() { let s<|>t = foo(); } 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -1877,7 +1877,7 @@ fn main() { let s<|>t = foo(); } 39..41, ), name: "S1", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S1", @@ -1896,7 +1896,7 @@ fn main() { let s<|>t = foo(); } 52..54, ), name: "S2", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S2", @@ -2011,7 +2011,7 @@ fn foo(ar<|>g: &impl Foo + Bar) {} 36..37, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2068,7 +2068,7 @@ fn foo(ar<|>g: &impl Foo) {} 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2111,7 +2111,7 @@ fn main() { let s<|>t = foo(); } 49..50, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -2224,7 +2224,7 @@ fn foo(ar<|>g: &dyn Foo) {} 23..24, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", @@ -2284,7 +2284,7 @@ fn foo(a<|>rg: &impl ImplTrait>>>) {} 50..51, ), name: "B", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct B", @@ -2322,7 +2322,7 @@ fn foo(a<|>rg: &impl ImplTrait>>>) {} 65..66, ), name: "S", - kind: STRUCT_DEF, + kind: STRUCT, container_name: None, description: Some( "struct S", diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index d61ac271e..2a62dab6c 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -172,7 +172,7 @@ fn get_struct_def_name_for_struct_literal_search( if let Some(name) = sema.find_node_at_offset_with_descend::(&syntax, left.text_range().start()) { - return name.syntax().ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); + return name.syntax().ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); } if sema .find_node_at_offset_with_descend::( @@ -181,7 +181,7 @@ fn get_struct_def_name_for_struct_literal_search( ) .is_some() { - return left.ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); + return left.ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); } } None @@ -212,7 +212,7 @@ fn main() { ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..26 7..10 Other", + "Foo STRUCT FileId(1) 0..26 7..10 Other", &["FileId(1) 101..104 StructLiteral"], ); } @@ -230,7 +230,7 @@ struct Foo<|> {} ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..13 7..10 Other", + "Foo STRUCT FileId(1) 0..13 7..10 Other", &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], ); } @@ -248,7 +248,7 @@ struct Foo <|>{} ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", + "Foo STRUCT FileId(1) 0..16 7..10 Other", &["FileId(1) 64..67 StructLiteral"], ); } @@ -267,7 +267,7 @@ fn main() { ); check_result( refs, - "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", + "Foo STRUCT FileId(1) 0..16 7..10 Other", &["FileId(1) 54..57 StructLiteral"], ); } @@ -431,7 +431,7 @@ fn f() { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "Foo STRUCT_DEF FileId(2) 17..51 28..31 Other", + "Foo STRUCT FileId(2) 17..51 28..31 Other", &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], ); } @@ -486,7 +486,7 @@ pub(super) struct Foo<|> { let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); check_result( refs, - "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", + "Foo STRUCT FileId(3) 0..41 18..21 Other", &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], ); } diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index b0ab160ac..ba1fd6242 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -705,7 +705,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { }; let tag = match parent.kind() { - STRUCT_DEF => HighlightTag::Struct, + STRUCT => HighlightTag::Struct, ENUM_DEF => HighlightTag::Enum, UNION => HighlightTag::Union, TRAIT_DEF => HighlightTag::Trait, diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 11de05958..6a2180f6c 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -150,7 +150,7 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option let def = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, - ast::StructDef(it) => { + ast::Struct(it) => { let def: hir::Struct = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index b4e85b88e..da19f0f33 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs @@ -344,7 +344,7 @@ impl Query { } fn is_type(kind: SyntaxKind) -> bool { - matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS) + matches!(kind, STRUCT | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS) } /// The actual data that is stored in the index. It should be as compact as @@ -398,7 +398,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { match_ast! { match node { ast::Fn(it) => decl(it), - ast::StructDef(it) => decl(it), + ast::Struct(it) => decl(it), ast::EnumDef(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index fc4133a67..5fc48507f 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs @@ -825,7 +825,7 @@ mod tests { #[test] fn test_token_tree_multi_char_punct() { let source_file = ast::SourceFile::parse("struct Foo { a: x::Y }").ok().unwrap(); - let struct_def = source_file.syntax().descendants().find_map(ast::StructDef::cast).unwrap(); + let struct_def = source_file.syntax().descendants().find_map(ast::Struct::cast).unwrap(); let tt = ast_to_token_tree(&struct_def).unwrap().0; token_tree_to_syntax_node(&tt, FragmentKind::Item).unwrap(); } diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index d7b198458..21af06e73 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -490,7 +490,7 @@ fn test_expand_to_item_list() { format!("{:#?}", tree).trim(), r#" MACRO_ITEMS@0..40 - STRUCT_DEF@0..20 + STRUCT@0..20 STRUCT_KW@0..6 "struct" NAME@6..9 IDENT@6..9 "Foo" @@ -506,7 +506,7 @@ MACRO_ITEMS@0..40 NAME_REF@16..19 IDENT@16..19 "u32" R_CURLY@19..20 "}" - STRUCT_DEF@20..40 + STRUCT@20..40 STRUCT_KW@20..26 "struct" NAME@26..29 IDENT@26..29 "Bar" diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index ec06e2d45..2f5cfb6b6 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs @@ -5,7 +5,7 @@ use super::*; pub(super) fn struct_def(p: &mut Parser, m: Marker) { assert!(p.at(T![struct])); p.bump(T![struct]); - struct_or_union(p, m, T![struct], STRUCT_DEF); + struct_or_union(p, m, T![struct], STRUCT); } pub(super) fn union_def(p: &mut Parser, m: Marker) { diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 7efdeeac6..4fad765c7 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -1,7 +1,7 @@ //! Generated file, do not edit by hand, see `xtask/src/codegen` #![allow(bad_style, missing_docs, unreachable_pub)] -#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."] +#[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[repr(u16)] pub enum SyntaxKind { @@ -123,7 +123,7 @@ pub enum SyntaxKind { L_DOLLAR, R_DOLLAR, SOURCE_FILE, - STRUCT_DEF, + STRUCT, UNION, ENUM_DEF, FN, diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 452e67c70..b69b6e85e 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -235,7 +235,7 @@ fn test_comments_preserve_trailing_whitespace() { ) .ok() .unwrap(); - let def = file.syntax().descendants().find_map(StructDef::cast).unwrap(); + let def = file.syntax().descendants().find_map(Struct::cast).unwrap(); assert_eq!( "Representation of a Realm. \nIn the specification these are called Realm Records.", def.doc_comment_text().unwrap() diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index d153e8528..0fd3d4f1b 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -155,14 +155,14 @@ impl StaticDef { pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StructDef { +pub struct Struct { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for StructDef {} -impl ast::NameOwner for StructDef {} -impl ast::VisibilityOwner for StructDef {} -impl ast::GenericParamsOwner for StructDef {} -impl StructDef { +impl ast::AttrsOwner for Struct {} +impl ast::NameOwner for Struct {} +impl ast::VisibilityOwner for Struct {} +impl ast::GenericParamsOwner for Struct {} +impl Struct { pub fn struct_token(&self) -> Option { support::token(&self.syntax, T![struct]) } pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } pub fn field_list(&self) -> Option { support::child(&self.syntax) } @@ -1281,7 +1281,7 @@ pub enum Item { MacroCall(MacroCall), Module(Module), StaticDef(StaticDef), - StructDef(StructDef), + Struct(Struct), TraitDef(TraitDef), TypeAlias(TypeAlias), Union(Union), @@ -1391,7 +1391,7 @@ impl ast::NameOwner for ExternItem {} impl ast::VisibilityOwner for ExternItem {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AdtDef { - StructDef(StructDef), + Struct(Struct), EnumDef(EnumDef), Union(Union), } @@ -1520,8 +1520,8 @@ impl AstNode for StaticDef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for StructDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } +impl AstNode for Struct { + fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2801,8 +2801,8 @@ impl From for Item { impl From for Item { fn from(node: StaticDef) -> Item { Item::StaticDef(node) } } -impl From for Item { - fn from(node: StructDef) -> Item { Item::StructDef(node) } +impl From for Item { + fn from(node: Struct) -> Item { Item::Struct(node) } } impl From for Item { fn from(node: TraitDef) -> Item { Item::TraitDef(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 | USE => true, + | MODULE | STATIC_DEF | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, _ => false, } } @@ -2835,7 +2835,7 @@ impl AstNode for Item { MACRO_CALL => Item::MacroCall(MacroCall { syntax }), MODULE => Item::Module(Module { syntax }), STATIC_DEF => Item::StaticDef(StaticDef { syntax }), - STRUCT_DEF => Item::StructDef(StructDef { syntax }), + STRUCT => Item::Struct(Struct { syntax }), TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), UNION => Item::Union(Union { syntax }), @@ -2855,7 +2855,7 @@ impl AstNode for Item { Item::MacroCall(it) => &it.syntax, Item::Module(it) => &it.syntax, Item::StaticDef(it) => &it.syntax, - Item::StructDef(it) => &it.syntax, + Item::Struct(it) => &it.syntax, Item::TraitDef(it) => &it.syntax, Item::TypeAlias(it) => &it.syntax, Item::Union(it) => &it.syntax, @@ -3372,8 +3372,8 @@ impl AstNode for ExternItem { } } } -impl From for AdtDef { - fn from(node: StructDef) -> AdtDef { AdtDef::StructDef(node) } +impl From for AdtDef { + fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } } impl From for AdtDef { fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } @@ -3384,13 +3384,13 @@ impl From for AdtDef { impl AstNode for AdtDef { fn can_cast(kind: SyntaxKind) -> bool { match kind { - STRUCT_DEF | ENUM_DEF | UNION => true, + STRUCT | ENUM_DEF | UNION => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), + STRUCT => AdtDef::Struct(Struct { syntax }), ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), UNION => AdtDef::Union(Union { syntax }), _ => return None, @@ -3399,7 +3399,7 @@ impl AstNode for AdtDef { } fn syntax(&self) -> &SyntaxNode { match self { - AdtDef::StructDef(it) => &it.syntax, + AdtDef::Struct(it) => &it.syntax, AdtDef::EnumDef(it) => &it.syntax, AdtDef::Union(it) => &it.syntax, } @@ -3510,7 +3510,7 @@ impl std::fmt::Display for StaticDef { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for StructDef { +impl std::fmt::Display for Struct { 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 ce11a7513..2299988ce 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -183,7 +183,7 @@ impl StructKind { } } -impl ast::StructDef { +impl ast::Struct { pub fn kind(&self) -> StructKind { StructKind::from_node(self) } @@ -475,7 +475,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::Struct {} impl ast::DocCommentsOwner for ast::Union {} impl ast::DocCommentsOwner for ast::RecordField {} impl ast::DocCommentsOwner for ast::TupleField {} diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index 0a1246c59..ef260ea59 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs @@ -146,8 +146,8 @@ fn n_attached_trivias<'a>( trivias: impl Iterator, ) -> usize { match kind { - MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN - | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => { + MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM_DEF | ENUM_VARIANT | FN | TRAIT_DEF + | MODULE | RECORD_FIELD | STATIC_DEF => { let mut res = 0; let mut trivias = trivias.enumerate().peekable(); diff --git a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast index 93f6060ed..bbbf496c8 100644 --- a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast +++ b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..34 - STRUCT_DEF@0..34 + STRUCT@0..34 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast index 7e2f429e1..6dc73bfdb 100644 --- a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast @@ -5,7 +5,7 @@ SOURCE_FILE@0..21 ERROR@3..8 MATCH_KW@3..8 "match" WHITESPACE@8..10 "\n\n" - STRUCT_DEF@10..21 + STRUCT@10..21 STRUCT_KW@10..16 "struct" WHITESPACE@16..17 " " NAME@17..18 diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast index e0f3916b3..7763fad84 100644 --- a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..40 - STRUCT_DEF@0..39 + STRUCT@0..39 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast index ad9447761..5f85c3943 100644 --- a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..74 - STRUCT_DEF@0..73 + STRUCT@0..73 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast index 2ae5bacea..560bfd751 100644 --- a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast @@ -2,7 +2,7 @@ SOURCE_FILE@0..31 ERROR@0..1 R_CURLY@0..1 "}" WHITESPACE@1..3 "\n\n" - STRUCT_DEF@3..12 + STRUCT@3..12 STRUCT_KW@3..9 "struct" WHITESPACE@9..10 " " NAME@10..11 diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast index 10081a870..dacf71aa1 100644 --- a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..43 - STRUCT_DEF@0..11 + STRUCT@0..11 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 @@ -38,7 +38,7 @@ SOURCE_FILE@0..43 WHITESPACE@29..30 "\n" R_CURLY@30..31 "}" WHITESPACE@31..33 "\n\n" - STRUCT_DEF@33..42 + STRUCT@33..42 STRUCT_KW@33..39 "struct" WHITESPACE@39..40 " " NAME@40..41 diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast index 87c54c32c..b02d390af 100644 --- a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast +++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast @@ -3,7 +3,7 @@ SOURCE_FILE@0..19 ABI@0..6 EXTERN_KW@0..6 "extern" WHITESPACE@6..7 " " - STRUCT_DEF@7..18 + STRUCT@7..18 STRUCT_KW@7..13 "struct" WHITESPACE@13..14 " " NAME@14..17 diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast index c3591d25c..3eef848fc 100644 --- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..86 - STRUCT_DEF@0..72 + STRUCT@0..72 VISIBILITY@0..3 PUB_KW@0..3 "pub" WHITESPACE@3..4 " " diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast index 866f61113..02339d035 100644 --- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast @@ -28,7 +28,7 @@ SOURCE_FILE@0..112 ERROR@17..18 COMMA@17..18 "," WHITESPACE@18..19 " " - STRUCT_DEF@19..26 + STRUCT@19..26 STRUCT_KW@19..25 "struct" ERROR@25..26 COMMA@25..26 "," diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast index 49aca06b0..e95688f56 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..35 - STRUCT_DEF@0..34 + STRUCT@0..34 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast index 1b810607e..50742cbcf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..81 - STRUCT_DEF@0..20 + STRUCT@0..20 VISIBILITY@0..10 PUB_KW@0..3 "pub" L_PAREN@3..4 "(" @@ -12,7 +12,7 @@ SOURCE_FILE@0..81 IDENT@18..19 "S" SEMICOLON@19..20 ";" WHITESPACE@20..21 "\n" - STRUCT_DEF@21..40 + STRUCT@21..40 VISIBILITY@21..30 PUB_KW@21..24 "pub" L_PAREN@24..25 "(" @@ -25,7 +25,7 @@ SOURCE_FILE@0..81 IDENT@38..39 "S" SEMICOLON@39..40 ";" WHITESPACE@40..41 "\n" - STRUCT_DEF@41..60 + STRUCT@41..60 VISIBILITY@41..50 PUB_KW@41..44 "pub" L_PAREN@44..45 "(" @@ -38,7 +38,7 @@ SOURCE_FILE@0..81 IDENT@58..59 "S" SEMICOLON@59..60 ";" WHITESPACE@60..61 "\n" - STRUCT_DEF@61..80 + STRUCT@61..80 VISIBILITY@61..70 PUB_KW@61..64 "pub" L_PAREN@64..65 "(" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast index a0ad07807..db5bd2849 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast @@ -16,7 +16,7 @@ SOURCE_FILE@0..71 WHITESPACE@17..18 " " R_CURLY@18..19 "}" WHITESPACE@19..20 "\n" - STRUCT_DEF@20..49 + STRUCT@20..49 STRUCT_KW@20..26 "struct" WHITESPACE@26..27 " " NAME@27..28 @@ -41,7 +41,7 @@ SOURCE_FILE@0..71 WHITESPACE@47..48 " " R_CURLY@48..49 "}" WHITESPACE@49..50 "\n" - STRUCT_DEF@50..70 + STRUCT@50..70 STRUCT_KW@50..56 "struct" WHITESPACE@56..57 " " NAME@57..58 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast index 775bc2869..9ae271817 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..64 - STRUCT_DEF@0..63 + STRUCT@0..63 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast index f6417ab13..de8217064 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast @@ -57,7 +57,7 @@ SOURCE_FILE@0..70 L_CURLY@57..58 "{" R_CURLY@58..59 "}" WHITESPACE@59..60 "\n" - STRUCT_DEF@60..69 + STRUCT@60..69 STRUCT_KW@60..66 "struct" WHITESPACE@66..67 " " NAME@67..68 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast index 0d9a36618..cdbc40fe0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast @@ -1,12 +1,12 @@ SOURCE_FILE@0..106 - STRUCT_DEF@0..11 + STRUCT@0..11 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..10 IDENT@7..10 "Foo" SEMICOLON@10..11 ";" WHITESPACE@11..12 "\n" - STRUCT_DEF@12..25 + STRUCT@12..25 STRUCT_KW@12..18 "struct" WHITESPACE@18..19 " " NAME@19..22 @@ -16,7 +16,7 @@ SOURCE_FILE@0..106 L_CURLY@23..24 "{" R_CURLY@24..25 "}" WHITESPACE@25..26 "\n" - STRUCT_DEF@26..39 + STRUCT@26..39 STRUCT_KW@26..32 "struct" WHITESPACE@32..33 " " NAME@33..36 @@ -26,7 +26,7 @@ SOURCE_FILE@0..106 R_PAREN@37..38 ")" SEMICOLON@38..39 ";" WHITESPACE@39..40 "\n" - STRUCT_DEF@40..66 + STRUCT@40..66 STRUCT_KW@40..46 "struct" WHITESPACE@46..47 " " NAME@47..50 @@ -50,7 +50,7 @@ SOURCE_FILE@0..106 R_PAREN@64..65 ")" SEMICOLON@65..66 ";" WHITESPACE@66..67 "\n" - STRUCT_DEF@67..105 + STRUCT@67..105 STRUCT_KW@67..73 "struct" WHITESPACE@73..74 " " NAME@74..77 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast index 1d24619c3..2ef026e37 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..19 - STRUCT_DEF@0..18 + STRUCT@0..18 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast index 3c9af3d1f..0e1594dc4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..53 - STRUCT_DEF@0..33 + STRUCT@0..33 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..11 @@ -40,7 +40,7 @@ SOURCE_FILE@0..53 IDENT@27..32 "Clone" SEMICOLON@32..33 ";" WHITESPACE@33..34 "\n" - STRUCT_DEF@34..52 + STRUCT@34..52 STRUCT_KW@34..40 "struct" WHITESPACE@40..41 " " NAME@41..45 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast index 51812a4f2..4d09c9f50 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..60 - STRUCT_DEF@0..59 + STRUCT@0..59 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast index d92bf84f4..280f947ce 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast @@ -47,7 +47,7 @@ SOURCE_FILE@0..111 R_CURLY@89..90 "}" SEMICOLON@90..91 ";" WHITESPACE@91..96 "\n " - STRUCT_DEF@96..107 + STRUCT@96..107 STRUCT_KW@96..102 "struct" WHITESPACE@102..103 " " NAME@103..104 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast index 6981ef971..9312eab65 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..24 - STRUCT_DEF@0..23 + STRUCT@0..23 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast index c9d1af92f..a171fe7a8 100644 --- a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..32 - STRUCT_DEF@0..31 + STRUCT@0..31 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast index 57fb7a329..362892b91 100644 --- a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast +++ b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..25 - STRUCT_DEF@0..25 + STRUCT@0..25 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast index 60ded78d5..b2c1d791f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast @@ -40,7 +40,7 @@ SOURCE_FILE@0..118 WHITESPACE@41..46 "\n " R_CURLY@46..47 "}" WHITESPACE@47..52 "\n " - STRUCT_DEF@52..63 + STRUCT@52..63 STRUCT_KW@52..58 "struct" WHITESPACE@58..59 " " NAME@59..60 diff --git a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast index 00b1b65be..b15f41dd7 100644 --- a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast +++ b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast @@ -1,12 +1,12 @@ SOURCE_FILE@0..97 - STRUCT_DEF@0..9 + STRUCT@0..9 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "A" SEMICOLON@8..9 ";" WHITESPACE@9..10 "\n" - STRUCT_DEF@10..21 + STRUCT@10..21 STRUCT_KW@10..16 "struct" WHITESPACE@16..17 " " NAME@17..18 @@ -16,7 +16,7 @@ SOURCE_FILE@0..97 L_CURLY@19..20 "{" R_CURLY@20..21 "}" WHITESPACE@21..22 "\n" - STRUCT_DEF@22..33 + STRUCT@22..33 STRUCT_KW@22..28 "struct" WHITESPACE@28..29 " " NAME@29..30 @@ -26,7 +26,7 @@ SOURCE_FILE@0..97 R_PAREN@31..32 ")" SEMICOLON@32..33 ";" WHITESPACE@33..35 "\n\n" - STRUCT_DEF@35..74 + STRUCT@35..74 STRUCT_KW@35..41 "struct" WHITESPACE@41..42 " " NAME@42..43 @@ -63,7 +63,7 @@ SOURCE_FILE@0..97 WHITESPACE@72..73 "\n" R_CURLY@73..74 "}" WHITESPACE@74..76 "\n\n" - STRUCT_DEF@76..96 + STRUCT@76..96 STRUCT_KW@76..82 "struct" WHITESPACE@82..83 " " NAME@83..84 diff --git a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast index b757bd16d..630aa0708 100644 --- a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast +++ b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..290 - STRUCT_DEF@0..13 + STRUCT@0..13 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..9 @@ -12,7 +12,7 @@ SOURCE_FILE@0..290 R_ANGLE@11..12 ">" SEMICOLON@12..13 ";" WHITESPACE@13..14 "\n" - STRUCT_DEF@14..32 + STRUCT@14..32 STRUCT_KW@14..20 "struct" WHITESPACE@20..21 " " NAME@21..23 @@ -34,7 +34,7 @@ SOURCE_FILE@0..290 R_PAREN@30..31 ")" SEMICOLON@31..32 ";" WHITESPACE@32..33 "\n" - STRUCT_DEF@33..56 + STRUCT@33..56 STRUCT_KW@33..39 "struct" WHITESPACE@39..40 " " NAME@40..42 @@ -62,7 +62,7 @@ SOURCE_FILE@0..290 WHITESPACE@54..55 " " R_CURLY@55..56 "}" WHITESPACE@56..58 "\n\n" - STRUCT_DEF@58..70 + STRUCT@58..70 STRUCT_KW@58..64 "struct" WHITESPACE@64..65 " " NAME@65..67 @@ -72,7 +72,7 @@ SOURCE_FILE@0..290 R_ANGLE@68..69 ">" SEMICOLON@69..70 ";" WHITESPACE@70..71 "\n" - STRUCT_DEF@71..85 + STRUCT@71..85 STRUCT_KW@71..77 "struct" WHITESPACE@77..78 " " NAME@78..80 @@ -84,7 +84,7 @@ SOURCE_FILE@0..290 R_ANGLE@83..84 ">" SEMICOLON@84..85 ";" WHITESPACE@85..86 "\n" - STRUCT_DEF@86..101 + STRUCT@86..101 STRUCT_KW@86..92 "struct" WHITESPACE@92..93 " " NAME@93..95 @@ -97,7 +97,7 @@ SOURCE_FILE@0..290 R_ANGLE@99..100 ">" SEMICOLON@100..101 ";" WHITESPACE@101..102 "\n" - STRUCT_DEF@102..120 + STRUCT@102..120 STRUCT_KW@102..108 "struct" WHITESPACE@108..109 " " NAME@109..111 @@ -112,7 +112,7 @@ SOURCE_FILE@0..290 R_ANGLE@118..119 ">" SEMICOLON@119..120 ";" WHITESPACE@120..121 "\n" - STRUCT_DEF@121..142 + STRUCT@121..142 STRUCT_KW@121..127 "struct" WHITESPACE@127..128 " " NAME@128..130 @@ -130,7 +130,7 @@ SOURCE_FILE@0..290 R_ANGLE@140..141 ">" SEMICOLON@141..142 ";" WHITESPACE@142..143 "\n" - STRUCT_DEF@143..166 + STRUCT@143..166 STRUCT_KW@143..149 "struct" WHITESPACE@149..150 " " NAME@150..152 @@ -149,7 +149,7 @@ SOURCE_FILE@0..290 R_ANGLE@164..165 ">" SEMICOLON@165..166 ";" WHITESPACE@166..167 "\n" - STRUCT_DEF@167..183 + STRUCT@167..183 STRUCT_KW@167..173 "struct" WHITESPACE@173..174 " " NAME@174..177 @@ -162,7 +162,7 @@ SOURCE_FILE@0..290 R_ANGLE@181..182 ">" SEMICOLON@182..183 ";" WHITESPACE@183..184 "\n" - STRUCT_DEF@184..203 + STRUCT@184..203 STRUCT_KW@184..190 "struct" WHITESPACE@190..191 " " NAME@191..194 @@ -178,7 +178,7 @@ SOURCE_FILE@0..290 R_ANGLE@201..202 ">" SEMICOLON@202..203 ";" WHITESPACE@203..204 "\n" - STRUCT_DEF@204..233 + STRUCT@204..233 STRUCT_KW@204..210 "struct" WHITESPACE@210..211 " " NAME@211..214 @@ -202,7 +202,7 @@ SOURCE_FILE@0..290 R_ANGLE@231..232 ">" SEMICOLON@232..233 ";" WHITESPACE@233..235 "\n\n" - STRUCT_DEF@235..249 + STRUCT@235..249 STRUCT_KW@235..241 "struct" WHITESPACE@241..242 " " NAME@242..245 @@ -215,7 +215,7 @@ SOURCE_FILE@0..290 R_ANGLE@247..248 ">" SEMICOLON@248..249 ";" WHITESPACE@249..250 "\n" - STRUCT_DEF@250..267 + STRUCT@250..267 STRUCT_KW@250..256 "struct" WHITESPACE@256..257 " " NAME@257..260 @@ -233,7 +233,7 @@ SOURCE_FILE@0..290 R_ANGLE@265..266 ">" SEMICOLON@266..267 ";" WHITESPACE@267..268 "\n" - STRUCT_DEF@268..289 + STRUCT@268..289 STRUCT_KW@268..274 "struct" WHITESPACE@274..275 " " NAME@275..278 diff --git a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast index 5100e6a48..9bdc50e1e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..250 - STRUCT_DEF@0..12 + STRUCT@0..12 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 @@ -12,7 +12,7 @@ SOURCE_FILE@0..250 R_ANGLE@10..11 ">" SEMICOLON@11..12 ";" WHITESPACE@12..13 "\n" - STRUCT_DEF@13..26 + STRUCT@13..26 STRUCT_KW@13..19 "struct" WHITESPACE@19..20 " " NAME@20..21 @@ -27,7 +27,7 @@ SOURCE_FILE@0..250 R_ANGLE@24..25 ">" SEMICOLON@25..26 ";" WHITESPACE@26..27 "\n" - STRUCT_DEF@27..43 + STRUCT@27..43 STRUCT_KW@27..33 "struct" WHITESPACE@33..34 " " NAME@34..35 @@ -45,7 +45,7 @@ SOURCE_FILE@0..250 R_ANGLE@41..42 ">" SEMICOLON@42..43 ";" WHITESPACE@43..44 "\n" - STRUCT_DEF@44..63 + STRUCT@44..63 STRUCT_KW@44..50 "struct" WHITESPACE@50..51 " " NAME@51..52 @@ -66,7 +66,7 @@ SOURCE_FILE@0..250 R_ANGLE@61..62 ">" SEMICOLON@62..63 ";" WHITESPACE@63..64 "\n" - STRUCT_DEF@64..86 + STRUCT@64..86 STRUCT_KW@64..70 "struct" WHITESPACE@70..71 " " NAME@71..72 @@ -90,7 +90,7 @@ SOURCE_FILE@0..250 R_ANGLE@84..85 ">" SEMICOLON@85..86 ";" WHITESPACE@86..87 "\n" - STRUCT_DEF@87..116 + STRUCT@87..116 STRUCT_KW@87..93 "struct" WHITESPACE@93..94 " " NAME@94..95 @@ -122,7 +122,7 @@ SOURCE_FILE@0..250 R_ANGLE@114..115 ">" SEMICOLON@115..116 ";" WHITESPACE@116..117 "\n" - STRUCT_DEF@117..143 + STRUCT@117..143 STRUCT_KW@117..123 "struct" WHITESPACE@123..124 " " NAME@124..125 @@ -153,7 +153,7 @@ SOURCE_FILE@0..250 R_ANGLE@141..142 ">" SEMICOLON@142..143 ";" WHITESPACE@143..144 "\n" - STRUCT_DEF@144..180 + STRUCT@144..180 STRUCT_KW@144..150 "struct" WHITESPACE@150..151 " " NAME@151..152 @@ -194,7 +194,7 @@ SOURCE_FILE@0..250 R_ANGLE@178..179 ">" SEMICOLON@179..180 ";" WHITESPACE@180..181 "\n" - STRUCT_DEF@181..199 + STRUCT@181..199 STRUCT_KW@181..187 "struct" WHITESPACE@187..188 " " NAME@188..189 @@ -217,7 +217,7 @@ SOURCE_FILE@0..250 R_ANGLE@197..198 ">" SEMICOLON@198..199 ";" WHITESPACE@199..200 "\n" - STRUCT_DEF@200..250 + STRUCT@200..250 STRUCT_KW@200..206 "struct" WHITESPACE@206..207 " " NAME@207..208 diff --git a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast index 0f0138c86..8cfc14f49 100644 --- a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast +++ b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..27 - STRUCT_DEF@0..27 + STRUCT@0..27 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast index 4f0c68822..c4ffc0a3d 100644 --- a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast +++ b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast @@ -1,7 +1,7 @@ SOURCE_FILE@0..199 COMMENT@0..60 "// https://github.com ..." WHITESPACE@60..62 "\n\n" - STRUCT_DEF@62..73 + STRUCT@62..73 STRUCT_KW@62..68 "struct" WHITESPACE@68..69 " " NAME@69..72 diff --git a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast index 9c2ea3754..adc4a22e9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast @@ -1,7 +1,7 @@ SOURCE_FILE@0..160 COMMENT@0..60 "// https://github.com ..." WHITESPACE@60..62 "\n\n" - STRUCT_DEF@62..90 + STRUCT@62..90 STRUCT_KW@62..68 "struct" WHITESPACE@68..69 " " NAME@69..73 diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 6f9186127..cb11dffd0 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -925,7 +925,7 @@ pub(crate) fn handle_code_lens( matches!( it.kind, SyntaxKind::TRAIT_DEF - | SyntaxKind::STRUCT_DEF + | SyntaxKind::STRUCT | SyntaxKind::ENUM_DEF | SyntaxKind::UNION ) diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index f1373fd61..a09a74c41 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -32,7 +32,7 @@ pub(crate) fn range(line_index: &LineIndex, range: TextRange) -> lsp_types::Rang pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { match syntax_kind { SyntaxKind::FN => lsp_types::SymbolKind::Function, - SyntaxKind::STRUCT_DEF => lsp_types::SymbolKind::Struct, + SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, SyntaxKind::ENUM_DEF => lsp_types::SymbolKind::Enum, SyntaxKind::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index e21618cbd..e8a90636e 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -93,7 +93,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { ], nodes: &[ "SOURCE_FILE", - "STRUCT_DEF", + "STRUCT", "UNION", "ENUM_DEF", "FN", diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 84ddda5cb..e993a750c 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -307,7 +307,7 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result { let ast = quote! { #![allow(bad_style, missing_docs, unreachable_pub)] - /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. + /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[repr(u16)] pub enum SyntaxKind { diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 65082f3d9..d038c5c5a 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -13,7 +13,7 @@ Item = | MacroCall | Module | StaticDef -| StructDef +| Struct | TraitDef | TypeAlias | Union @@ -76,7 +76,7 @@ TypeAlias = Attr* Visibility? 'default'? 'type' Name GenericParamList? (':' TypeBoundList?)? WhereClause? '=' TypeRef ';' -StructDef = +Struct = Attr* Visibility? 'struct' Name GenericParamList? ( WhereClause? (RecordFieldList | ';') | TupleFieldList WhereClause? ';' @@ -453,7 +453,7 @@ MetaItem = Path '=' AttrInput nested_meta_items:MetaItem* AdtDef = - StructDef + Struct | EnumDef | Union -- cgit v1.2.3