diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-30 15:49:39 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-30 15:49:39 +0100 |
commit | a257fd06b36d2e7310e5e38823f6636343a37331 (patch) | |
tree | e360ad1f518319883677364f49d75d5c508aafcd | |
parent | 282702c2877e3f9002308b1b63fc472b5e799c56 (diff) | |
parent | 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b (diff) |
Merge #5597
5597: Rename FieldDef -> Field r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
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 c3e1f2803..72d06d55b 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<()> { | |||
47 | } | 47 | } |
48 | (vis_offset(&parent), keyword.text_range()) | 48 | (vis_offset(&parent), keyword.text_range()) |
49 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { | 49 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { |
50 | let field = field_name.syntax().ancestors().find_map(ast::RecordFieldDef::cast)?; | 50 | let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?; |
51 | if field.name()? != field_name { | 51 | if field.name()? != field_name { |
52 | mark::hit!(change_visibility_field_false_positive); | 52 | mark::hit!(change_visibility_field_false_positive); |
53 | return None; | 53 | return None; |
@@ -56,7 +56,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
56 | return None; | 56 | return None; |
57 | } | 57 | } |
58 | (vis_offset(field.syntax()), field_name.syntax().text_range()) | 58 | (vis_offset(field.syntax()), field_name.syntax().text_range()) |
59 | } else if let Some(field) = ctx.find_node_at_offset::<ast::TupleFieldDef>() { | 59 | } else if let Some(field) = ctx.find_node_at_offset::<ast::TupleField>() { |
60 | if field.visibility().is_some() { | 60 | if field.visibility().is_some() { |
61 | return None; | 61 | return None; |
62 | } | 62 | } |
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 69ce90fbc..15327facb 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 | |||
43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), | 43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), |
44 | ast::StructDef(it) => { | 44 | ast::StructDef(it) => { |
45 | it.syntax().children_with_tokens() | 45 | it.syntax().children_with_tokens() |
46 | .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])? | 46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? |
47 | }, | 47 | }, |
48 | _ => return None | 48 | _ => return None |
49 | } | 49 | } |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 859bdfb3b..36c0bdc9e 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -361,8 +361,8 @@ pub struct Field { | |||
361 | 361 | ||
362 | #[derive(Debug, PartialEq, Eq)] | 362 | #[derive(Debug, PartialEq, Eq)] |
363 | pub enum FieldSource { | 363 | pub enum FieldSource { |
364 | Named(ast::RecordFieldDef), | 364 | Named(ast::RecordField), |
365 | Pos(ast::TupleFieldDef), | 365 | Pos(ast::TupleField), |
366 | } | 366 | } |
367 | 367 | ||
368 | impl Field { | 368 | impl Field { |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index a654c618f..3e9c54a39 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -589,8 +589,8 @@ to_def_impls![ | |||
589 | (crate::Const, ast::ConstDef, const_to_def), | 589 | (crate::Const, ast::ConstDef, const_to_def), |
590 | (crate::Static, ast::StaticDef, static_to_def), | 590 | (crate::Static, ast::StaticDef, static_to_def), |
591 | (crate::Function, ast::Fn, fn_to_def), | 591 | (crate::Function, ast::Fn, fn_to_def), |
592 | (crate::Field, ast::RecordFieldDef, record_field_to_def), | 592 | (crate::Field, ast::RecordField, record_field_to_def), |
593 | (crate::Field, ast::TupleFieldDef, tuple_field_to_def), | 593 | (crate::Field, ast::TupleField, tuple_field_to_def), |
594 | (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), | 594 | (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), |
595 | (crate::TypeParam, ast::TypeParam, type_param_to_def), | 595 | (crate::TypeParam, ast::TypeParam, type_param_to_def), |
596 | (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros | 596 | (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 d23a1974b..4f90f588e 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<'_, '_> { | |||
92 | pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { | 92 | pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { |
93 | self.to_def(src, keys::TYPE_ALIAS) | 93 | self.to_def(src, keys::TYPE_ALIAS) |
94 | } | 94 | } |
95 | pub(super) fn record_field_to_def( | 95 | pub(super) fn record_field_to_def(&mut self, src: InFile<ast::RecordField>) -> Option<FieldId> { |
96 | &mut self, | ||
97 | src: InFile<ast::RecordFieldDef>, | ||
98 | ) -> Option<FieldId> { | ||
99 | self.to_def(src, keys::RECORD_FIELD) | 96 | self.to_def(src, keys::RECORD_FIELD) |
100 | } | 97 | } |
101 | pub(super) fn tuple_field_to_def( | 98 | pub(super) fn tuple_field_to_def(&mut self, src: InFile<ast::TupleField>) -> Option<FieldId> { |
102 | &mut self, | ||
103 | src: InFile<ast::TupleFieldDef>, | ||
104 | ) -> Option<FieldId> { | ||
105 | self.to_def(src, keys::TUPLE_FIELD) | 99 | self.to_def(src, keys::TUPLE_FIELD) |
106 | } | 100 | } |
107 | pub(super) fn enum_variant_to_def( | 101 | 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 4994a2125..2be23c45d 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -179,7 +179,7 @@ impl VariantData { | |||
179 | 179 | ||
180 | impl HasChildSource for VariantId { | 180 | impl HasChildSource for VariantId { |
181 | type ChildId = LocalFieldId; | 181 | type ChildId = LocalFieldId; |
182 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; | 182 | type Value = Either<ast::TupleField, ast::RecordField>; |
183 | 183 | ||
184 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { | 184 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
185 | let (src, module_id) = match self { | 185 | let (src, module_id) = match self { |
@@ -194,7 +194,7 @@ impl HasChildSource for VariantId { | |||
194 | } | 194 | } |
195 | VariantId::UnionId(it) => ( | 195 | VariantId::UnionId(it) => ( |
196 | it.lookup(db).source(db).map(|it| { | 196 | it.lookup(db).source(db).map(|it| { |
197 | it.record_field_def_list() | 197 | it.record_field_list() |
198 | .map(ast::StructKind::Record) | 198 | .map(ast::StructKind::Record) |
199 | .unwrap_or(ast::StructKind::Unit) | 199 | .unwrap_or(ast::StructKind::Unit) |
200 | }), | 200 | }), |
@@ -218,7 +218,7 @@ pub enum StructKind { | |||
218 | fn lower_struct( | 218 | fn lower_struct( |
219 | db: &dyn DefDatabase, | 219 | db: &dyn DefDatabase, |
220 | expander: &mut CfgExpander, | 220 | expander: &mut CfgExpander, |
221 | trace: &mut Trace<FieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, | 221 | trace: &mut Trace<FieldData, Either<ast::TupleField, ast::RecordField>>, |
222 | ast: &InFile<ast::StructKind>, | 222 | ast: &InFile<ast::StructKind>, |
223 | ) -> StructKind { | 223 | ) -> StructKind { |
224 | let ctx = LowerCtx::new(db, ast.file_id); | 224 | 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 19d165b5b..df909ee9e 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 @@ | |||
1 | //! AST -> `ItemTree` lowering code. | 1 | //! AST -> `ItemTree` lowering code. |
2 | 2 | ||
3 | use super::*; | 3 | use std::{collections::hash_map::Entry, mem, sync::Arc}; |
4 | use crate::{ | 4 | |
5 | attr::Attrs, | ||
6 | generics::{GenericParams, TypeParamData, TypeParamProvenance}, | ||
7 | }; | ||
8 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; | 5 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; |
9 | use ra_arena::map::ArenaMap; | 6 | use ra_arena::map::ArenaMap; |
10 | use ra_syntax::{ | 7 | use ra_syntax::{ |
@@ -12,7 +9,13 @@ use ra_syntax::{ | |||
12 | SyntaxNode, | 9 | SyntaxNode, |
13 | }; | 10 | }; |
14 | use smallvec::SmallVec; | 11 | use smallvec::SmallVec; |
15 | use std::{collections::hash_map::Entry, mem, sync::Arc}; | 12 | |
13 | use crate::{ | ||
14 | attr::Attrs, | ||
15 | generics::{GenericParams, TypeParamData, TypeParamProvenance}, | ||
16 | }; | ||
17 | |||
18 | use super::*; | ||
16 | 19 | ||
17 | fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> { | 20 | fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> { |
18 | FileItemTreeId { index, _p: PhantomData } | 21 | FileItemTreeId { index, _p: PhantomData } |
@@ -191,7 +194,7 @@ impl Ctx { | |||
191 | } | 194 | } |
192 | } | 195 | } |
193 | 196 | ||
194 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange<Field> { | 197 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange<Field> { |
195 | let start = self.next_field_idx(); | 198 | let start = self.next_field_idx(); |
196 | for field in fields.fields() { | 199 | for field in fields.fields() { |
197 | if let Some(data) = self.lower_record_field(&field) { | 200 | if let Some(data) = self.lower_record_field(&field) { |
@@ -203,7 +206,7 @@ impl Ctx { | |||
203 | IdRange::new(start..end) | 206 | IdRange::new(start..end) |
204 | } | 207 | } |
205 | 208 | ||
206 | fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> { | 209 | fn lower_record_field(&mut self, field: &ast::RecordField) -> Option<Field> { |
207 | let name = field.name()?.as_name(); | 210 | let name = field.name()?.as_name(); |
208 | let visibility = self.lower_visibility(field); | 211 | let visibility = self.lower_visibility(field); |
209 | let type_ref = self.lower_type_ref_opt(field.ascribed_type()); | 212 | let type_ref = self.lower_type_ref_opt(field.ascribed_type()); |
@@ -211,7 +214,7 @@ impl Ctx { | |||
211 | Some(res) | 214 | Some(res) |
212 | } | 215 | } |
213 | 216 | ||
214 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { | 217 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange<Field> { |
215 | let start = self.next_field_idx(); | 218 | let start = self.next_field_idx(); |
216 | for (i, field) in fields.fields().enumerate() { | 219 | for (i, field) in fields.fields().enumerate() { |
217 | let data = self.lower_tuple_field(i, &field); | 220 | let data = self.lower_tuple_field(i, &field); |
@@ -222,7 +225,7 @@ impl Ctx { | |||
222 | IdRange::new(start..end) | 225 | IdRange::new(start..end) |
223 | } | 226 | } |
224 | 227 | ||
225 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { | 228 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { |
226 | let name = Name::new_tuple_field(idx); | 229 | let name = Name::new_tuple_field(idx); |
227 | let visibility = self.lower_visibility(field); | 230 | let visibility = self.lower_visibility(field); |
228 | let type_ref = self.lower_type_ref_opt(field.type_ref()); | 231 | let type_ref = self.lower_type_ref_opt(field.type_ref()); |
@@ -234,10 +237,8 @@ impl Ctx { | |||
234 | let visibility = self.lower_visibility(union); | 237 | let visibility = self.lower_visibility(union); |
235 | let name = union.name()?.as_name(); | 238 | let name = union.name()?.as_name(); |
236 | let generic_params = self.lower_generic_params(GenericsOwner::Union, union); | 239 | let generic_params = self.lower_generic_params(GenericsOwner::Union, union); |
237 | let fields = match union.record_field_def_list() { | 240 | let fields = match union.record_field_list() { |
238 | Some(record_field_def_list) => { | 241 | Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)), |
239 | self.lower_fields(&StructKind::Record(record_field_def_list)) | ||
240 | } | ||
241 | None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), | 242 | None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), |
242 | }; | 243 | }; |
243 | let ast_id = self.source_ast_id_map.ast_id(union); | 244 | 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 f627eab1f..9ca276235 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<ast::UnionDef, UnionId> = Key::new(); | |||
25 | pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); | 25 | pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); |
26 | 26 | ||
27 | pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); | 27 | pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); |
28 | pub const TUPLE_FIELD: Key<ast::TupleFieldDef, FieldId> = Key::new(); | 28 | pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new(); |
29 | pub const RECORD_FIELD: Key<ast::RecordFieldDef, FieldId> = Key::new(); | 29 | pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new(); |
30 | pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); | 30 | pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); |
31 | 31 | ||
32 | pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new(); | 32 | pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new(); |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index efbb00d6d..dd8a7ffd9 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -155,21 +155,21 @@ fn missing_struct_field_fix( | |||
155 | module = s.module(sema.db); | 155 | module = s.module(sema.db); |
156 | let source = s.source(sema.db); | 156 | let source = s.source(sema.db); |
157 | def_file_id = source.file_id; | 157 | def_file_id = source.file_id; |
158 | let fields = source.value.field_def_list()?; | 158 | let fields = source.value.field_list()?; |
159 | record_field_def_list(fields)? | 159 | record_field_list(fields)? |
160 | } | 160 | } |
161 | VariantDef::Union(u) => { | 161 | VariantDef::Union(u) => { |
162 | module = u.module(sema.db); | 162 | module = u.module(sema.db); |
163 | let source = u.source(sema.db); | 163 | let source = u.source(sema.db); |
164 | def_file_id = source.file_id; | 164 | def_file_id = source.file_id; |
165 | source.value.record_field_def_list()? | 165 | source.value.record_field_list()? |
166 | } | 166 | } |
167 | VariantDef::EnumVariant(e) => { | 167 | VariantDef::EnumVariant(e) => { |
168 | module = e.module(sema.db); | 168 | module = e.module(sema.db); |
169 | let source = e.source(sema.db); | 169 | let source = e.source(sema.db); |
170 | def_file_id = source.file_id; | 170 | def_file_id = source.file_id; |
171 | let fields = source.value.field_def_list()?; | 171 | let fields = source.value.field_list()?; |
172 | record_field_def_list(fields)? | 172 | record_field_list(fields)? |
173 | } | 173 | } |
174 | }; | 174 | }; |
175 | let def_file_id = def_file_id.original_file(sema.db); | 175 | let def_file_id = def_file_id.original_file(sema.db); |
@@ -205,10 +205,10 @@ fn missing_struct_field_fix( | |||
205 | let fix = Fix::new("Create field", source_change.into()); | 205 | let fix = Fix::new("Create field", source_change.into()); |
206 | return Some(fix); | 206 | return Some(fix); |
207 | 207 | ||
208 | fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option<ast::RecordFieldDefList> { | 208 | fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> { |
209 | match field_def_list { | 209 | match field_def_list { |
210 | ast::FieldDefList::RecordFieldDefList(it) => Some(it), | 210 | ast::FieldList::RecordFieldList(it) => Some(it), |
211 | ast::FieldDefList::TupleFieldDefList(_) => None, | 211 | ast::FieldList::TupleFieldList(_) => None, |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } | 214 | } |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 4f19c7ed4..797d2d8e3 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 | |||
387 | ast::TypeAlias(it) => it.doc_comment_text(), | 387 | ast::TypeAlias(it) => it.doc_comment_text(), |
388 | ast::ConstDef(it) => it.doc_comment_text(), | 388 | ast::ConstDef(it) => it.doc_comment_text(), |
389 | ast::StaticDef(it) => it.doc_comment_text(), | 389 | ast::StaticDef(it) => it.doc_comment_text(), |
390 | ast::RecordFieldDef(it) => it.doc_comment_text(), | 390 | ast::RecordField(it) => it.doc_comment_text(), |
391 | ast::EnumVariant(it) => it.doc_comment_text(), | 391 | ast::EnumVariant(it) => it.doc_comment_text(), |
392 | ast::MacroCall(it) => it.doc_comment_text(), | 392 | ast::MacroCall(it) => it.doc_comment_text(), |
393 | _ => None, | 393 | _ => None, |
@@ -412,7 +412,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
412 | ast::TypeAlias(it) => it.short_label(), | 412 | ast::TypeAlias(it) => it.short_label(), |
413 | ast::ConstDef(it) => it.short_label(), | 413 | ast::ConstDef(it) => it.short_label(), |
414 | ast::StaticDef(it) => it.short_label(), | 414 | ast::StaticDef(it) => it.short_label(), |
415 | ast::RecordFieldDef(it) => it.short_label(), | 415 | ast::RecordField(it) => it.short_label(), |
416 | ast::EnumVariant(it) => it.short_label(), | 416 | ast::EnumVariant(it) => it.short_label(), |
417 | _ => None, | 417 | _ => None, |
418 | } | 418 | } |
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index e2c95be06..78a2598d6 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 { | |||
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | impl ShortLabel for ast::RecordFieldDef { | 68 | impl ShortLabel for ast::RecordField { |
69 | fn short_label(&self) -> Option<String> { | 69 | fn short_label(&self) -> Option<String> { |
70 | short_label_from_ascribed_node(self, "") | 70 | short_label_from_ascribed_node(self, "") |
71 | } | 71 | } |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 597a7d82f..04a7f0ac4 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( | |||
39 | let list_kinds = [ | 39 | let list_kinds = [ |
40 | RECORD_FIELD_PAT_LIST, | 40 | RECORD_FIELD_PAT_LIST, |
41 | MATCH_ARM_LIST, | 41 | MATCH_ARM_LIST, |
42 | RECORD_FIELD_DEF_LIST, | 42 | RECORD_FIELD_LIST, |
43 | TUPLE_FIELD_DEF_LIST, | 43 | TUPLE_FIELD_LIST, |
44 | RECORD_EXPR_FIELD_LIST, | 44 | RECORD_EXPR_FIELD_LIST, |
45 | ENUM_VARIANT_LIST, | 45 | ENUM_VARIANT_LIST, |
46 | USE_TREE_LIST, | 46 | USE_TREE_LIST, |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 05ccc0b73..a8fd1a2fd 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<StructureNode> { | |||
136 | let ty = it.type_ref(); | 136 | let ty = it.type_ref(); |
137 | decl_with_type_ref(it, ty) | 137 | decl_with_type_ref(it, ty) |
138 | }, | 138 | }, |
139 | ast::RecordFieldDef(it) => decl_with_ascription(it), | 139 | ast::RecordField(it) => decl_with_ascription(it), |
140 | ast::ConstDef(it) => decl_with_ascription(it), | 140 | ast::ConstDef(it) => decl_with_ascription(it), |
141 | ast::StaticDef(it) => decl_with_ascription(it), | 141 | ast::StaticDef(it) => decl_with_ascription(it), |
142 | ast::ImplDef(it) => { | 142 | ast::ImplDef(it) => { |
@@ -249,7 +249,7 @@ fn very_obsolete() {} | |||
249 | label: "x", | 249 | label: "x", |
250 | navigation_range: 18..19, | 250 | navigation_range: 18..19, |
251 | node_range: 18..24, | 251 | node_range: 18..24, |
252 | kind: RECORD_FIELD_DEF, | 252 | kind: RECORD_FIELD, |
253 | detail: Some( | 253 | detail: Some( |
254 | "i32", | 254 | "i32", |
255 | ), | 255 | ), |
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index 972505450..8dcce9f56 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<FoldKind> { | |||
85 | COMMENT => Some(FoldKind::Comment), | 85 | COMMENT => Some(FoldKind::Comment), |
86 | USE => Some(FoldKind::Imports), | 86 | USE => Some(FoldKind::Imports), |
87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), | 87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), |
88 | RECORD_FIELD_DEF_LIST | 88 | RECORD_FIELD_LIST |
89 | | RECORD_FIELD_PAT_LIST | 89 | | RECORD_FIELD_PAT_LIST |
90 | | RECORD_EXPR_FIELD_LIST | 90 | | RECORD_EXPR_FIELD_LIST |
91 | | ITEM_LIST | 91 | | ITEM_LIST |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 94d03a07f..d61ac271e 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -361,7 +361,7 @@ fn main(s: Foo) { | |||
361 | ); | 361 | ); |
362 | check_result( | 362 | check_result( |
363 | refs, | 363 | refs, |
364 | "spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other", | 364 | "spam RECORD_FIELD FileId(1) 17..30 21..25 Other", |
365 | &["FileId(1) 67..71 Other Read"], | 365 | &["FileId(1) 67..71 Other Read"], |
366 | ); | 366 | ); |
367 | } | 367 | } |
@@ -580,7 +580,7 @@ fn foo() { | |||
580 | ); | 580 | ); |
581 | check_result( | 581 | check_result( |
582 | refs, | 582 | refs, |
583 | "f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other", | 583 | "f RECORD_FIELD FileId(1) 15..21 15..16 Other", |
584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], | 584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], |
585 | ); | 585 | ); |
586 | } | 586 | } |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 8d52fb6e4..a04b9d893 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 { | |||
711 | TRAIT_DEF => HighlightTag::Trait, | 711 | TRAIT_DEF => HighlightTag::Trait, |
712 | TYPE_ALIAS => HighlightTag::TypeAlias, | 712 | TYPE_ALIAS => HighlightTag::TypeAlias, |
713 | TYPE_PARAM => HighlightTag::TypeParam, | 713 | TYPE_PARAM => HighlightTag::TypeParam, |
714 | RECORD_FIELD_DEF => HighlightTag::Field, | 714 | RECORD_FIELD => HighlightTag::Field, |
715 | MODULE => HighlightTag::Module, | 715 | MODULE => HighlightTag::Module, |
716 | FN => HighlightTag::Function, | 716 | FN => HighlightTag::Function, |
717 | CONST_DEF => HighlightTag::Constant, | 717 | CONST_DEF => HighlightTag::Constant, |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 6ea7f173b..30f18b9cf 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<RootDatabase>, name: &ast::Name) -> Option | |||
142 | 142 | ||
143 | Some(NameClass::Definition(Definition::Local(local))) | 143 | Some(NameClass::Definition(Definition::Local(local))) |
144 | }, | 144 | }, |
145 | ast::RecordFieldDef(it) => { | 145 | ast::RecordField(it) => { |
146 | let field: hir::Field = sema.to_def(&it)?; | 146 | let field: hir::Field = sema.to_def(&it)?; |
147 | Some(NameClass::Definition(Definition::Field(field))) | 147 | Some(NameClass::Definition(Definition::Field(field))) |
148 | }, | 148 | }, |
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index 220690cdd..d7b198458 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -494,9 +494,9 @@ [email protected] | |||
494 | [email protected] "struct" | 494 | [email protected] "struct" |
495 | [email protected] | 495 | [email protected] |
496 | [email protected] "Foo" | 496 | [email protected] "Foo" |
497 | RECORD_FIELD_DEF_[email protected] | 497 | [email protected] |
498 | [email protected] "{" | 498 | [email protected] "{" |
499 | RECORD_FIELD_DEF@10..19 | 499 | [email protected] |
500 | [email protected] | 500 | [email protected] |
501 | [email protected] "field" | 501 | [email protected] "field" |
502 | [email protected] ":" | 502 | [email protected] ":" |
@@ -510,9 +510,9 @@ [email protected] | |||
510 | [email protected] "struct" | 510 | [email protected] "struct" |
511 | [email protected] | 511 | [email protected] |
512 | [email protected] "Bar" | 512 | [email protected] "Bar" |
513 | RECORD_FIELD_DEF_[email protected] | 513 | [email protected] |
514 | [email protected] "{" | 514 | [email protected] "{" |
515 | RECORD_FIELD_DEF@30..39 | 515 | [email protected] |
516 | [email protected] | 516 | [email protected] |
517 | [email protected] "field" | 517 | [email protected] "field" |
518 | [email protected] ":" | 518 | [email protected] ":" |
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 3610e7392..03041d110 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -142,7 +142,7 @@ pub(crate) fn reparser( | |||
142 | ) -> Option<fn(&mut Parser)> { | 142 | ) -> Option<fn(&mut Parser)> { |
143 | let res = match node { | 143 | let res = match node { |
144 | BLOCK_EXPR => expressions::block_expr, | 144 | BLOCK_EXPR => expressions::block_expr, |
145 | RECORD_FIELD_DEF_LIST => items::record_field_def_list, | 145 | RECORD_FIELD_LIST => items::record_field_def_list, |
146 | RECORD_EXPR_FIELD_LIST => items::record_field_list, | 146 | RECORD_EXPR_FIELD_LIST => items::record_field_list, |
147 | ENUM_VARIANT_LIST => items::enum_variant_list, | 147 | ENUM_VARIANT_LIST => items::enum_variant_list, |
148 | MATCH_ARM_LIST => items::match_arm_list, | 148 | 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 74b9f514b..0e96bf77e 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) { | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | p.expect(T!['}']); | 121 | p.expect(T!['}']); |
122 | m.complete(p, RECORD_FIELD_DEF_LIST); | 122 | m.complete(p, RECORD_FIELD_LIST); |
123 | 123 | ||
124 | fn record_field_def(p: &mut Parser) { | 124 | fn record_field_def(p: &mut Parser) { |
125 | let m = p.start(); | 125 | let m = p.start(); |
@@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
134 | name(p); | 134 | name(p); |
135 | p.expect(T![:]); | 135 | p.expect(T![:]); |
136 | types::type_(p); | 136 | types::type_(p); |
137 | m.complete(p, RECORD_FIELD_DEF); | 137 | m.complete(p, RECORD_FIELD); |
138 | } else { | 138 | } else { |
139 | m.abandon(p); | 139 | m.abandon(p); |
140 | p.err_and_bump("expected field declaration"); | 140 | p.err_and_bump("expected field declaration"); |
@@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) { | |||
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | types::type_(p); | 169 | types::type_(p); |
170 | m.complete(p, TUPLE_FIELD_DEF); | 170 | m.complete(p, TUPLE_FIELD); |
171 | 171 | ||
172 | if !p.at(T![')']) { | 172 | if !p.at(T![')']) { |
173 | p.expect(T![,]); | 173 | p.expect(T![,]); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | p.expect(T![')']); | 176 | p.expect(T![')']); |
177 | m.complete(p, TUPLE_FIELD_DEF_LIST); | 177 | m.complete(p, TUPLE_FIELD_LIST); |
178 | } | 178 | } |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index ac79786ff..8586758b4 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 { | |||
207 | EXTERN_BLOCK, | 207 | EXTERN_BLOCK, |
208 | EXTERN_ITEM_LIST, | 208 | EXTERN_ITEM_LIST, |
209 | ENUM_VARIANT, | 209 | ENUM_VARIANT, |
210 | RECORD_FIELD_DEF_LIST, | 210 | RECORD_FIELD_LIST, |
211 | RECORD_FIELD_DEF, | 211 | RECORD_FIELD, |
212 | TUPLE_FIELD_DEF_LIST, | 212 | TUPLE_FIELD_LIST, |
213 | TUPLE_FIELD_DEF, | 213 | TUPLE_FIELD, |
214 | ENUM_VARIANT_LIST, | 214 | ENUM_VARIANT_LIST, |
215 | ITEM_LIST, | 215 | ITEM_LIST, |
216 | ASSOC_ITEM_LIST, | 216 | ASSOC_ITEM_LIST, |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 9f9c06e50..46d73215c 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 {} | |||
165 | impl StructDef { | 165 | impl StructDef { |
166 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } | 166 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } |
167 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 167 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
168 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 168 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } |
169 | } | 169 | } |
170 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 170 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
171 | pub struct TraitDef { | 171 | pub struct TraitDef { |
@@ -208,9 +208,7 @@ impl ast::VisibilityOwner for UnionDef {} | |||
208 | impl ast::GenericParamsOwner for UnionDef {} | 208 | impl ast::GenericParamsOwner for UnionDef {} |
209 | impl UnionDef { | 209 | impl UnionDef { |
210 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } | 210 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } |
211 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | 211 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } |
212 | support::child(&self.syntax) | ||
213 | } | ||
214 | } | 212 | } |
215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 213 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
216 | pub struct Use { | 214 | pub struct Use { |
@@ -391,42 +389,42 @@ impl TypeBoundList { | |||
391 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 389 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } |
392 | } | 390 | } |
393 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 391 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
394 | pub struct RecordFieldDefList { | 392 | pub struct RecordFieldList { |
395 | pub(crate) syntax: SyntaxNode, | 393 | pub(crate) syntax: SyntaxNode, |
396 | } | 394 | } |
397 | impl RecordFieldDefList { | 395 | impl RecordFieldList { |
398 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 396 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
399 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } | 397 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } |
400 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 398 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
401 | } | 399 | } |
402 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 400 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
403 | pub struct TupleFieldDefList { | 401 | pub struct TupleFieldList { |
404 | pub(crate) syntax: SyntaxNode, | 402 | pub(crate) syntax: SyntaxNode, |
405 | } | 403 | } |
406 | impl TupleFieldDefList { | 404 | impl TupleFieldList { |
407 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 405 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
408 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } | 406 | pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) } |
409 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 407 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
410 | } | 408 | } |
411 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 409 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
412 | pub struct RecordFieldDef { | 410 | pub struct RecordField { |
413 | pub(crate) syntax: SyntaxNode, | 411 | pub(crate) syntax: SyntaxNode, |
414 | } | 412 | } |
415 | impl ast::AttrsOwner for RecordFieldDef {} | 413 | impl ast::AttrsOwner for RecordField {} |
416 | impl ast::NameOwner for RecordFieldDef {} | 414 | impl ast::NameOwner for RecordField {} |
417 | impl ast::VisibilityOwner for RecordFieldDef {} | 415 | impl ast::VisibilityOwner for RecordField {} |
418 | impl ast::TypeAscriptionOwner for RecordFieldDef {} | 416 | impl ast::TypeAscriptionOwner for RecordField {} |
419 | impl RecordFieldDef { | 417 | impl RecordField { |
420 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 418 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
421 | } | 419 | } |
422 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 420 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
423 | pub struct TupleFieldDef { | 421 | pub struct TupleField { |
424 | pub(crate) syntax: SyntaxNode, | 422 | pub(crate) syntax: SyntaxNode, |
425 | } | 423 | } |
426 | impl ast::AttrsOwner for TupleFieldDef {} | 424 | impl ast::AttrsOwner for TupleField {} |
427 | impl ast::NameOwner for TupleFieldDef {} | 425 | impl ast::NameOwner for TupleField {} |
428 | impl ast::VisibilityOwner for TupleFieldDef {} | 426 | impl ast::VisibilityOwner for TupleField {} |
429 | impl TupleFieldDef { | 427 | impl TupleField { |
430 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 428 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
431 | } | 429 | } |
432 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 430 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -446,7 +444,7 @@ impl ast::AttrsOwner for EnumVariant {} | |||
446 | impl ast::NameOwner for EnumVariant {} | 444 | impl ast::NameOwner for EnumVariant {} |
447 | impl ast::VisibilityOwner for EnumVariant {} | 445 | impl ast::VisibilityOwner for EnumVariant {} |
448 | impl EnumVariant { | 446 | impl EnumVariant { |
449 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 447 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } |
450 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 448 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
451 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 449 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
452 | } | 450 | } |
@@ -1326,9 +1324,9 @@ pub enum Pat { | |||
1326 | MacroPat(MacroPat), | 1324 | MacroPat(MacroPat), |
1327 | } | 1325 | } |
1328 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1326 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1329 | pub enum FieldDefList { | 1327 | pub enum FieldList { |
1330 | RecordFieldDefList(RecordFieldDefList), | 1328 | RecordFieldList(RecordFieldList), |
1331 | TupleFieldDefList(TupleFieldDefList), | 1329 | TupleFieldList(TupleFieldList), |
1332 | } | 1330 | } |
1333 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1331 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1334 | pub enum Expr { | 1332 | pub enum Expr { |
@@ -1765,8 +1763,8 @@ impl AstNode for TypeBoundList { | |||
1765 | } | 1763 | } |
1766 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1764 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1767 | } | 1765 | } |
1768 | impl AstNode for RecordFieldDefList { | 1766 | impl AstNode for RecordFieldList { |
1769 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } | 1767 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } |
1770 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1768 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1771 | if Self::can_cast(syntax.kind()) { | 1769 | if Self::can_cast(syntax.kind()) { |
1772 | Some(Self { syntax }) | 1770 | Some(Self { syntax }) |
@@ -1776,8 +1774,8 @@ impl AstNode for RecordFieldDefList { | |||
1776 | } | 1774 | } |
1777 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1775 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1778 | } | 1776 | } |
1779 | impl AstNode for TupleFieldDefList { | 1777 | impl AstNode for TupleFieldList { |
1780 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } | 1778 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } |
1781 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1779 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1782 | if Self::can_cast(syntax.kind()) { | 1780 | if Self::can_cast(syntax.kind()) { |
1783 | Some(Self { syntax }) | 1781 | Some(Self { syntax }) |
@@ -1787,8 +1785,8 @@ impl AstNode for TupleFieldDefList { | |||
1787 | } | 1785 | } |
1788 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1786 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1789 | } | 1787 | } |
1790 | impl AstNode for RecordFieldDef { | 1788 | impl AstNode for RecordField { |
1791 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } | 1789 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } |
1792 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1790 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1793 | if Self::can_cast(syntax.kind()) { | 1791 | if Self::can_cast(syntax.kind()) { |
1794 | Some(Self { syntax }) | 1792 | Some(Self { syntax }) |
@@ -1798,8 +1796,8 @@ impl AstNode for RecordFieldDef { | |||
1798 | } | 1796 | } |
1799 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1797 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1800 | } | 1798 | } |
1801 | impl AstNode for TupleFieldDef { | 1799 | impl AstNode for TupleField { |
1802 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } | 1800 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } |
1803 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1801 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1804 | if Self::can_cast(syntax.kind()) { | 1802 | if Self::can_cast(syntax.kind()) { |
1805 | Some(Self { syntax }) | 1803 | Some(Self { syntax }) |
@@ -3046,33 +3044,31 @@ impl AstNode for Pat { | |||
3046 | } | 3044 | } |
3047 | } | 3045 | } |
3048 | } | 3046 | } |
3049 | impl From<RecordFieldDefList> for FieldDefList { | 3047 | impl From<RecordFieldList> for FieldList { |
3050 | fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } | 3048 | fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) } |
3051 | } | 3049 | } |
3052 | impl From<TupleFieldDefList> for FieldDefList { | 3050 | impl From<TupleFieldList> for FieldList { |
3053 | fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) } | 3051 | fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) } |
3054 | } | 3052 | } |
3055 | impl AstNode for FieldDefList { | 3053 | impl AstNode for FieldList { |
3056 | fn can_cast(kind: SyntaxKind) -> bool { | 3054 | fn can_cast(kind: SyntaxKind) -> bool { |
3057 | match kind { | 3055 | match kind { |
3058 | RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, | 3056 | RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true, |
3059 | _ => false, | 3057 | _ => false, |
3060 | } | 3058 | } |
3061 | } | 3059 | } |
3062 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3060 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3063 | let res = match syntax.kind() { | 3061 | let res = match syntax.kind() { |
3064 | RECORD_FIELD_DEF_LIST => { | 3062 | RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }), |
3065 | FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) | 3063 | TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }), |
3066 | } | ||
3067 | TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }), | ||
3068 | _ => return None, | 3064 | _ => return None, |
3069 | }; | 3065 | }; |
3070 | Some(res) | 3066 | Some(res) |
3071 | } | 3067 | } |
3072 | fn syntax(&self) -> &SyntaxNode { | 3068 | fn syntax(&self) -> &SyntaxNode { |
3073 | match self { | 3069 | match self { |
3074 | FieldDefList::RecordFieldDefList(it) => &it.syntax, | 3070 | FieldList::RecordFieldList(it) => &it.syntax, |
3075 | FieldDefList::TupleFieldDefList(it) => &it.syntax, | 3071 | FieldList::TupleFieldList(it) => &it.syntax, |
3076 | } | 3072 | } |
3077 | } | 3073 | } |
3078 | } | 3074 | } |
@@ -3425,7 +3421,7 @@ impl std::fmt::Display for Pat { | |||
3425 | std::fmt::Display::fmt(self.syntax(), f) | 3421 | std::fmt::Display::fmt(self.syntax(), f) |
3426 | } | 3422 | } |
3427 | } | 3423 | } |
3428 | impl std::fmt::Display for FieldDefList { | 3424 | impl std::fmt::Display for FieldList { |
3429 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3425 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3430 | std::fmt::Display::fmt(self.syntax(), f) | 3426 | std::fmt::Display::fmt(self.syntax(), f) |
3431 | } | 3427 | } |
@@ -3625,22 +3621,22 @@ impl std::fmt::Display for TypeBoundList { | |||
3625 | std::fmt::Display::fmt(self.syntax(), f) | 3621 | std::fmt::Display::fmt(self.syntax(), f) |
3626 | } | 3622 | } |
3627 | } | 3623 | } |
3628 | impl std::fmt::Display for RecordFieldDefList { | 3624 | impl std::fmt::Display for RecordFieldList { |
3629 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3625 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3630 | std::fmt::Display::fmt(self.syntax(), f) | 3626 | std::fmt::Display::fmt(self.syntax(), f) |
3631 | } | 3627 | } |
3632 | } | 3628 | } |
3633 | impl std::fmt::Display for TupleFieldDefList { | 3629 | impl std::fmt::Display for TupleFieldList { |
3634 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3630 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3635 | std::fmt::Display::fmt(self.syntax(), f) | 3631 | std::fmt::Display::fmt(self.syntax(), f) |
3636 | } | 3632 | } |
3637 | } | 3633 | } |
3638 | impl std::fmt::Display for RecordFieldDef { | 3634 | impl std::fmt::Display for RecordField { |
3639 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3635 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3640 | std::fmt::Display::fmt(self.syntax(), f) | 3636 | std::fmt::Display::fmt(self.syntax(), f) |
3641 | } | 3637 | } |
3642 | } | 3638 | } |
3643 | impl std::fmt::Display for TupleFieldDef { | 3639 | impl std::fmt::Display for TupleField { |
3644 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3640 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3645 | std::fmt::Display::fmt(self.syntax(), f) | 3641 | std::fmt::Display::fmt(self.syntax(), f) |
3646 | } | 3642 | } |
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 183ec4481..509e8ae7a 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::Expr>) -> ast::RecordE | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { | 78 | pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField { |
79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) | 79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 8c7457e32..ffe6746d3 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 { | |||
166 | 166 | ||
167 | #[derive(Debug, Clone, PartialEq, Eq)] | 167 | #[derive(Debug, Clone, PartialEq, Eq)] |
168 | pub enum StructKind { | 168 | pub enum StructKind { |
169 | Record(ast::RecordFieldDefList), | 169 | Record(ast::RecordFieldList), |
170 | Tuple(ast::TupleFieldDefList), | 170 | Tuple(ast::TupleFieldList), |
171 | Unit, | 171 | Unit, |
172 | } | 172 | } |
173 | 173 | ||
174 | impl StructKind { | 174 | impl StructKind { |
175 | fn from_node<N: AstNode>(node: &N) -> StructKind { | 175 | fn from_node<N: AstNode>(node: &N) -> StructKind { |
176 | if let Some(nfdl) = support::child::<ast::RecordFieldDefList>(node.syntax()) { | 176 | if let Some(nfdl) = support::child::<ast::RecordFieldList>(node.syntax()) { |
177 | StructKind::Record(nfdl) | 177 | StructKind::Record(nfdl) |
178 | } else if let Some(pfl) = support::child::<ast::TupleFieldDefList>(node.syntax()) { | 178 | } else if let Some(pfl) = support::child::<ast::TupleFieldList>(node.syntax()) { |
179 | StructKind::Tuple(pfl) | 179 | StructKind::Tuple(pfl) |
180 | } else { | 180 | } else { |
181 | StructKind::Unit | 181 | StructKind::Unit |
@@ -477,8 +477,8 @@ impl ast::DocCommentsOwner for ast::SourceFile {} | |||
477 | impl ast::DocCommentsOwner for ast::Fn {} | 477 | impl ast::DocCommentsOwner for ast::Fn {} |
478 | impl ast::DocCommentsOwner for ast::StructDef {} | 478 | impl ast::DocCommentsOwner for ast::StructDef {} |
479 | impl ast::DocCommentsOwner for ast::UnionDef {} | 479 | impl ast::DocCommentsOwner for ast::UnionDef {} |
480 | impl ast::DocCommentsOwner for ast::RecordFieldDef {} | 480 | impl ast::DocCommentsOwner for ast::RecordField {} |
481 | impl ast::DocCommentsOwner for ast::TupleFieldDef {} | 481 | impl ast::DocCommentsOwner for ast::TupleField {} |
482 | impl ast::DocCommentsOwner for ast::EnumDef {} | 482 | impl ast::DocCommentsOwner for ast::EnumDef {} |
483 | impl ast::DocCommentsOwner for ast::EnumVariant {} | 483 | impl ast::DocCommentsOwner for ast::EnumVariant {} |
484 | impl ast::DocCommentsOwner for ast::TraitDef {} | 484 | 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 87a7acd09..0a1246c59 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>( | |||
147 | ) -> usize { | 147 | ) -> usize { |
148 | match kind { | 148 | match kind { |
149 | MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN | 149 | MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN |
150 | | TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => { | 150 | | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => { |
151 | let mut res = 0; | 151 | let mut res = 0; |
152 | let mut trivias = trivias.enumerate().peekable(); | 152 | let mut trivias = trivias.enumerate().peekable(); |
153 | 153 | ||
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 62f03e93d..ca7957747 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -98,7 +98,7 @@ fn test_local_syntax_ptr() { | |||
98 | use crate::{ast, AstNode, SourceFile}; | 98 | use crate::{ast, AstNode, SourceFile}; |
99 | 99 | ||
100 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); | 100 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); |
101 | let field = file.syntax().descendants().find_map(ast::RecordFieldDef::cast).unwrap(); | 101 | let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap(); |
102 | let ptr = SyntaxNodePtr::new(field.syntax()); | 102 | let ptr = SyntaxNodePtr::new(field.syntax()); |
103 | let field_syntax = ptr.to_node(file.syntax()); | 103 | let field_syntax = ptr.to_node(file.syntax()); |
104 | assert_eq!(field.syntax(), &field_syntax); | 104 | 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 81f0f575c..93f6060ed 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "a" | 13 | [email protected] "a" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "u32" | 20 | [email protected] "u32" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | RECORD_FIELD_DEF@26..32 | 22 | [email protected] |
23 | [email protected] | 23 | [email protected] |
24 | [email protected] "b" | 24 | [email protected] "b" |
25 | [email protected] ":" | 25 | [email protected] ":" |
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 97d0fe910..7e2f429e1 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 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "S" | 12 | [email protected] "S" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | RECORD_FIELD_DEF_[email protected] | 14 | [email protected] |
15 | [email protected] "{" | 15 | [email protected] "{" |
16 | [email protected] "}" | 16 | [email protected] "}" |
17 | error 0..0: expected an item | 17 | 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 21c255698..e0f3916b3 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "a" | 13 | [email protected] "a" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -20,7 +20,7 @@ [email protected] | |||
20 | [email protected] "i32" | 20 | [email protected] "i32" |
21 | [email protected] "," | 21 | [email protected] "," |
22 | [email protected] "\n " | 22 | [email protected] "\n " |
23 | RECORD_FIELD_DEF@27..36 | 23 | [email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "b" | 25 | [email protected] "b" |
26 | [email protected] ":" | 26 | [email protected] ":" |
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 2d6364998..ad9447761 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "f" | 13 | [email protected] "f" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] | 35 | [email protected] |
36 | [email protected] "*" | 36 | [email protected] "*" |
37 | [email protected] "\n " | 37 | [email protected] "\n " |
38 | RECORD_FIELD_DEF@48..58 | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "pub" | 40 | [email protected] "pub" |
41 | [email protected] " " | 41 | [email protected] " " |
@@ -50,7 +50,7 @@ [email protected] | |||
50 | [email protected] "u32" | 50 | [email protected] "u32" |
51 | [email protected] "," | 51 | [email protected] "," |
52 | [email protected] "\n " | 52 | [email protected] "\n " |
53 | RECORD_FIELD_DEF@64..70 | 53 | [email protected] |
54 | [email protected] | 54 | [email protected] |
55 | [email protected] "z" | 55 | [email protected] "z" |
56 | [email protected] ":" | 56 | [email protected] ":" |
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 211e5fd46..c3591d25c 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 @@ [email protected] | |||
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "Cache" | 9 | [email protected] "Cache" |
10 | TUPLE_FIELD_DEF_[email protected] | 10 | [email protected] |
11 | [email protected] "(" | 11 | [email protected] "(" |
12 | [email protected] "\n " | 12 | [email protected] "\n " |
13 | TUPLE_FIELD_DEF@22..68 | 13 | [email protected] |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] | 47 | [email protected] |
48 | [email protected] "@" | 48 | [email protected] "@" |
49 | [email protected] " " | 49 | [email protected] " " |
50 | TUPLE_FIELD_DEF@69..72 | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] | 53 | [email protected] |
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 4b9bd679e..a1258028d 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 @@ [email protected] | |||
28 | [email protected] | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "Var2" | 30 | [email protected] "Var2" |
31 | TUPLE_FIELD_DEF_[email protected] | 31 | [email protected] |
32 | [email protected] "(" | 32 | [email protected] "(" |
33 | TUPLE_FIELD_DEF@55..61 | 33 | [email protected] |
34 | [email protected] | 34 | [email protected] |
35 | [email protected] | 35 | [email protected] |
36 | [email protected] | 36 | [email protected] |
@@ -43,10 +43,10 @@ [email protected] | |||
43 | [email protected] | 43 | [email protected] |
44 | [email protected] "Var3" | 44 | [email protected] "Var3" |
45 | [email protected] " " | 45 | [email protected] " " |
46 | RECORD_FIELD_DEF_[email protected] | 46 | [email protected] |
47 | [email protected] "{" | 47 | [email protected] "{" |
48 | [email protected] "\n " | 48 | [email protected] "\n " |
49 | RECORD_FIELD_DEF@91..95 | 49 | [email protected] |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] "abc" | 51 | [email protected] "abc" |
52 | [email protected] ":" | 52 | [email protected] ":" |
@@ -108,10 +108,10 @@ [email protected] | |||
108 | [email protected] | 108 | [email protected] |
109 | [email protected] "StillFine" | 109 | [email protected] "StillFine" |
110 | [email protected] " " | 110 | [email protected] " " |
111 | RECORD_FIELD_DEF_[email protected] | 111 | [email protected] |
112 | [email protected] "{" | 112 | [email protected] "{" |
113 | [email protected] "\n " | 113 | [email protected] "\n " |
114 | RECORD_FIELD_DEF@274..282 | 114 | [email protected] |
115 | [email protected] | 115 | [email protected] |
116 | [email protected] "def" | 116 | [email protected] "def" |
117 | [email protected] ":" | 117 | [email protected] ":" |
@@ -146,9 +146,9 @@ [email protected] | |||
146 | [email protected] | 146 | [email protected] |
147 | [email protected] | 147 | [email protected] |
148 | [email protected] "Nope" | 148 | [email protected] "Nope" |
149 | TUPLE_FIELD_DEF_[email protected] | 149 | [email protected] |
150 | [email protected] "(" | 150 | [email protected] "(" |
151 | TUPLE_FIELD_DEF@368..371 | 151 | [email protected] |
152 | [email protected] | 152 | [email protected] |
153 | [email protected] | 153 | [email protected] |
154 | [email protected] | 154 | [email protected] |
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 0e6e0ccc3..f1d0dc343 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 | |||
86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { | 86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { |
87 | let res = match node.kind() { | 87 | let res = match node.kind() { |
88 | BLOCK => grammar::block, | 88 | BLOCK => grammar::block, |
89 | RECORD_FIELD_DEF_LIST => grammar::record_field_def_list, | 89 | RECORD_FIELD_LIST => grammar::record_field_list, |
90 | _ => return None, | 90 | _ => return None, |
91 | }; | 91 | }; |
92 | Some(res) | 92 | Some(res) |
@@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
138 | let res = match node.kind() { | 138 | let res = match node.kind() { |
139 | ; | 139 | ; |
140 | let end = u32::from(range.end()) as usize; | 140 | let end = u32::from(range.end()) as usize; |
141 | text.replaT => grammar::record_field_def_list, | 141 | text.replaT => grammar::record_field_list, |
142 | _ => return None, | 142 | _ => return None, |
143 | }; | 143 | }; |
144 | Some(res) | 144 | 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 47cbe7c1f..a0ad07807 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 @@ [email protected] | |||
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "S" | 23 | [email protected] "S" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | RECORD_FIELD_DEF_[email protected] | 25 | [email protected] |
26 | [email protected] "{" | 26 | [email protected] "{" |
27 | [email protected] " " | 27 | [email protected] " " |
28 | RECORD_FIELD_DEF@31..47 | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "crate" | 30 | [email protected] "crate" |
31 | [email protected] " " | 31 | [email protected] " " |
@@ -46,9 +46,9 @@ [email protected] | |||
46 | [email protected] " " | 46 | [email protected] " " |
47 | [email protected] | 47 | [email protected] |
48 | [email protected] "T" | 48 | [email protected] "T" |
49 | TUPLE_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "(" | 50 | [email protected] "(" |
51 | TUPLE_FIELD_DEF@59..68 | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] "crate" | 53 | [email protected] "crate" |
54 | [email protected] " " | 54 | [email protected] " " |
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 6362aa02d..775bc2869 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..60 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "#" | 13 | [email protected] "#" |
14 | [email protected] "[" | 14 | [email protected] "[" |
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 ec2496072..2726516b8 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Foo" | 6 | [email protected] "Foo" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "}" | 10 | [email protected] "}" |
11 | [email protected] "\n" | 11 | [email protected] "\n" |
@@ -15,10 +15,10 @@ [email protected] | |||
15 | [email protected] | 15 | [email protected] |
16 | [email protected] "Foo" | 16 | [email protected] "Foo" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | RECORD_FIELD_DEF_[email protected] | 18 | [email protected] |
19 | [email protected] "{" | 19 | [email protected] "{" |
20 | [email protected] "\n " | 20 | [email protected] "\n " |
21 | RECORD_FIELD_DEF@29..35 | 21 | [email protected] |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "a" | 23 | [email protected] "a" |
24 | [email protected] ":" | 24 | [email protected] ":" |
@@ -30,7 +30,7 @@ [email protected] | |||
30 | [email protected] "i32" | 30 | [email protected] "i32" |
31 | [email protected] "," | 31 | [email protected] "," |
32 | [email protected] "\n " | 32 | [email protected] "\n " |
33 | RECORD_FIELD_DEF@41..47 | 33 | [email protected] |
34 | [email protected] | 34 | [email protected] |
35 | [email protected] "b" | 35 | [email protected] "b" |
36 | [email protected] ":" | 36 | [email protected] ":" |
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 217b07e59..0d9a36618 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 @@ [email protected] | |||
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "Foo" | 13 | [email protected] "Foo" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | RECORD_FIELD_DEF_[email protected] | 15 | [email protected] |
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
@@ -21,7 +21,7 @@ [email protected] | |||
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "Foo" | 23 | [email protected] "Foo" |
24 | TUPLE_FIELD_DEF_[email protected] | 24 | [email protected] |
25 | [email protected] "(" | 25 | [email protected] "(" |
26 | [email protected] ")" | 26 | [email protected] ")" |
27 | [email protected] ";" | 27 | [email protected] ";" |
@@ -31,9 +31,9 @@ [email protected] | |||
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "Foo" | 33 | [email protected] "Foo" |
34 | TUPLE_FIELD_DEF_[email protected] | 34 | [email protected] |
35 | [email protected] "(" | 35 | [email protected] "(" |
36 | TUPLE_FIELD_DEF@51..57 | 36 | [email protected] |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] "String" | 41 | [email protected] "String" |
42 | [email protected] "," | 42 | [email protected] "," |
43 | [email protected] " " | 43 | [email protected] " " |
44 | TUPLE_FIELD_DEF@59..64 | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] |
46 | [email protected] | 46 | [email protected] |
47 | [email protected] | 47 | [email protected] |
@@ -56,10 +56,10 @@ [email protected] | |||
56 | [email protected] | 56 | [email protected] |
57 | [email protected] "Foo" | 57 | [email protected] "Foo" |
58 | [email protected] " " | 58 | [email protected] " " |
59 | RECORD_FIELD_DEF_[email protected] | 59 | [email protected] |
60 | [email protected] "{" | 60 | [email protected] "{" |
61 | [email protected] "\n " | 61 | [email protected] "\n " |
62 | RECORD_FIELD_DEF@84..90 | 62 | [email protected] |
63 | [email protected] | 63 | [email protected] |
64 | [email protected] "a" | 64 | [email protected] "a" |
65 | [email protected] ":" | 65 | [email protected] ":" |
@@ -71,7 +71,7 @@ [email protected] | |||
71 | [email protected] "i32" | 71 | [email protected] "i32" |
72 | [email protected] "," | 72 | [email protected] "," |
73 | [email protected] "\n " | 73 | [email protected] "\n " |
74 | RECORD_FIELD_DEF@96..102 | 74 | [email protected] |
75 | [email protected] | 75 | [email protected] |
76 | [email protected] "b" | 76 | [email protected] "b" |
77 | [email protected] ":" | 77 | [email protected] ":" |
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 0b1ec5b27..3c9af3d1f 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 @@ [email protected] | |||
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "T" | 11 | [email protected] "T" |
12 | [email protected] ">" | 12 | [email protected] ">" |
13 | TUPLE_FIELD_DEF_[email protected] | 13 | [email protected] |
14 | [email protected] "(" | 14 | [email protected] "(" |
15 | TUPLE_FIELD_DEF@15..16 | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
@@ -51,9 +51,9 @@ [email protected] | |||
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "T" | 52 | [email protected] "T" |
53 | [email protected] ">" | 53 | [email protected] ">" |
54 | TUPLE_FIELD_DEF_[email protected] | 54 | [email protected] |
55 | [email protected] "(" | 55 | [email protected] "(" |
56 | TUPLE_FIELD_DEF@49..50 | 56 | [email protected] |
57 | [email protected] | 57 | [email protected] |
58 | [email protected] | 58 | [email protected] |
59 | [email protected] | 59 | [email protected] |
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 3c0ef9005..51812a4f2 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | TUPLE_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "(" | 9 | [email protected] "(" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | TUPLE_FIELD_DEF@15..55 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "#" | 13 | [email protected] "#" |
14 | [email protected] "[" | 14 | [email protected] "[" |
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 ceae8a4ec..d92bf84f4 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 @@ [email protected] | |||
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "S" | 54 | [email protected] "S" |
55 | [email protected] " " | 55 | [email protected] " " |
56 | RECORD_FIELD_DEF_[email protected] | 56 | [email protected] |
57 | [email protected] "{" | 57 | [email protected] "{" |
58 | [email protected] "}" | 58 | [email protected] "}" |
59 | [email protected] ";" | 59 | [email protected] ";" |
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 e8a0e9ddd..289fdfd6d 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 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "X" | 13 | [email protected] "X" |
14 | TUPLE_FIELD_DEF_[email protected] | 14 | [email protected] |
15 | [email protected] "(" | 15 | [email protected] "(" |
16 | TUPLE_FIELD_DEF@11..14 | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] | 19 | [email protected] |
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 cf801aedd..c9d1af92f 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 @@ [email protected] | |||
20 | [email protected] "Copy" | 20 | [email protected] "Copy" |
21 | [email protected] ">" | 21 | [email protected] ">" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | RECORD_FIELD_DEF_[email protected] | 23 | [email protected] |
24 | [email protected] "{" | 24 | [email protected] "{" |
25 | [email protected] "\n " | 25 | [email protected] "\n " |
26 | RECORD_FIELD_DEF@24..28 | 26 | [email protected] |
27 | [email protected] | 27 | [email protected] |
28 | [email protected] "f" | 28 | [email protected] "f" |
29 | [email protected] ":" | 29 | [email protected] ":" |
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 a1d546491..57fb7a329 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..23 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "foo" | 13 | [email protected] "foo" |
14 | [email protected] ":" | 14 | [email protected] ":" |
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 ea26f1440..60ded78d5 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 @@ [email protected] | |||
46 | [email protected] | 46 | [email protected] |
47 | [email protected] "S" | 47 | [email protected] "S" |
48 | [email protected] " " | 48 | [email protected] " " |
49 | RECORD_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "{" | 50 | [email protected] "{" |
51 | [email protected] "}" | 51 | [email protected] "}" |
52 | [email protected] "\n" | 52 | [email protected] "\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 95656d19b..00b1b65be 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 @@ [email protected] | |||
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "B" | 13 | [email protected] "B" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | RECORD_FIELD_DEF_[email protected] | 15 | [email protected] |
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
@@ -21,7 +21,7 @@ [email protected] | |||
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "C" | 23 | [email protected] "C" |
24 | TUPLE_FIELD_DEF_[email protected] | 24 | [email protected] |
25 | [email protected] "(" | 25 | [email protected] "(" |
26 | [email protected] ")" | 26 | [email protected] ")" |
27 | [email protected] ";" | 27 | [email protected] ";" |
@@ -32,10 +32,10 @@ [email protected] | |||
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "D" | 33 | [email protected] "D" |
34 | [email protected] " " | 34 | [email protected] " " |
35 | RECORD_FIELD_DEF_[email protected] | 35 | [email protected] |
36 | [email protected] "{" | 36 | [email protected] "{" |
37 | [email protected] "\n " | 37 | [email protected] "\n " |
38 | RECORD_FIELD_DEF@50..56 | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "a" | 40 | [email protected] "a" |
41 | [email protected] ":" | 41 | [email protected] ":" |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] "u32" | 47 | [email protected] "u32" |
48 | [email protected] "," | 48 | [email protected] "," |
49 | [email protected] "\n " | 49 | [email protected] "\n " |
50 | RECORD_FIELD_DEF@62..72 | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "pub" | 52 | [email protected] "pub" |
53 | [email protected] " " | 53 | [email protected] " " |
@@ -68,9 +68,9 @@ [email protected] | |||
68 | [email protected] " " | 68 | [email protected] " " |
69 | [email protected] | 69 | [email protected] |
70 | [email protected] "E" | 70 | [email protected] "E" |
71 | TUPLE_FIELD_DEF_[email protected] | 71 | [email protected] |
72 | [email protected] "(" | 72 | [email protected] "(" |
73 | TUPLE_FIELD_DEF@85..90 | 73 | [email protected] |
74 | [email protected] | 74 | [email protected] |
75 | [email protected] "pub" | 75 | [email protected] "pub" |
76 | [email protected] " " | 76 | [email protected] " " |
@@ -81,7 +81,7 @@ [email protected] | |||
81 | [email protected] "x" | 81 | [email protected] "x" |
82 | [email protected] "," | 82 | [email protected] "," |
83 | [email protected] " " | 83 | [email protected] " " |
84 | TUPLE_FIELD_DEF@92..93 | 84 | [email protected] |
85 | [email protected] | 85 | [email protected] |
86 | [email protected] | 86 | [email protected] |
87 | [email protected] | 87 | [email protected] |
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 3ee208fff..b757bd16d 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 @@ [email protected] | |||
23 | [email protected] | 23 | [email protected] |
24 | [email protected] "T" | 24 | [email protected] "T" |
25 | [email protected] ">" | 25 | [email protected] ">" |
26 | TUPLE_FIELD_DEF_[email protected] | 26 | [email protected] |
27 | [email protected] "(" | 27 | [email protected] "(" |
28 | TUPLE_FIELD_DEF@27..30 | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] | 30 | [email protected] |
31 | [email protected] | 31 | [email protected] |
@@ -46,10 +46,10 @@ [email protected] | |||
46 | [email protected] "T" | 46 | [email protected] "T" |
47 | [email protected] ">" | 47 | [email protected] ">" |
48 | [email protected] " " | 48 | [email protected] " " |
49 | RECORD_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "{" | 50 | [email protected] "{" |
51 | [email protected] " " | 51 | [email protected] " " |
52 | RECORD_FIELD_DEF@48..54 | 52 | [email protected] |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "u" | 54 | [email protected] "u" |
55 | [email protected] ":" | 55 | [email protected] ":" |
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 993f28c4d..1a32d88fd 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 @@ [email protected] | |||
86 | [email protected] | 86 | [email protected] |
87 | [email protected] "C" | 87 | [email protected] "C" |
88 | [email protected] " " | 88 | [email protected] " " |
89 | RECORD_FIELD_DEF_[email protected] | 89 | [email protected] |
90 | [email protected] "{" | 90 | [email protected] "{" |
91 | [email protected] "\n " | 91 | [email protected] "\n " |
92 | RECORD_FIELD_DEF@113..119 | 92 | [email protected] |
93 | [email protected] | 93 | [email protected] |
94 | [email protected] "a" | 94 | [email protected] "a" |
95 | [email protected] ":" | 95 | [email protected] ":" |
@@ -101,7 +101,7 @@ [email protected] | |||
101 | [email protected] "u32" | 101 | [email protected] "u32" |
102 | [email protected] "," | 102 | [email protected] "," |
103 | [email protected] "\n " | 103 | [email protected] "\n " |
104 | RECORD_FIELD_DEF@129..139 | 104 | [email protected] |
105 | [email protected] | 105 | [email protected] |
106 | [email protected] "pub" | 106 | [email protected] "pub" |
107 | [email protected] " " | 107 | [email protected] " " |
@@ -123,7 +123,7 @@ [email protected] | |||
123 | [email protected] | 123 | [email protected] |
124 | [email protected] "F" | 124 | [email protected] "F" |
125 | [email protected] " " | 125 | [email protected] " " |
126 | RECORD_FIELD_DEF_[email protected] | 126 | [email protected] |
127 | [email protected] "{" | 127 | [email protected] "{" |
128 | [email protected] "}" | 128 | [email protected] "}" |
129 | [email protected] "," | 129 | [email protected] "," |
@@ -131,9 +131,9 @@ [email protected] | |||
131 | [email protected] | 131 | [email protected] |
132 | [email protected] | 132 | [email protected] |
133 | [email protected] "D" | 133 | [email protected] "D" |
134 | TUPLE_FIELD_DEF_[email protected] | 134 | [email protected] |
135 | [email protected] "(" | 135 | [email protected] "(" |
136 | TUPLE_FIELD_DEF@164..167 | 136 | [email protected] |
137 | [email protected] | 137 | [email protected] |
138 | [email protected] | 138 | [email protected] |
139 | [email protected] | 139 | [email protected] |
@@ -146,7 +146,7 @@ [email protected] | |||
146 | [email protected] | 146 | [email protected] |
147 | [email protected] | 147 | [email protected] |
148 | [email protected] "E" | 148 | [email protected] "E" |
149 | TUPLE_FIELD_DEF_[email protected] | 149 | [email protected] |
150 | [email protected] "(" | 150 | [email protected] "(" |
151 | [email protected] ")" | 151 | [email protected] ")" |
152 | [email protected] "," | 152 | [email protected] "," |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index ea54651b7..2aa075993 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 @@ [email protected] | |||
1571 | [email protected] "\'union" | 1571 | [email protected] "\'union" |
1572 | [email protected] ">" | 1572 | [email protected] ">" |
1573 | [email protected] " " | 1573 | [email protected] " " |
1574 | RECORD_FIELD_DEF_[email protected] | 1574 | [email protected] |
1575 | [email protected] "{" | 1575 | [email protected] "{" |
1576 | [email protected] " " | 1576 | [email protected] " " |
1577 | RECORD_FIELD_DEF@2873..2901 | 1577 | [email protected] |
1578 | [email protected] | 1578 | [email protected] |
1579 | [email protected] "union" | 1579 | [email protected] "union" |
1580 | [email protected] ":" | 1580 | [email protected] ":" |
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 5640bae0a..0f0138c86 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 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..25 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "r#foo" | 13 | [email protected] "r#foo" |
14 | [email protected] ":" | 14 | [email protected] ":" |
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 1c5545b6d..9c2ea3754 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 @@ [email protected] | |||
7 | [email protected] | 7 | [email protected] |
8 | [email protected] "Repr" | 8 | [email protected] "Repr" |
9 | [email protected] " " | 9 | [email protected] " " |
10 | RECORD_FIELD_DEF_[email protected] | 10 | [email protected] |
11 | [email protected] "{" | 11 | [email protected] "{" |
12 | [email protected] " " | 12 | [email protected] " " |
13 | RECORD_FIELD_DEF@76..88 | 13 | [email protected] |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "raw" | 15 | [email protected] "raw" |
16 | [email protected] ":" | 16 | [email protected] ":" |
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 29a5d48e6..fcf605ec8 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 @@ [email protected] | |||
268 | [email protected] | 268 | [email protected] |
269 | [email protected] | 269 | [email protected] |
270 | [email protected] "B" | 270 | [email protected] "B" |
271 | TUPLE_FIELD_DEF_[email protected] | 271 | [email protected] |
272 | [email protected] "(" | 272 | [email protected] "(" |
273 | TUPLE_FIELD_DEF@358..360 | 273 | [email protected] |
274 | [email protected] | 274 | [email protected] |
275 | [email protected] | 275 | [email protected] |
276 | [email protected] | 276 | [email protected] |
@@ -278,7 +278,7 @@ [email protected] | |||
278 | [email protected] "i8" | 278 | [email protected] "i8" |
279 | [email protected] "," | 279 | [email protected] "," |
280 | [email protected] " " | 280 | [email protected] " " |
281 | TUPLE_FIELD_DEF@362..364 | 281 | [email protected] |
282 | [email protected] | 282 | [email protected] |
283 | [email protected] | 283 | [email protected] |
284 | [email protected] | 284 | [email protected] |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 34a0d039c..f1373fd61 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 { | |||
39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, | 39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, |
40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, | 40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, |
41 | SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, | 41 | SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, |
42 | SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field, | 42 | SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, |
43 | SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, | 43 | SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, |
44 | SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, | 44 | SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, |
45 | SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, | 45 | SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 38709c63e..ad661218f 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -180,10 +180,10 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
180 | "EXTERN_BLOCK", | 180 | "EXTERN_BLOCK", |
181 | "EXTERN_ITEM_LIST", | 181 | "EXTERN_ITEM_LIST", |
182 | "ENUM_VARIANT", | 182 | "ENUM_VARIANT", |
183 | "RECORD_FIELD_DEF_LIST", | 183 | "RECORD_FIELD_LIST", |
184 | "RECORD_FIELD_DEF", | 184 | "RECORD_FIELD", |
185 | "TUPLE_FIELD_DEF_LIST", | 185 | "TUPLE_FIELD_LIST", |
186 | "TUPLE_FIELD_DEF", | 186 | "TUPLE_FIELD", |
187 | "ENUM_VARIANT_LIST", | 187 | "ENUM_VARIANT_LIST", |
188 | "ITEM_LIST", | 188 | "ITEM_LIST", |
189 | "ASSOC_ITEM_LIST", | 189 | "ASSOC_ITEM_LIST", |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 49b2c9ff8..ba922af0d 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -78,30 +78,30 @@ TypeAlias = | |||
78 | 78 | ||
79 | StructDef = | 79 | StructDef = |
80 | Attr* Visibility? 'struct' Name GenericParamList? ( | 80 | Attr* Visibility? 'struct' Name GenericParamList? ( |
81 | WhereClause? (RecordFieldDefList | ';') | 81 | WhereClause? (RecordFieldList | ';') |
82 | | TupleFieldDefList WhereClause? ';' | 82 | | TupleFieldList WhereClause? ';' |
83 | ) | 83 | ) |
84 | 84 | ||
85 | RecordFieldDefList = | 85 | RecordFieldList = |
86 | '{' fields:RecordFieldDef* '}' | 86 | '{' fields:RecordField* '}' |
87 | 87 | ||
88 | RecordFieldDef = | 88 | RecordField = |
89 | Attr* Visibility? Name ':' ascribed_type:TypeRef | 89 | Attr* Visibility? Name ':' ascribed_type:TypeRef |
90 | 90 | ||
91 | TupleFieldDefList = | 91 | TupleFieldList = |
92 | '(' fields:TupleFieldDef* ')' | 92 | '(' fields:TupleField* ')' |
93 | 93 | ||
94 | TupleFieldDef = | 94 | TupleField = |
95 | Attr* Visibility? Name TypeRef | 95 | Attr* Visibility? Name TypeRef |
96 | 96 | ||
97 | FieldDefList = | 97 | FieldList = |
98 | RecordFieldDefList | 98 | RecordFieldList |
99 | | TupleFieldDefList | 99 | | TupleFieldList |
100 | 100 | ||
101 | 101 | ||
102 | UnionDef = | 102 | UnionDef = |
103 | Attr* Visibility? 'union' Name GenericParamList? WhereClause? | 103 | Attr* Visibility? 'union' Name GenericParamList? WhereClause? |
104 | RecordFieldDefList | 104 | RecordFieldList |
105 | 105 | ||
106 | EnumDef = | 106 | EnumDef = |
107 | Attr* Visibility? 'enum' Name GenericParamList? WhereClause? | 107 | Attr* Visibility? 'enum' Name GenericParamList? WhereClause? |
@@ -111,7 +111,7 @@ EnumVariantList = | |||
111 | '{' variants:EnumVariant* '}' | 111 | '{' variants:EnumVariant* '}' |
112 | 112 | ||
113 | EnumVariant = | 113 | EnumVariant = |
114 | Attr* Visibility? Name FieldDefList ('=' Expr)? | 114 | Attr* Visibility? Name FieldList ('=' Expr)? |
115 | 115 | ||
116 | TraitDef = | 116 | TraitDef = |
117 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList | 117 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList |