From 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:49:13 +0200 Subject: [PATCH] Rename FieldDef -> Field --- .../src/handlers/change_visibility.rs | 4 +- crates/ra_assists/src/handlers/move_bounds.rs | 2 +- crates/ra_hir/src/code_model.rs | 4 +- crates/ra_hir/src/semantics.rs | 4 +- crates/ra_hir/src/semantics/source_to_def.rs | 10 +- crates/ra_hir_def/src/adt.rs | 6 +- crates/ra_hir_def/src/item_tree/lower.rs | 29 +++--- crates/ra_hir_def/src/keys.rs | 4 +- crates/ra_ide/src/diagnostics.rs | 16 ++-- .../ra_ide/src/display/navigation_target.rs | 4 +- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/extend_selection.rs | 4 +- crates/ra_ide/src/file_structure.rs | 4 +- crates/ra_ide/src/folding_ranges.rs | 2 +- crates/ra_ide/src/references.rs | 4 +- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide_db/src/defs.rs | 2 +- crates/ra_mbe/src/tests.rs | 8 +- crates/ra_parser/src/grammar.rs | 2 +- crates/ra_parser/src/grammar/items/adt.rs | 8 +- crates/ra_parser/src/syntax_kind/generated.rs | 8 +- crates/ra_syntax/src/ast/generated/nodes.rs | 96 +++++++++---------- crates/ra_syntax/src/ast/make.rs | 2 +- crates/ra_syntax/src/ast/node_ext.rs | 12 +-- .../ra_syntax/src/parsing/text_tree_sink.rs | 2 +- crates/ra_syntax/src/ptr.rs | 2 +- .../err/0000_struct_field_missing_comma.rast | 6 +- .../err/0001_item_recovery_in_file.rast | 2 +- .../parser/err/0003_C++_semicolon.rast | 6 +- .../parser/err/0006_named_field_recovery.rast | 8 +- .../parser/err/0013_invalid_type.rast | 6 +- .../test_data/parser/err/0025_nope.rast | 16 ++-- .../test_data/parser/fuzz-failures/0000.rs | 4 +- .../inline/ok/0040_crate_keyword_vis.rast | 8 +- .../inline/ok/0054_record_field_attrs.rast | 4 +- .../parser/inline/ok/0068_union_items.rast | 8 +- .../parser/inline/ok/0083_struct_items.rast | 16 ++-- .../inline/ok/0114_tuple_struct_where.rast | 8 +- .../inline/ok/0115_tuple_field_attrs.rast | 4 +- .../ok/0134_nocontentexpr_after_item.rast | 2 +- .../inline/ok/0157_variant_discriminant.rast | 4 +- .../test_data/parser/ok/0001_struct_item.rast | 4 +- .../parser/ok/0002_struct_item_field.rast | 4 +- .../test_data/parser/ok/0008_mod_item.rast | 2 +- .../parser/ok/0016_struct_flavors.rast | 16 ++-- .../parser/ok/0018_struct_type_params.rast | 8 +- .../test_data/parser/ok/0019_enums.rast | 14 +-- .../test_data/parser/ok/0035_weird_exprs.rast | 4 +- .../parser/ok/0040_raw_struct_item_field.rast | 4 +- .../parser/ok/0043_complex_assignment.rast | 4 +- .../ok/0047_minus_in_inner_pattern.rast | 6 +- crates/rust-analyzer/src/to_proto.rs | 2 +- xtask/src/ast_src.rs | 8 +- xtask/src/codegen/rust.ungram | 26 ++--- 54 files changed, 219 insertions(+), 228 deletions(-) diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index c3e1f28032..72d06d55b7 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs @@ -47,7 +47,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { } (vis_offset(&parent), keyword.text_range()) } else if let Some(field_name) = ctx.find_node_at_offset::() { - let field = field_name.syntax().ancestors().find_map(ast::RecordFieldDef::cast)?; + let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?; if field.name()? != field_name { mark::hit!(change_visibility_field_false_positive); return None; @@ -56,7 +56,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { return None; } (vis_offset(field.syntax()), field_name.syntax().text_range()) - } else if let Some(field) = ctx.find_node_at_offset::() { + } else if let Some(field) = ctx.find_node_at_offset::() { if field.visibility().is_some() { return None; } diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 69ce90fbc2..15327facb4 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs @@ -43,7 +43,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), ast::StructDef(it) => { it.syntax().children_with_tokens() - .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])? + .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? }, _ => return None } diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 859bdfb3bc..36c0bdc9e5 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -361,8 +361,8 @@ pub struct Field { #[derive(Debug, PartialEq, Eq)] pub enum FieldSource { - Named(ast::RecordFieldDef), - Pos(ast::TupleFieldDef), + Named(ast::RecordField), + Pos(ast::TupleField), } impl Field { diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index a654c618f5..3e9c54a397 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -589,8 +589,8 @@ to_def_impls![ (crate::Const, ast::ConstDef, const_to_def), (crate::Static, ast::StaticDef, static_to_def), (crate::Function, ast::Fn, fn_to_def), - (crate::Field, ast::RecordFieldDef, record_field_to_def), - (crate::Field, ast::TupleFieldDef, tuple_field_to_def), + (crate::Field, ast::RecordField, record_field_to_def), + (crate::Field, ast::TupleField, tuple_field_to_def), (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), (crate::TypeParam, ast::TypeParam, type_param_to_def), (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index d23a1974b0..4f90f588e0 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -92,16 +92,10 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn type_alias_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::TYPE_ALIAS) } - pub(super) fn record_field_to_def( - &mut self, - src: InFile, - ) -> Option { + pub(super) fn record_field_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::RECORD_FIELD) } - pub(super) fn tuple_field_to_def( - &mut self, - src: InFile, - ) -> Option { + pub(super) fn tuple_field_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::TUPLE_FIELD) } pub(super) fn enum_variant_to_def( diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 4994a21253..2be23c45d3 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -179,7 +179,7 @@ impl VariantData { impl HasChildSource for VariantId { type ChildId = LocalFieldId; - type Value = Either; + type Value = Either; fn child_source(&self, db: &dyn DefDatabase) -> InFile> { let (src, module_id) = match self { @@ -194,7 +194,7 @@ impl HasChildSource for VariantId { } VariantId::UnionId(it) => ( it.lookup(db).source(db).map(|it| { - it.record_field_def_list() + it.record_field_list() .map(ast::StructKind::Record) .unwrap_or(ast::StructKind::Unit) }), @@ -218,7 +218,7 @@ pub enum StructKind { fn lower_struct( db: &dyn DefDatabase, expander: &mut CfgExpander, - trace: &mut Trace>, + trace: &mut Trace>, ast: &InFile, ) -> StructKind { let ctx = LowerCtx::new(db, ast.file_id); diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 19d165b5b7..df909ee9e4 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -1,10 +1,7 @@ //! AST -> `ItemTree` lowering code. -use super::*; -use crate::{ - attr::Attrs, - generics::{GenericParams, TypeParamData, TypeParamProvenance}, -}; +use std::{collections::hash_map::Entry, mem, sync::Arc}; + use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; use ra_arena::map::ArenaMap; use ra_syntax::{ @@ -12,7 +9,13 @@ use ra_syntax::{ SyntaxNode, }; use smallvec::SmallVec; -use std::{collections::hash_map::Entry, mem, sync::Arc}; + +use crate::{ + attr::Attrs, + generics::{GenericParams, TypeParamData, TypeParamProvenance}, +}; + +use super::*; fn id(index: Idx) -> FileItemTreeId { FileItemTreeId { index, _p: PhantomData } @@ -191,7 +194,7 @@ impl Ctx { } } - fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange { + fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange { let start = self.next_field_idx(); for field in fields.fields() { if let Some(data) = self.lower_record_field(&field) { @@ -203,7 +206,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option { + fn lower_record_field(&mut self, field: &ast::RecordField) -> Option { let name = field.name()?.as_name(); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.ascribed_type()); @@ -211,7 +214,7 @@ impl Ctx { Some(res) } - fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange { + fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange { let start = self.next_field_idx(); for (i, field) in fields.fields().enumerate() { let data = self.lower_tuple_field(i, &field); @@ -222,7 +225,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { + fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { let name = Name::new_tuple_field(idx); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.type_ref()); @@ -234,10 +237,8 @@ impl Ctx { let visibility = self.lower_visibility(union); let name = union.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Union, union); - let fields = match union.record_field_def_list() { - Some(record_field_def_list) => { - self.lower_fields(&StructKind::Record(record_field_def_list)) - } + let fields = match union.record_field_list() { + Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)), None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), }; let ast_id = self.source_ast_id_map.ast_id(union); diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index f627eab1f5..9ca2762352 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -25,8 +25,8 @@ pub const UNION: Key = Key::new(); pub const ENUM: Key = Key::new(); pub const ENUM_VARIANT: Key = Key::new(); -pub const TUPLE_FIELD: Key = Key::new(); -pub const RECORD_FIELD: Key = Key::new(); +pub const TUPLE_FIELD: Key = Key::new(); +pub const RECORD_FIELD: Key = Key::new(); pub const TYPE_PARAM: Key = Key::new(); pub const MACRO: Key = Key::new(); diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index efbb00d6d5..dd8a7ffd9b 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs @@ -155,21 +155,21 @@ fn missing_struct_field_fix( module = s.module(sema.db); let source = s.source(sema.db); def_file_id = source.file_id; - let fields = source.value.field_def_list()?; - record_field_def_list(fields)? + let fields = source.value.field_list()?; + record_field_list(fields)? } VariantDef::Union(u) => { module = u.module(sema.db); let source = u.source(sema.db); def_file_id = source.file_id; - source.value.record_field_def_list()? + source.value.record_field_list()? } VariantDef::EnumVariant(e) => { module = e.module(sema.db); let source = e.source(sema.db); def_file_id = source.file_id; - let fields = source.value.field_def_list()?; - record_field_def_list(fields)? + let fields = source.value.field_list()?; + record_field_list(fields)? } }; let def_file_id = def_file_id.original_file(sema.db); @@ -205,10 +205,10 @@ fn missing_struct_field_fix( let fix = Fix::new("Create field", source_change.into()); return Some(fix); - fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option { + fn record_field_list(field_def_list: ast::FieldList) -> Option { match field_def_list { - ast::FieldDefList::RecordFieldDefList(it) => Some(it), - ast::FieldDefList::TupleFieldDefList(_) => None, + ast::FieldList::RecordFieldList(it) => Some(it), + ast::FieldList::TupleFieldList(_) => None, } } } diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 4f19c7ed42..797d2d8e3d 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -387,7 +387,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::TypeAlias(it) => it.doc_comment_text(), ast::ConstDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(), - ast::RecordFieldDef(it) => it.doc_comment_text(), + ast::RecordField(it) => it.doc_comment_text(), ast::EnumVariant(it) => it.doc_comment_text(), ast::MacroCall(it) => it.doc_comment_text(), _ => None, @@ -412,7 +412,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::TypeAlias(it) => it.short_label(), ast::ConstDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(), - ast::RecordFieldDef(it) => it.short_label(), + ast::RecordField(it) => it.short_label(), ast::EnumVariant(it) => it.short_label(), _ => None, } diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index e2c95be06f..78a2598d6e 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -65,7 +65,7 @@ impl ShortLabel for ast::StaticDef { } } -impl ShortLabel for ast::RecordFieldDef { +impl ShortLabel for ast::RecordField { fn short_label(&self) -> Option { short_label_from_ascribed_node(self, "") } diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 597a7d82f8..04a7f0ac4b 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -39,8 +39,8 @@ fn try_extend_selection( let list_kinds = [ RECORD_FIELD_PAT_LIST, MATCH_ARM_LIST, - RECORD_FIELD_DEF_LIST, - TUPLE_FIELD_DEF_LIST, + RECORD_FIELD_LIST, + TUPLE_FIELD_LIST, RECORD_EXPR_FIELD_LIST, ENUM_VARIANT_LIST, USE_TREE_LIST, diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 05ccc0b73f..a8fd1a2fd0 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -136,7 +136,7 @@ fn structure_node(node: &SyntaxNode) -> Option { let ty = it.type_ref(); decl_with_type_ref(it, ty) }, - ast::RecordFieldDef(it) => decl_with_ascription(it), + ast::RecordField(it) => decl_with_ascription(it), ast::ConstDef(it) => decl_with_ascription(it), ast::StaticDef(it) => decl_with_ascription(it), ast::ImplDef(it) => { @@ -249,7 +249,7 @@ fn very_obsolete() {} label: "x", navigation_range: 18..19, node_range: 18..24, - kind: RECORD_FIELD_DEF, + kind: RECORD_FIELD, detail: Some( "i32", ), diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index 9725054500..8dcce9f56f 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs @@ -85,7 +85,7 @@ fn fold_kind(kind: SyntaxKind) -> Option { COMMENT => Some(FoldKind::Comment), USE => Some(FoldKind::Imports), ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), - RECORD_FIELD_DEF_LIST + RECORD_FIELD_LIST | RECORD_FIELD_PAT_LIST | RECORD_EXPR_FIELD_LIST | ITEM_LIST diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 94d03a07f3..d61ac271ee 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -361,7 +361,7 @@ fn main(s: Foo) { ); check_result( refs, - "spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other", + "spam RECORD_FIELD FileId(1) 17..30 21..25 Other", &["FileId(1) 67..71 Other Read"], ); } @@ -580,7 +580,7 @@ fn foo() { ); check_result( refs, - "f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other", + "f RECORD_FIELD FileId(1) 15..21 15..16 Other", &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], ); } diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 8d52fb6e49..a04b9d893b 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -711,7 +711,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { TRAIT_DEF => HighlightTag::Trait, TYPE_ALIAS => HighlightTag::TypeAlias, TYPE_PARAM => HighlightTag::TypeParam, - RECORD_FIELD_DEF => HighlightTag::Field, + RECORD_FIELD => HighlightTag::Field, MODULE => HighlightTag::Module, FN => HighlightTag::Function, CONST_DEF => HighlightTag::Constant, diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 6ea7f173bd..30f18b9cfa 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -142,7 +142,7 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option Some(NameClass::Definition(Definition::Local(local))) }, - ast::RecordFieldDef(it) => { + ast::RecordField(it) => { let field: hir::Field = sema.to_def(&it)?; Some(NameClass::Definition(Definition::Field(field))) }, diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 220690cdd5..d7b198458c 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs @@ -494,9 +494,9 @@ MACRO_ITEMS@0..40 STRUCT_KW@0..6 "struct" NAME@6..9 IDENT@6..9 "Foo" - RECORD_FIELD_DEF_LIST@9..20 + RECORD_FIELD_LIST@9..20 L_CURLY@9..10 "{" - RECORD_FIELD_DEF@10..19 + RECORD_FIELD@10..19 NAME@10..15 IDENT@10..15 "field" COLON@15..16 ":" @@ -510,9 +510,9 @@ MACRO_ITEMS@0..40 STRUCT_KW@20..26 "struct" NAME@26..29 IDENT@26..29 "Bar" - RECORD_FIELD_DEF_LIST@29..40 + RECORD_FIELD_LIST@29..40 L_CURLY@29..30 "{" - RECORD_FIELD_DEF@30..39 + RECORD_FIELD@30..39 NAME@30..35 IDENT@30..35 "field" COLON@35..36 ":" diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 3610e73924..03041d1108 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs @@ -142,7 +142,7 @@ pub(crate) fn reparser( ) -> Option { let res = match node { BLOCK_EXPR => expressions::block_expr, - RECORD_FIELD_DEF_LIST => items::record_field_def_list, + RECORD_FIELD_LIST => items::record_field_def_list, RECORD_EXPR_FIELD_LIST => items::record_field_list, ENUM_VARIANT_LIST => items::enum_variant_list, MATCH_ARM_LIST => items::match_arm_list, diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index 74b9f514bd..0e96bf77e2 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs @@ -119,7 +119,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { } } p.expect(T!['}']); - m.complete(p, RECORD_FIELD_DEF_LIST); + m.complete(p, RECORD_FIELD_LIST); fn record_field_def(p: &mut Parser) { let m = p.start(); @@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { name(p); p.expect(T![:]); types::type_(p); - m.complete(p, RECORD_FIELD_DEF); + m.complete(p, RECORD_FIELD); } else { m.abandon(p); p.err_and_bump("expected field declaration"); @@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) { break; } types::type_(p); - m.complete(p, TUPLE_FIELD_DEF); + m.complete(p, TUPLE_FIELD); if !p.at(T![')']) { p.expect(T![,]); } } p.expect(T![')']); - m.complete(p, TUPLE_FIELD_DEF_LIST); + m.complete(p, TUPLE_FIELD_LIST); } diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index ac79786ff1..8586758b40 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -207,10 +207,10 @@ pub enum SyntaxKind { EXTERN_BLOCK, EXTERN_ITEM_LIST, ENUM_VARIANT, - RECORD_FIELD_DEF_LIST, - RECORD_FIELD_DEF, - TUPLE_FIELD_DEF_LIST, - TUPLE_FIELD_DEF, + RECORD_FIELD_LIST, + RECORD_FIELD, + TUPLE_FIELD_LIST, + TUPLE_FIELD, ENUM_VARIANT_LIST, ITEM_LIST, ASSOC_ITEM_LIST, diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 9f9c06e506..46d73215c6 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -165,7 +165,7 @@ impl ast::GenericParamsOwner for StructDef {} impl StructDef { 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_def_list(&self) -> Option { support::child(&self.syntax) } + pub fn field_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TraitDef { @@ -208,9 +208,7 @@ impl ast::VisibilityOwner for UnionDef {} impl ast::GenericParamsOwner for UnionDef {} impl UnionDef { pub fn union_token(&self) -> Option { support::token(&self.syntax, T![union]) } - pub fn record_field_def_list(&self) -> Option { - support::child(&self.syntax) - } + pub fn record_field_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Use { @@ -391,42 +389,42 @@ impl TypeBoundList { pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldDefList { +pub struct RecordFieldList { pub(crate) syntax: SyntaxNode, } -impl RecordFieldDefList { +impl RecordFieldList { pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } + pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleFieldDefList { +pub struct TupleFieldList { pub(crate) syntax: SyntaxNode, } -impl TupleFieldDefList { +impl TupleFieldList { pub fn l_paren_token(&self) -> Option { support::token(&self.syntax, T!['(']) } - pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } + pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldDef { +pub struct RecordField { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for RecordFieldDef {} -impl ast::NameOwner for RecordFieldDef {} -impl ast::VisibilityOwner for RecordFieldDef {} -impl ast::TypeAscriptionOwner for RecordFieldDef {} -impl RecordFieldDef { +impl ast::AttrsOwner for RecordField {} +impl ast::NameOwner for RecordField {} +impl ast::VisibilityOwner for RecordField {} +impl ast::TypeAscriptionOwner for RecordField {} +impl RecordField { pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleFieldDef { +pub struct TupleField { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for TupleFieldDef {} -impl ast::NameOwner for TupleFieldDef {} -impl ast::VisibilityOwner for TupleFieldDef {} -impl TupleFieldDef { +impl ast::AttrsOwner for TupleField {} +impl ast::NameOwner for TupleField {} +impl ast::VisibilityOwner for TupleField {} +impl TupleField { pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -446,7 +444,7 @@ impl ast::AttrsOwner for EnumVariant {} impl ast::NameOwner for EnumVariant {} impl ast::VisibilityOwner for EnumVariant {} impl EnumVariant { - pub fn field_def_list(&self) -> Option { support::child(&self.syntax) } + pub fn field_list(&self) -> Option { support::child(&self.syntax) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } pub fn expr(&self) -> Option { support::child(&self.syntax) } } @@ -1326,9 +1324,9 @@ pub enum Pat { MacroPat(MacroPat), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum FieldDefList { - RecordFieldDefList(RecordFieldDefList), - TupleFieldDefList(TupleFieldDefList), +pub enum FieldList { + RecordFieldList(RecordFieldList), + TupleFieldList(TupleFieldList), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Expr { @@ -1765,8 +1763,8 @@ impl AstNode for TypeBoundList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldDefList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } +impl AstNode for RecordFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1776,8 +1774,8 @@ impl AstNode for RecordFieldDefList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleFieldDefList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } +impl AstNode for TupleFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1787,8 +1785,8 @@ impl AstNode for TupleFieldDefList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } +impl AstNode for RecordField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1798,8 +1796,8 @@ impl AstNode for RecordFieldDef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleFieldDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } +impl AstNode for TupleField { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3046,33 +3044,31 @@ impl AstNode for Pat { } } } -impl From for FieldDefList { - fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } +impl From for FieldList { + fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) } } -impl From for FieldDefList { - fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) } +impl From for FieldList { + fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) } } -impl AstNode for FieldDefList { +impl AstNode for FieldList { fn can_cast(kind: SyntaxKind) -> bool { match kind { - RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, + RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { - RECORD_FIELD_DEF_LIST => { - FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) - } - TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }), + RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }), + TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - FieldDefList::RecordFieldDefList(it) => &it.syntax, - FieldDefList::TupleFieldDefList(it) => &it.syntax, + FieldList::RecordFieldList(it) => &it.syntax, + FieldList::TupleFieldList(it) => &it.syntax, } } } @@ -3425,7 +3421,7 @@ impl std::fmt::Display for Pat { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FieldDefList { +impl std::fmt::Display for FieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3625,22 +3621,22 @@ impl std::fmt::Display for TypeBoundList { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldDefList { +impl std::fmt::Display for RecordFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleFieldDefList { +impl std::fmt::Display for TupleFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldDef { +impl std::fmt::Display for RecordField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleFieldDef { +impl std::fmt::Display for TupleField { 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/make.rs b/crates/ra_syntax/src/ast/make.rs index 183ec4481e..509e8ae7a0 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option) -> ast::RecordE } } -pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { +pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField { ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) } diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 8c7457e320..ffe6746d38 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -166,16 +166,16 @@ impl ast::ImplDef { #[derive(Debug, Clone, PartialEq, Eq)] pub enum StructKind { - Record(ast::RecordFieldDefList), - Tuple(ast::TupleFieldDefList), + Record(ast::RecordFieldList), + Tuple(ast::TupleFieldList), Unit, } impl StructKind { fn from_node(node: &N) -> StructKind { - if let Some(nfdl) = support::child::(node.syntax()) { + if let Some(nfdl) = support::child::(node.syntax()) { StructKind::Record(nfdl) - } else if let Some(pfl) = support::child::(node.syntax()) { + } else if let Some(pfl) = support::child::(node.syntax()) { StructKind::Tuple(pfl) } else { StructKind::Unit @@ -477,8 +477,8 @@ 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::RecordFieldDef {} -impl ast::DocCommentsOwner for ast::TupleFieldDef {} +impl ast::DocCommentsOwner for ast::RecordField {} +impl ast::DocCommentsOwner for ast::TupleField {} impl ast::DocCommentsOwner for ast::EnumDef {} impl ast::DocCommentsOwner for ast::EnumVariant {} impl ast::DocCommentsOwner for ast::TraitDef {} diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index 87a7acd097..0a1246c593 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs @@ -147,7 +147,7 @@ fn n_attached_trivias<'a>( ) -> usize { match kind { MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN - | TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => { + | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => { let mut res = 0; let mut trivias = trivias.enumerate().peekable(); diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 62f03e93d0..ca79577471 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs @@ -98,7 +98,7 @@ fn test_local_syntax_ptr() { use crate::{ast, AstNode, SourceFile}; let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); - let field = file.syntax().descendants().find_map(ast::RecordFieldDef::cast).unwrap(); + let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap(); let ptr = SyntaxNodePtr::new(field.syntax()); let field_syntax = ptr.to_node(file.syntax()); assert_eq!(field.syntax(), &field_syntax); 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 81f0f575ce..93f6060ed1 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..34 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..34 + RECORD_FIELD_LIST@9..34 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..21 + RECORD_FIELD@15..21 NAME@15..16 IDENT@15..16 "a" COLON@16..17 ":" @@ -19,7 +19,7 @@ SOURCE_FILE@0..34 NAME_REF@18..21 IDENT@18..21 "u32" WHITESPACE@21..26 "\n " - RECORD_FIELD_DEF@26..32 + RECORD_FIELD@26..32 NAME@26..27 IDENT@26..27 "b" COLON@27..28 ":" 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 97d0fe910c..7e2f429e1e 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 @@ -11,7 +11,7 @@ SOURCE_FILE@0..21 NAME@17..18 IDENT@17..18 "S" WHITESPACE@18..19 " " - RECORD_FIELD_DEF_LIST@19..21 + RECORD_FIELD_LIST@19..21 L_CURLY@19..20 "{" R_CURLY@20..21 "}" error 0..0: expected an item 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 21c2556987..e0f3916b37 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..40 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..39 + RECORD_FIELD_LIST@9..39 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..21 + RECORD_FIELD@15..21 NAME@15..16 IDENT@15..16 "a" COLON@16..17 ":" @@ -20,7 +20,7 @@ SOURCE_FILE@0..40 IDENT@18..21 "i32" COMMA@21..22 "," WHITESPACE@22..27 "\n " - RECORD_FIELD_DEF@27..36 + RECORD_FIELD@27..36 NAME@27..28 IDENT@27..28 "b" COLON@28..29 ":" 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 2d63649980..ad9447761f 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..74 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..73 + RECORD_FIELD_LIST@9..73 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..21 + RECORD_FIELD@15..21 NAME@15..16 IDENT@15..16 "f" COLON@16..17 ":" @@ -35,7 +35,7 @@ SOURCE_FILE@0..74 ERROR@42..43 STAR@42..43 "*" WHITESPACE@43..48 "\n " - RECORD_FIELD_DEF@48..58 + RECORD_FIELD@48..58 VISIBILITY@48..51 PUB_KW@48..51 "pub" WHITESPACE@51..52 " " @@ -50,7 +50,7 @@ SOURCE_FILE@0..74 IDENT@55..58 "u32" COMMA@58..59 "," WHITESPACE@59..64 "\n " - RECORD_FIELD_DEF@64..70 + RECORD_FIELD@64..70 NAME@64..65 IDENT@64..65 "z" COLON@65..66 ":" 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 211e5fd468..c3591d25c2 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 @@ -7,10 +7,10 @@ SOURCE_FILE@0..86 WHITESPACE@10..11 " " NAME@11..16 IDENT@11..16 "Cache" - TUPLE_FIELD_DEF_LIST@16..72 + TUPLE_FIELD_LIST@16..72 L_PAREN@16..17 "(" WHITESPACE@17..22 "\n " - TUPLE_FIELD_DEF@22..68 + TUPLE_FIELD@22..68 PATH_TYPE@22..68 PATH@22..68 PATH_SEGMENT@22..68 @@ -47,7 +47,7 @@ SOURCE_FILE@0..86 ERROR@67..68 AT@67..68 "@" WHITESPACE@68..69 " " - TUPLE_FIELD_DEF@69..72 + TUPLE_FIELD@69..72 PATH_TYPE@69..72 PATH@69..72 PATH_SEGMENT@69..72 diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast index 4b9bd679e1..a1258028db 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast @@ -28,9 +28,9 @@ SOURCE_FILE@0..575 ENUM_VARIANT@50..62 NAME@50..54 IDENT@50..54 "Var2" - TUPLE_FIELD_DEF_LIST@54..62 + TUPLE_FIELD_LIST@54..62 L_PAREN@54..55 "(" - TUPLE_FIELD_DEF@55..61 + TUPLE_FIELD@55..61 PATH_TYPE@55..61 PATH@55..61 PATH_SEGMENT@55..61 @@ -43,10 +43,10 @@ SOURCE_FILE@0..575 NAME@72..76 IDENT@72..76 "Var3" WHITESPACE@76..77 " " - RECORD_FIELD_DEF_LIST@77..145 + RECORD_FIELD_LIST@77..145 L_CURLY@77..78 "{" WHITESPACE@78..91 "\n " - RECORD_FIELD_DEF@91..95 + RECORD_FIELD@91..95 NAME@91..94 IDENT@91..94 "abc" COLON@94..95 ":" @@ -108,10 +108,10 @@ SOURCE_FILE@0..575 NAME@250..259 IDENT@250..259 "StillFine" WHITESPACE@259..260 " " - RECORD_FIELD_DEF_LIST@260..293 + RECORD_FIELD_LIST@260..293 L_CURLY@260..261 "{" WHITESPACE@261..274 "\n " - RECORD_FIELD_DEF@274..282 + RECORD_FIELD@274..282 NAME@274..277 IDENT@274..277 "def" COLON@277..278 ":" @@ -146,9 +146,9 @@ SOURCE_FILE@0..575 ENUM_VARIANT@363..372 NAME@363..367 IDENT@363..367 "Nope" - TUPLE_FIELD_DEF_LIST@367..372 + TUPLE_FIELD_LIST@367..372 L_PAREN@367..368 "(" - TUPLE_FIELD_DEF@368..371 + TUPLE_FIELD@368..371 PATH_TYPE@368..371 PATH@368..371 PATH_SEGMENT@368..371 diff --git a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs index 0e6e0ccc3f..f1d0dc3438 100644 --- a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs +++ b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs @@ -86,7 +86,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax fn reparser(node: SyntaxNodeRef) -> Option { let res = match node.kind() { BLOCK => grammar::block, - RECORD_FIELD_DEF_LIST => grammar::record_field_def_list, + RECORD_FIELD_LIST => grammar::record_field_list, _ => return None, }; Some(res) @@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax let res = match node.kind() { ; let end = u32::from(range.end()) as usize; - text.replaT => grammar::record_field_def_list, + text.replaT => grammar::record_field_list, _ => return None, }; Some(res) 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 47cbe7c1f0..a0ad078074 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 @@ -22,10 +22,10 @@ SOURCE_FILE@0..71 NAME@27..28 IDENT@27..28 "S" WHITESPACE@28..29 " " - RECORD_FIELD_DEF_LIST@29..49 + RECORD_FIELD_LIST@29..49 L_CURLY@29..30 "{" WHITESPACE@30..31 " " - RECORD_FIELD_DEF@31..47 + RECORD_FIELD@31..47 VISIBILITY@31..36 CRATE_KW@31..36 "crate" WHITESPACE@36..37 " " @@ -46,9 +46,9 @@ SOURCE_FILE@0..71 WHITESPACE@56..57 " " NAME@57..58 IDENT@57..58 "T" - TUPLE_FIELD_DEF_LIST@58..69 + TUPLE_FIELD_LIST@58..69 L_PAREN@58..59 "(" - TUPLE_FIELD_DEF@59..68 + TUPLE_FIELD@59..68 VISIBILITY@59..64 CRATE_KW@59..64 "crate" WHITESPACE@64..65 " " 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 6362aa02d5..775bc28690 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..64 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..63 + RECORD_FIELD_LIST@9..63 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..60 + RECORD_FIELD@15..60 ATTR@15..43 POUND@15..16 "#" L_BRACK@16..17 "[" 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 ec24960725..2726516b8e 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 @@ -5,7 +5,7 @@ SOURCE_FILE@0..51 NAME@6..9 IDENT@6..9 "Foo" WHITESPACE@9..10 " " - RECORD_FIELD_DEF_LIST@10..12 + RECORD_FIELD_LIST@10..12 L_CURLY@10..11 "{" R_CURLY@11..12 "}" WHITESPACE@12..13 "\n" @@ -15,10 +15,10 @@ SOURCE_FILE@0..51 NAME@19..22 IDENT@19..22 "Foo" WHITESPACE@22..23 " " - RECORD_FIELD_DEF_LIST@23..50 + RECORD_FIELD_LIST@23..50 L_CURLY@23..24 "{" WHITESPACE@24..29 "\n " - RECORD_FIELD_DEF@29..35 + RECORD_FIELD@29..35 NAME@29..30 IDENT@29..30 "a" COLON@30..31 ":" @@ -30,7 +30,7 @@ SOURCE_FILE@0..51 IDENT@32..35 "i32" COMMA@35..36 "," WHITESPACE@36..41 "\n " - RECORD_FIELD_DEF@41..47 + RECORD_FIELD@41..47 NAME@41..42 IDENT@41..42 "b" COLON@42..43 ":" 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 217b07e59c..0d9a366185 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 @@ -12,7 +12,7 @@ SOURCE_FILE@0..106 NAME@19..22 IDENT@19..22 "Foo" WHITESPACE@22..23 " " - RECORD_FIELD_DEF_LIST@23..25 + RECORD_FIELD_LIST@23..25 L_CURLY@23..24 "{" R_CURLY@24..25 "}" WHITESPACE@25..26 "\n" @@ -21,7 +21,7 @@ SOURCE_FILE@0..106 WHITESPACE@32..33 " " NAME@33..36 IDENT@33..36 "Foo" - TUPLE_FIELD_DEF_LIST@36..38 + TUPLE_FIELD_LIST@36..38 L_PAREN@36..37 "(" R_PAREN@37..38 ")" SEMICOLON@38..39 ";" @@ -31,9 +31,9 @@ SOURCE_FILE@0..106 WHITESPACE@46..47 " " NAME@47..50 IDENT@47..50 "Foo" - TUPLE_FIELD_DEF_LIST@50..65 + TUPLE_FIELD_LIST@50..65 L_PAREN@50..51 "(" - TUPLE_FIELD_DEF@51..57 + TUPLE_FIELD@51..57 PATH_TYPE@51..57 PATH@51..57 PATH_SEGMENT@51..57 @@ -41,7 +41,7 @@ SOURCE_FILE@0..106 IDENT@51..57 "String" COMMA@57..58 "," WHITESPACE@58..59 " " - TUPLE_FIELD_DEF@59..64 + TUPLE_FIELD@59..64 PATH_TYPE@59..64 PATH@59..64 PATH_SEGMENT@59..64 @@ -56,10 +56,10 @@ SOURCE_FILE@0..106 NAME@74..77 IDENT@74..77 "Foo" WHITESPACE@77..78 " " - RECORD_FIELD_DEF_LIST@78..105 + RECORD_FIELD_LIST@78..105 L_CURLY@78..79 "{" WHITESPACE@79..84 "\n " - RECORD_FIELD_DEF@84..90 + RECORD_FIELD@84..90 NAME@84..85 IDENT@84..85 "a" COLON@85..86 ":" @@ -71,7 +71,7 @@ SOURCE_FILE@0..106 IDENT@87..90 "i32" COMMA@90..91 "," WHITESPACE@91..96 "\n " - RECORD_FIELD_DEF@96..102 + RECORD_FIELD@96..102 NAME@96..97 IDENT@96..97 "b" COLON@97..98 ":" 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 0b1ec5b276..3c9af3d1fe 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 @@ -10,9 +10,9 @@ SOURCE_FILE@0..53 NAME@12..13 IDENT@12..13 "T" R_ANGLE@13..14 ">" - TUPLE_FIELD_DEF_LIST@14..17 + TUPLE_FIELD_LIST@14..17 L_PAREN@14..15 "(" - TUPLE_FIELD_DEF@15..16 + TUPLE_FIELD@15..16 PATH_TYPE@15..16 PATH@15..16 PATH_SEGMENT@15..16 @@ -51,9 +51,9 @@ SOURCE_FILE@0..53 NAME@46..47 IDENT@46..47 "T" R_ANGLE@47..48 ">" - TUPLE_FIELD_DEF_LIST@48..51 + TUPLE_FIELD_LIST@48..51 L_PAREN@48..49 "(" - TUPLE_FIELD_DEF@49..50 + TUPLE_FIELD@49..50 PATH_TYPE@49..50 PATH@49..50 PATH_SEGMENT@49..50 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 3c0ef90058..51812a4f2d 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..60 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - TUPLE_FIELD_DEF_LIST@9..58 + TUPLE_FIELD_LIST@9..58 L_PAREN@9..10 "(" WHITESPACE@10..15 "\n " - TUPLE_FIELD_DEF@15..55 + TUPLE_FIELD@15..55 ATTR@15..43 POUND@15..16 "#" L_BRACK@16..17 "[" 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 ceae8a4ec6..d92bf84f42 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 @@ -53,7 +53,7 @@ SOURCE_FILE@0..111 NAME@103..104 IDENT@103..104 "S" WHITESPACE@104..105 " " - RECORD_FIELD_DEF_LIST@105..107 + RECORD_FIELD_LIST@105..107 L_CURLY@105..106 "{" R_CURLY@106..107 "}" SEMICOLON@107..108 ";" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast index e8a0e9ddd2..289fdfd6db 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast @@ -11,9 +11,9 @@ SOURCE_FILE@0..23 ENUM_VARIANT@9..20 NAME@9..10 IDENT@9..10 "X" - TUPLE_FIELD_DEF_LIST@10..15 + TUPLE_FIELD_LIST@10..15 L_PAREN@10..11 "(" - TUPLE_FIELD_DEF@11..14 + TUPLE_FIELD@11..14 PATH_TYPE@11..14 PATH@11..14 PATH_SEGMENT@11..14 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 cf801aedd3..c9d1af92f2 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 @@ -20,10 +20,10 @@ SOURCE_FILE@0..32 IDENT@12..16 "Copy" R_ANGLE@16..17 ">" WHITESPACE@17..18 " " - RECORD_FIELD_DEF_LIST@18..31 + RECORD_FIELD_LIST@18..31 L_CURLY@18..19 "{" WHITESPACE@19..24 "\n " - RECORD_FIELD_DEF@24..28 + RECORD_FIELD@24..28 NAME@24..25 IDENT@24..25 "f" COLON@25..26 ":" 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 a1d5464915..57fb7a329e 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..25 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..25 + RECORD_FIELD_LIST@9..25 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..23 + RECORD_FIELD@15..23 NAME@15..18 IDENT@15..18 "foo" COLON@18..19 ":" 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 ea26f1440d..60ded78d5c 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 @@ -46,7 +46,7 @@ SOURCE_FILE@0..118 NAME@59..60 IDENT@59..60 "S" WHITESPACE@60..61 " " - RECORD_FIELD_DEF_LIST@61..63 + RECORD_FIELD_LIST@61..63 L_CURLY@61..62 "{" R_CURLY@62..63 "}" WHITESPACE@63..64 "\n" 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 95656d19bd..00b1b65be6 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 @@ -12,7 +12,7 @@ SOURCE_FILE@0..97 NAME@17..18 IDENT@17..18 "B" WHITESPACE@18..19 " " - RECORD_FIELD_DEF_LIST@19..21 + RECORD_FIELD_LIST@19..21 L_CURLY@19..20 "{" R_CURLY@20..21 "}" WHITESPACE@21..22 "\n" @@ -21,7 +21,7 @@ SOURCE_FILE@0..97 WHITESPACE@28..29 " " NAME@29..30 IDENT@29..30 "C" - TUPLE_FIELD_DEF_LIST@30..32 + TUPLE_FIELD_LIST@30..32 L_PAREN@30..31 "(" R_PAREN@31..32 ")" SEMICOLON@32..33 ";" @@ -32,10 +32,10 @@ SOURCE_FILE@0..97 NAME@42..43 IDENT@42..43 "D" WHITESPACE@43..44 " " - RECORD_FIELD_DEF_LIST@44..74 + RECORD_FIELD_LIST@44..74 L_CURLY@44..45 "{" WHITESPACE@45..50 "\n " - RECORD_FIELD_DEF@50..56 + RECORD_FIELD@50..56 NAME@50..51 IDENT@50..51 "a" COLON@51..52 ":" @@ -47,7 +47,7 @@ SOURCE_FILE@0..97 IDENT@53..56 "u32" COMMA@56..57 "," WHITESPACE@57..62 "\n " - RECORD_FIELD_DEF@62..72 + RECORD_FIELD@62..72 VISIBILITY@62..65 PUB_KW@62..65 "pub" WHITESPACE@65..66 " " @@ -68,9 +68,9 @@ SOURCE_FILE@0..97 WHITESPACE@82..83 " " NAME@83..84 IDENT@83..84 "E" - TUPLE_FIELD_DEF_LIST@84..95 + TUPLE_FIELD_LIST@84..95 L_PAREN@84..85 "(" - TUPLE_FIELD_DEF@85..90 + TUPLE_FIELD@85..90 VISIBILITY@85..88 PUB_KW@85..88 "pub" WHITESPACE@88..89 " " @@ -81,7 +81,7 @@ SOURCE_FILE@0..97 IDENT@89..90 "x" COMMA@90..91 "," WHITESPACE@91..92 " " - TUPLE_FIELD_DEF@92..93 + TUPLE_FIELD@92..93 PATH_TYPE@92..93 PATH@92..93 PATH_SEGMENT@92..93 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 3ee208ffff..b757bd16dc 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 @@ -23,9 +23,9 @@ SOURCE_FILE@0..290 NAME@24..25 IDENT@24..25 "T" R_ANGLE@25..26 ">" - TUPLE_FIELD_DEF_LIST@26..31 + TUPLE_FIELD_LIST@26..31 L_PAREN@26..27 "(" - TUPLE_FIELD_DEF@27..30 + TUPLE_FIELD@27..30 PATH_TYPE@27..30 PATH@27..30 PATH_SEGMENT@27..30 @@ -46,10 +46,10 @@ SOURCE_FILE@0..290 IDENT@43..44 "T" R_ANGLE@44..45 ">" WHITESPACE@45..46 " " - RECORD_FIELD_DEF_LIST@46..56 + RECORD_FIELD_LIST@46..56 L_CURLY@46..47 "{" WHITESPACE@47..48 " " - RECORD_FIELD_DEF@48..54 + RECORD_FIELD@48..54 NAME@48..49 IDENT@48..49 "u" COLON@49..50 ":" diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast index 993f28c4d6..1a32d88fdc 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast @@ -86,10 +86,10 @@ SOURCE_FILE@0..182 NAME@101..102 IDENT@101..102 "C" WHITESPACE@102..103 " " - RECORD_FIELD_DEF_LIST@103..146 + RECORD_FIELD_LIST@103..146 L_CURLY@103..104 "{" WHITESPACE@104..113 "\n " - RECORD_FIELD_DEF@113..119 + RECORD_FIELD@113..119 NAME@113..114 IDENT@113..114 "a" COLON@114..115 ":" @@ -101,7 +101,7 @@ SOURCE_FILE@0..182 IDENT@116..119 "u32" COMMA@119..120 "," WHITESPACE@120..129 "\n " - RECORD_FIELD_DEF@129..139 + RECORD_FIELD@129..139 VISIBILITY@129..132 PUB_KW@129..132 "pub" WHITESPACE@132..133 " " @@ -123,7 +123,7 @@ SOURCE_FILE@0..182 NAME@152..153 IDENT@152..153 "F" WHITESPACE@153..154 " " - RECORD_FIELD_DEF_LIST@154..156 + RECORD_FIELD_LIST@154..156 L_CURLY@154..155 "{" R_CURLY@155..156 "}" COMMA@156..157 "," @@ -131,9 +131,9 @@ SOURCE_FILE@0..182 ENUM_VARIANT@162..169 NAME@162..163 IDENT@162..163 "D" - TUPLE_FIELD_DEF_LIST@163..169 + TUPLE_FIELD_LIST@163..169 L_PAREN@163..164 "(" - TUPLE_FIELD_DEF@164..167 + TUPLE_FIELD@164..167 PATH_TYPE@164..167 PATH@164..167 PATH_SEGMENT@164..167 @@ -146,7 +146,7 @@ SOURCE_FILE@0..182 ENUM_VARIANT@175..178 NAME@175..176 IDENT@175..176 "E" - TUPLE_FIELD_DEF_LIST@176..178 + TUPLE_FIELD_LIST@176..178 L_PAREN@176..177 "(" R_PAREN@177..178 ")" COMMA@178..179 "," 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 ea54651b76..2aa075993f 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 @@ -1571,10 +1571,10 @@ SOURCE_FILE@0..3813 LIFETIME@2863..2869 "\'union" R_ANGLE@2869..2870 ">" WHITESPACE@2870..2871 " " - RECORD_FIELD_DEF_LIST@2871..2904 + RECORD_FIELD_LIST@2871..2904 L_CURLY@2871..2872 "{" WHITESPACE@2872..2873 " " - RECORD_FIELD_DEF@2873..2901 + RECORD_FIELD@2873..2901 NAME@2873..2878 IDENT@2873..2878 "union" COLON@2878..2879 ":" 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 5640bae0a1..0f0138c861 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 @@ -5,10 +5,10 @@ SOURCE_FILE@0..27 NAME@7..8 IDENT@7..8 "S" WHITESPACE@8..9 " " - RECORD_FIELD_DEF_LIST@9..27 + RECORD_FIELD_LIST@9..27 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - RECORD_FIELD_DEF@15..25 + RECORD_FIELD@15..25 NAME@15..20 IDENT@15..20 "r#foo" COLON@20..21 ":" 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 1c5545b6d3..9c2ea37549 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 @@ -7,10 +7,10 @@ SOURCE_FILE@0..160 NAME@69..73 IDENT@69..73 "Repr" WHITESPACE@73..74 " " - RECORD_FIELD_DEF_LIST@74..90 + RECORD_FIELD_LIST@74..90 L_CURLY@74..75 "{" WHITESPACE@75..76 " " - RECORD_FIELD_DEF@76..88 + RECORD_FIELD@76..88 NAME@76..79 IDENT@76..79 "raw" COLON@79..80 ":" diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast index 29a5d48e64..fcf605ec82 100644 --- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast @@ -268,9 +268,9 @@ SOURCE_FILE@0..395 ENUM_VARIANT@356..365 NAME@356..357 IDENT@356..357 "B" - TUPLE_FIELD_DEF_LIST@357..365 + TUPLE_FIELD_LIST@357..365 L_PAREN@357..358 "(" - TUPLE_FIELD_DEF@358..360 + TUPLE_FIELD@358..360 PATH_TYPE@358..360 PATH@358..360 PATH_SEGMENT@358..360 @@ -278,7 +278,7 @@ SOURCE_FILE@0..395 IDENT@358..360 "i8" COMMA@360..361 "," WHITESPACE@361..362 " " - TUPLE_FIELD_DEF@362..364 + TUPLE_FIELD@362..364 PATH_TYPE@362..364 PATH@362..364 PATH_SEGMENT@362..364 diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 34a0d039c7..f1373fd614 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -39,7 +39,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, SyntaxKind::MODULE => lsp_types::SymbolKind::Module, SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, - SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field, + SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 38709c63e0..ad661218f2 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -180,10 +180,10 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "EXTERN_BLOCK", "EXTERN_ITEM_LIST", "ENUM_VARIANT", - "RECORD_FIELD_DEF_LIST", - "RECORD_FIELD_DEF", - "TUPLE_FIELD_DEF_LIST", - "TUPLE_FIELD_DEF", + "RECORD_FIELD_LIST", + "RECORD_FIELD", + "TUPLE_FIELD_LIST", + "TUPLE_FIELD", "ENUM_VARIANT_LIST", "ITEM_LIST", "ASSOC_ITEM_LIST", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 49b2c9ff88..ba922af0d4 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -78,30 +78,30 @@ TypeAlias = StructDef = Attr* Visibility? 'struct' Name GenericParamList? ( - WhereClause? (RecordFieldDefList | ';') - | TupleFieldDefList WhereClause? ';' + WhereClause? (RecordFieldList | ';') + | TupleFieldList WhereClause? ';' ) -RecordFieldDefList = - '{' fields:RecordFieldDef* '}' +RecordFieldList = + '{' fields:RecordField* '}' -RecordFieldDef = +RecordField = Attr* Visibility? Name ':' ascribed_type:TypeRef -TupleFieldDefList = - '(' fields:TupleFieldDef* ')' +TupleFieldList = + '(' fields:TupleField* ')' -TupleFieldDef = +TupleField = Attr* Visibility? Name TypeRef -FieldDefList = - RecordFieldDefList -| TupleFieldDefList +FieldList = + RecordFieldList +| TupleFieldList UnionDef = Attr* Visibility? 'union' Name GenericParamList? WhereClause? - RecordFieldDefList + RecordFieldList EnumDef = Attr* Visibility? 'enum' Name GenericParamList? WhereClause? @@ -111,7 +111,7 @@ EnumVariantList = '{' variants:EnumVariant* '}' EnumVariant = - Attr* Visibility? Name FieldDefList ('=' Expr)? + Attr* Visibility? Name FieldList ('=' Expr)? TraitDef = Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList