aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-31 18:54:16 +0100
committerAleksey Kladov <[email protected]>2020-07-31 19:00:48 +0100
commit14cb96ec0e6be3b99bfe4ea373c058dcbd2a4f79 (patch)
tree730802ad5c2d522bd77eba81984d8e368e852948 /crates
parent572f1c08b6ba43bdd57c5cb99f79a08ecd821c1c (diff)
Allign RecordPat with RecordExpr
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/reorder_fields.rs4
-rw-r--r--crates/ra_hir/src/semantics.rs4
-rw-r--r--crates/ra_hir/src/source_analyzer.rs2
-rw-r--r--crates/ra_hir_def/src/body/lower.rs39
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs2
-rw-r--r--crates/ra_hir_ty/src/diagnostics/expr.rs2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs6
-rw-r--r--crates/ra_ide/src/extend_selection.rs2
-rw-r--r--crates/ra_ide/src/folding_ranges.rs2
-rw-r--r--crates/ra_ide_db/src/defs.rs4
-rw-r--r--crates/ra_parser/src/grammar/patterns.rs4
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs29
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast6
20 files changed, 72 insertions, 78 deletions
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs
index 120250e79..6a19a4002 100644
--- a/crates/ra_assists/src/handlers/reorder_fields.rs
+++ b/crates/ra_assists/src/handlers/reorder_fields.rs
@@ -57,7 +57,7 @@ fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
57fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { 57fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> {
58 match node.kind() { 58 match node.kind() {
59 RECORD_EXPR => vec![RECORD_EXPR_FIELD], 59 RECORD_EXPR => vec![RECORD_EXPR_FIELD],
60 RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], 60 RECORD_PAT => vec![RECORD_PAT_FIELD, BIND_PAT],
61 _ => vec![], 61 _ => vec![],
62 } 62 }
63} 63}
@@ -66,7 +66,7 @@ fn get_field_name(node: &SyntaxNode) -> String {
66 let res = match_ast! { 66 let res = match_ast! {
67 match node { 67 match node {
68 ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()), 68 ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()),
69 ast::RecordFieldPat(field) => field.field_name().map(|it| it.to_string()), 69 ast::RecordPatField(field) => field.field_name().map(|it| it.to_string()),
70 _ => None, 70 _ => None,
71 } 71 }
72 }; 72 };
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 6f3b3dc9a..44c71857e 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -216,7 +216,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
216 self.imp.resolve_record_field(field) 216 self.imp.resolve_record_field(field)
217 } 217 }
218 218
219 pub fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 219 pub fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
220 self.imp.resolve_record_field_pat(field) 220 self.imp.resolve_record_field_pat(field)
221 } 221 }
222 222
@@ -429,7 +429,7 @@ impl<'db> SemanticsImpl<'db> {
429 self.analyze(field.syntax()).resolve_record_field(self.db, field) 429 self.analyze(field.syntax()).resolve_record_field(self.db, field)
430 } 430 }
431 431
432 fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 432 fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field) 433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field)
434 } 434 }
435 435
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index f2e630ef1..37b33cc4f 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -182,7 +182,7 @@ impl SourceAnalyzer {
182 pub(crate) fn resolve_record_field_pat( 182 pub(crate) fn resolve_record_field_pat(
183 &self, 183 &self,
184 _db: &dyn HirDatabase, 184 _db: &dyn HirDatabase,
185 field: &ast::RecordFieldPat, 185 field: &ast::RecordPatField,
186 ) -> Option<Field> { 186 ) -> Option<Field> {
187 let pat_id = self.pat_id(&field.pat()?)?; 187 let pat_id = self.pat_id(&field.pat()?)?;
188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?; 188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?;
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 6bedc6b56..25e29b7cd 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -1,6 +1,8 @@
1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` 1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr`
2//! representation. 2//! representation.
3 3
4use std::{any::type_name, sync::Arc};
5
4use either::Either; 6use either::Either;
5use hir_expand::{ 7use hir_expand::{
6 hygiene::Hygiene, 8 hygiene::Hygiene,
@@ -10,11 +12,12 @@ use hir_expand::{
10use ra_arena::Arena; 12use ra_arena::Arena;
11use ra_syntax::{ 13use ra_syntax::{
12 ast::{ 14 ast::{
13 self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner, 15 self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
14 SlicePatComponents, 16 SlicePatComponents,
15 }, 17 },
16 AstNode, AstPtr, 18 AstNode, AstPtr,
17}; 19};
20use rustc_hash::FxHashMap;
18use test_utils::mark; 21use test_utils::mark;
19 22
20use crate::{ 23use crate::{
@@ -35,9 +38,6 @@ use crate::{
35}; 38};
36 39
37use super::{ExprSource, PatSource}; 40use super::{ExprSource, PatSource};
38use ast::AstChildren;
39use rustc_hash::FxHashMap;
40use std::{any::type_name, sync::Arc};
41 41
42pub(crate) struct LowerCtx { 42pub(crate) struct LowerCtx {
43 hygiene: Hygiene, 43 hygiene: Hygiene,
@@ -786,29 +786,26 @@ impl ExprCollector<'_> {
786 ast::Pat::PlaceholderPat(_) => Pat::Wild, 786 ast::Pat::PlaceholderPat(_) => Pat::Wild,
787 ast::Pat::RecordPat(p) => { 787 ast::Pat::RecordPat(p) => {
788 let path = p.path().and_then(|path| self.expander.parse_path(path)); 788 let path = p.path().and_then(|path| self.expander.parse_path(path));
789 let record_field_pat_list = 789
790 p.record_field_pat_list().expect("every struct should have a field list"); 790 let args: Vec<_> = p
791 let mut fields: Vec<_> = record_field_pat_list 791 .record_pat_field_list()
792 .bind_pats() 792 .expect("every struct should have a field list")
793 .filter_map(|bind_pat| { 793 .fields()
794 let ast_pat = 794 .filter_map(|f| {
795 ast::Pat::cast(bind_pat.syntax().clone()).expect("bind pat is a pat"); 795 let ast_pat = f.pat()?;
796 let pat = self.collect_pat(ast_pat); 796 let pat = self.collect_pat(ast_pat);
797 let name = bind_pat.name()?.as_name(); 797 let name = f.field_name()?.as_name();
798 Some(RecordFieldPat { name, pat }) 798 Some(RecordFieldPat { name, pat })
799 }) 799 })
800 .collect(); 800 .collect();
801 let iter = record_field_pat_list.record_field_pats().filter_map(|f| {
802 let ast_pat = f.pat()?;
803 let pat = self.collect_pat(ast_pat);
804 let name = f.field_name()?.as_name();
805 Some(RecordFieldPat { name, pat })
806 });
807 fields.extend(iter);
808 801
809 let ellipsis = record_field_pat_list.dotdot_token().is_some(); 802 let ellipsis = p
803 .record_pat_field_list()
804 .expect("every struct should have a field list")
805 .dotdot_token()
806 .is_some();
810 807
811 Pat::Record { path, args: fields, ellipsis } 808 Pat::Record { path, args, ellipsis }
812 } 809 }
813 ast::Pat::SlicePat(p) => { 810 ast::Pat::SlicePat(p) => {
814 let SlicePatComponents { prefix, slice, suffix } = p.components(); 811 let SlicePatComponents { prefix, slice, suffix } = p.components();
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index f210c305a..977c0525b 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -92,7 +92,7 @@ impl AstDiagnostic for MissingFields {
92#[derive(Debug)] 92#[derive(Debug)]
93pub struct MissingPatFields { 93pub struct MissingPatFields {
94 pub file: HirFileId, 94 pub file: HirFileId,
95 pub field_list: AstPtr<ast::RecordFieldPatList>, 95 pub field_list: AstPtr<ast::RecordPatFieldList>,
96 pub missed_fields: Vec<Name>, 96 pub missed_fields: Vec<Name>,
97} 97}
98 98
diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/ra_hir_ty/src/diagnostics/expr.rs
index f0e0f2988..95bbf2d95 100644
--- a/crates/ra_hir_ty/src/diagnostics/expr.rs
+++ b/crates/ra_hir_ty/src/diagnostics/expr.rs
@@ -131,7 +131,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
131 if let Some(expr) = source_ptr.value.as_ref().left() { 131 if let Some(expr) = source_ptr.value.as_ref().left() {
132 let root = source_ptr.file_syntax(db.upcast()); 132 let root = source_ptr.file_syntax(db.upcast());
133 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) { 133 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) {
134 if let Some(field_list) = record_pat.record_field_pat_list() { 134 if let Some(field_list) = record_pat.record_pat_field_list() {
135 let variant_data = variant_data(db.upcast(), variant_def); 135 let variant_data = variant_data(db.upcast(), variant_def);
136 let missed_fields = missed_fields 136 let missed_fields = missed_fields
137 .into_iter() 137 .into_iter()
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 2a5f3c3d2..29955754c 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -265,7 +265,7 @@ impl<'a> CompletionContext<'a> {
265 return; 265 return;
266 } 266 }
267 // FIXME: remove this (V) duplication and make the check more precise 267 // FIXME: remove this (V) duplication and make the check more precise
268 if name_ref.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 268 if name_ref.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
269 self.record_pat_syntax = 269 self.record_pat_syntax =
270 self.sema.find_node_at_offset_with_macros(&original_file, offset); 270 self.sema.find_node_at_offset_with_macros(&original_file, offset);
271 } 271 }
@@ -283,7 +283,7 @@ impl<'a> CompletionContext<'a> {
283 { 283 {
284 self.is_pat_binding_or_const = false; 284 self.is_pat_binding_or_const = false;
285 } 285 }
286 if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { 286 if bind_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast).is_some() {
287 self.is_pat_binding_or_const = false; 287 self.is_pat_binding_or_const = false;
288 } 288 }
289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { 289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) {
@@ -300,7 +300,7 @@ impl<'a> CompletionContext<'a> {
300 return; 300 return;
301 } 301 }
302 // FIXME: remove this (^) duplication and make the check more precise 302 // FIXME: remove this (^) duplication and make the check more precise
303 if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 303 if name.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
304 self.record_pat_syntax = 304 self.record_pat_syntax =
305 self.sema.find_node_at_offset_with_macros(&original_file, offset); 305 self.sema.find_node_at_offset_with_macros(&original_file, offset);
306 } 306 }
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index 319fd500d..7230a0ff9 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -37,7 +37,7 @@ fn try_extend_selection(
37 37
38 let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; 38 let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING];
39 let list_kinds = [ 39 let list_kinds = [
40 RECORD_FIELD_PAT_LIST, 40 RECORD_PAT_FIELD_LIST,
41 MATCH_ARM_LIST, 41 MATCH_ARM_LIST,
42 RECORD_FIELD_LIST, 42 RECORD_FIELD_LIST,
43 TUPLE_FIELD_LIST, 43 TUPLE_FIELD_LIST,
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs
index 5a6e17936..903c34996 100644
--- a/crates/ra_ide/src/folding_ranges.rs
+++ b/crates/ra_ide/src/folding_ranges.rs
@@ -86,7 +86,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
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_LIST 88 RECORD_FIELD_LIST
89 | RECORD_FIELD_PAT_LIST 89 | RECORD_PAT_FIELD_LIST
90 | RECORD_EXPR_FIELD_LIST 90 | RECORD_EXPR_FIELD_LIST
91 | ITEM_LIST 91 | ITEM_LIST
92 | EXTERN_ITEM_LIST 92 | EXTERN_ITEM_LIST
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index df56f2d9e..6bf80a34c 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -131,7 +131,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
131 ast::BindPat(it) => { 131 ast::BindPat(it) => {
132 let local = sema.to_def(&it)?; 132 let local = sema.to_def(&it)?;
133 133
134 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordFieldPat::cast) { 134 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordPatField::cast) {
135 if record_field_pat.name_ref().is_none() { 135 if record_field_pat.name_ref().is_none() {
136 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { 136 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
137 let field = Definition::Field(field); 137 let field = Definition::Field(field);
@@ -247,7 +247,7 @@ pub fn classify_name_ref(
247 } 247 }
248 } 248 }
249 249
250 if let Some(record_field_pat) = ast::RecordFieldPat::cast(parent.clone()) { 250 if let Some(record_field_pat) = ast::RecordPatField::cast(parent.clone()) {
251 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { 251 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
252 let field = Definition::Field(field); 252 let field = Definition::Field(field);
253 return Some(NameRefClass::Definition(field)); 253 return Some(NameRefClass::Definition(field));
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs
index 427c0eb49..d5dd9ffa2 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/ra_parser/src/grammar/patterns.rs
@@ -217,7 +217,7 @@ fn record_field_pat_list(p: &mut Parser) {
217 bind_pat(p, false); 217 bind_pat(p, false);
218 } 218 }
219 } 219 }
220 m.complete(p, RECORD_FIELD_PAT); 220 m.complete(p, RECORD_PAT_FIELD);
221 } 221 }
222 } 222 }
223 if !p.at(T!['}']) { 223 if !p.at(T!['}']) {
@@ -225,7 +225,7 @@ fn record_field_pat_list(p: &mut Parser) {
225 } 225 }
226 } 226 }
227 p.expect(T!['}']); 227 p.expect(T!['}']);
228 m.complete(p, RECORD_FIELD_PAT_LIST); 228 m.complete(p, RECORD_PAT_FIELD_LIST);
229} 229}
230 230
231// test placeholder_pat 231// test placeholder_pat
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index c3670fb62..9db328dc3 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -161,8 +161,8 @@ pub enum SyntaxKind {
161 DOT_DOT_PAT, 161 DOT_DOT_PAT,
162 PATH_PAT, 162 PATH_PAT,
163 RECORD_PAT, 163 RECORD_PAT,
164 RECORD_FIELD_PAT_LIST, 164 RECORD_PAT_FIELD_LIST,
165 RECORD_FIELD_PAT, 165 RECORD_PAT_FIELD,
166 TUPLE_STRUCT_PAT, 166 TUPLE_STRUCT_PAT,
167 TUPLE_PAT, 167 TUPLE_PAT,
168 SLICE_PAT, 168 SLICE_PAT,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 66821a31c..7708ae806 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -1192,7 +1192,7 @@ pub struct RecordPat {
1192} 1192}
1193impl RecordPat { 1193impl RecordPat {
1194 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1194 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1195 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { 1195 pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> {
1196 support::child(&self.syntax) 1196 support::child(&self.syntax)
1197 } 1197 }
1198} 1198}
@@ -1234,24 +1234,21 @@ impl TupleStructPat {
1234 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1234 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1235} 1235}
1236#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1236#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1237pub struct RecordFieldPatList { 1237pub struct RecordPatFieldList {
1238 pub(crate) syntax: SyntaxNode, 1238 pub(crate) syntax: SyntaxNode,
1239} 1239}
1240impl RecordFieldPatList { 1240impl RecordPatFieldList {
1241 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 1241 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1242 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { 1242 pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) }
1243 support::children(&self.syntax)
1244 }
1245 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1246 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1243 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1247 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 1244 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1248} 1245}
1249#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1246#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1250pub struct RecordFieldPat { 1247pub struct RecordPatField {
1251 pub(crate) syntax: SyntaxNode, 1248 pub(crate) syntax: SyntaxNode,
1252} 1249}
1253impl ast::AttrsOwner for RecordFieldPat {} 1250impl ast::AttrsOwner for RecordPatField {}
1254impl RecordFieldPat { 1251impl RecordPatField {
1255 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1252 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1256 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 1253 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1257 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1254 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
@@ -2724,8 +2721,8 @@ impl AstNode for TupleStructPat {
2724 } 2721 }
2725 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2722 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2726} 2723}
2727impl AstNode for RecordFieldPatList { 2724impl AstNode for RecordPatFieldList {
2728 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } 2725 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST }
2729 fn cast(syntax: SyntaxNode) -> Option<Self> { 2726 fn cast(syntax: SyntaxNode) -> Option<Self> {
2730 if Self::can_cast(syntax.kind()) { 2727 if Self::can_cast(syntax.kind()) {
2731 Some(Self { syntax }) 2728 Some(Self { syntax })
@@ -2735,8 +2732,8 @@ impl AstNode for RecordFieldPatList {
2735 } 2732 }
2736 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2733 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2737} 2734}
2738impl AstNode for RecordFieldPat { 2735impl AstNode for RecordPatField {
2739 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } 2736 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD }
2740 fn cast(syntax: SyntaxNode) -> Option<Self> { 2737 fn cast(syntax: SyntaxNode) -> Option<Self> {
2741 if Self::can_cast(syntax.kind()) { 2738 if Self::can_cast(syntax.kind()) {
2742 Some(Self { syntax }) 2739 Some(Self { syntax })
@@ -4059,12 +4056,12 @@ impl std::fmt::Display for TupleStructPat {
4059 std::fmt::Display::fmt(self.syntax(), f) 4056 std::fmt::Display::fmt(self.syntax(), f)
4060 } 4057 }
4061} 4058}
4062impl std::fmt::Display for RecordFieldPatList { 4059impl std::fmt::Display for RecordPatFieldList {
4063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4060 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4064 std::fmt::Display::fmt(self.syntax(), f) 4061 std::fmt::Display::fmt(self.syntax(), f)
4065 } 4062 }
4066} 4063}
4067impl std::fmt::Display for RecordFieldPat { 4064impl std::fmt::Display for RecordPatField {
4068 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4065 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4069 std::fmt::Display::fmt(self.syntax(), f) 4066 std::fmt::Display::fmt(self.syntax(), f)
4070 } 4067 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 69726fb93..2cfdac225 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -227,7 +227,7 @@ impl fmt::Display for NameOrNameRef {
227 } 227 }
228} 228}
229 229
230impl ast::RecordFieldPat { 230impl ast::RecordPatField {
231 /// Deals with field init shorthand 231 /// Deals with field init shorthand
232 pub fn field_name(&self) -> Option<NameOrNameRef> { 232 pub fn field_name(&self) -> Option<NameOrNameRef> {
233 if let Some(name_ref) = self.name_ref() { 233 if let Some(name_ref) = self.name_ref() {
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
index 3ce2acfae..d848f3c88 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
@@ -58,7 +58,7 @@ [email protected]
58 [email protected] 58 [email protected]
59 [email protected] "Bar" 59 [email protected] "Bar"
60 [email protected] " " 60 [email protected] " "
61 RECORD_FIELD_PAT_[email protected] 61 RECORD_PAT_[email protected]
62 [email protected] "{" 62 [email protected] "{"
63 [email protected] " " 63 [email protected] " "
64 [email protected] ".." 64 [email protected] ".."
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
index fe1c290c3..003c517ac 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "S" 21 [email protected] "S"
22 [email protected] " " 22 [email protected] " "
23 RECORD_FIELD_PAT_[email protected] 23 RECORD_PAT_[email protected]
24 [email protected] "{" 24 [email protected] "{"
25 [email protected] "}" 25 [email protected] "}"
26 [email protected] " " 26 [email protected] " "
@@ -40,16 +40,16 @@ [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "S" 41 [email protected] "S"
42 [email protected] " " 42 [email protected] " "
43 RECORD_FIELD_PAT_[email protected] 43 RECORD_PAT_[email protected]
44 [email protected] "{" 44 [email protected] "{"
45 [email protected] " " 45 [email protected] " "
46 RECORD_FIELD_PAT@42..43 46 RECORD_PAT_[email protected]
47 [email protected] 47 [email protected]
48 [email protected] 48 [email protected]
49 [email protected] "f" 49 [email protected] "f"
50 [email protected] "," 50 [email protected] ","
51 [email protected] " " 51 [email protected] " "
52 RECORD_FIELD_PAT@45..54 52 RECORD_PAT_[email protected]
53 [email protected] 53 [email protected]
54 [email protected] "ref" 54 [email protected] "ref"
55 [email protected] " " 55 [email protected] " "
@@ -76,10 +76,10 @@ [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "S" 77 [email protected] "S"
78 [email protected] " " 78 [email protected] " "
79 RECORD_FIELD_PAT_[email protected] 79 RECORD_PAT_[email protected]
80 [email protected] "{" 80 [email protected] "{"
81 [email protected] " " 81 [email protected] " "
82 RECORD_FIELD_PAT@75..79 82 RECORD_PAT_[email protected]
83 [email protected] 83 [email protected]
84 [email protected] "h" 84 [email protected] "h"
85 [email protected] ":" 85 [email protected] ":"
@@ -107,10 +107,10 @@ [email protected]
107 [email protected] 107 [email protected]
108 [email protected] "S" 108 [email protected] "S"
109 [email protected] " " 109 [email protected] " "
110 RECORD_FIELD_PAT_[email protected] 110 RECORD_PAT_[email protected]
111 [email protected] "{" 111 [email protected] "{"
112 [email protected] " " 112 [email protected] " "
113 RECORD_FIELD_PAT@103..107 113 RECORD_PAT_[email protected]
114 [email protected] 114 [email protected]
115 [email protected] "h" 115 [email protected] "h"
116 [email protected] ":" 116 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
index 09fd9e9b8..caae3e2dc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
@@ -40,10 +40,10 @@ [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "Outer" 41 [email protected] "Outer"
42 [email protected] " " 42 [email protected] " "
43 RECORD_FIELD_PAT_[email protected] 43 RECORD_PAT_[email protected]
44 [email protected] "{" 44 [email protected] "{"
45 [email protected] " " 45 [email protected] " "
46 RECORD_FIELD_PAT@52..57 46 RECORD_PAT_[email protected]
47 [email protected] 47 [email protected]
48 [email protected] "box" 48 [email protected] "box"
49 [email protected] " " 49 [email protected] " "
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] "i" 52 [email protected] "i"
53 [email protected] "," 53 [email protected] ","
54 [email protected] " " 54 [email protected] " "
55 RECORD_FIELD_PAT@59..79 55 RECORD_PAT_[email protected]
56 [email protected] 56 [email protected]
57 [email protected] "j" 57 [email protected] "j"
58 [email protected] ":" 58 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
index b41ef4098..925409bdf 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
@@ -20,10 +20,10 @@ [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "S" 21 [email protected] "S"
22 [email protected] " " 22 [email protected] " "
23 RECORD_FIELD_PAT_[email protected] 23 RECORD_PAT_[email protected]
24 [email protected] "{" 24 [email protected] "{"
25 [email protected] " " 25 [email protected] " "
26 RECORD_FIELD_PAT@23..27 26 RECORD_PAT_[email protected]
27 [email protected] 27 [email protected]
28 [email protected] "0" 28 [email protected] "0"
29 [email protected] ":" 29 [email protected] ":"
@@ -50,10 +50,10 @@ [email protected]
50 [email protected] 50 [email protected]
51 [email protected] "S" 51 [email protected] "S"
52 [email protected] " " 52 [email protected] " "
53 RECORD_FIELD_PAT_[email protected] 53 RECORD_PAT_[email protected]
54 [email protected] "{" 54 [email protected] "{"
55 [email protected] " " 55 [email protected] " "
56 RECORD_FIELD_PAT@48..52 56 RECORD_PAT_[email protected]
57 [email protected] 57 [email protected]
58 [email protected] "x" 58 [email protected] "x"
59 [email protected] ":" 59 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
index facce8167..7c5467289 100644
--- a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
@@ -64,16 +64,16 @@ [email protected]
64 [email protected] 64 [email protected]
65 [email protected] "S" 65 [email protected] "S"
66 [email protected] " " 66 [email protected] " "
67 RECORD_FIELD_PAT_[email protected] 67 RECORD_PAT_[email protected]
68 [email protected] "{" 68 [email protected] "{"
69 [email protected] " " 69 [email protected] " "
70 RECORD_FIELD_PAT@61..62 70 RECORD_PAT_[email protected]
71 [email protected] 71 [email protected]
72 [email protected] 72 [email protected]
73 [email protected] "a" 73 [email protected] "a"
74 [email protected] "," 74 [email protected] ","
75 [email protected] " " 75 [email protected] " "
76 RECORD_FIELD_PAT@64..65 76 RECORD_PAT_[email protected]
77 [email protected] 77 [email protected]
78 [email protected] 78 [email protected]
79 [email protected] "b" 79 [email protected] "b"
diff --git a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
index 453757c3c..087053f25 100644
--- a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
@@ -67,16 +67,16 @@ [email protected]
67 [email protected] 67 [email protected]
68 [email protected] "S" 68 [email protected] "S"
69 [email protected] " " 69 [email protected] " "
70 RECORD_FIELD_PAT_[email protected] 70 RECORD_PAT_[email protected]
71 [email protected] "{" 71 [email protected] "{"
72 [email protected] " " 72 [email protected] " "
73 RECORD_FIELD_PAT@60..61 73 RECORD_PAT_[email protected]
74 [email protected] 74 [email protected]
75 [email protected] 75 [email protected]
76 [email protected] "a" 76 [email protected] "a"
77 [email protected] "," 77 [email protected] ","
78 [email protected] " " 78 [email protected] " "
79 RECORD_FIELD_PAT@63..64 79 RECORD_PAT_[email protected]
80 [email protected] 80 [email protected]
81 [email protected] 81 [email protected]
82 [email protected] "b" 82 [email protected] "b"