From d7f75db90d99216c13000681ff2c4a887451c4b2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 20:04:40 +0200 Subject: Reorder --- crates/ra_hir_def/src/body/lower.rs | 1 - crates/ra_syntax/src/ast/generated/nodes.rs | 2 +- xtask/src/codegen/rust.ungram | 34 ++++++++++++++--------------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 25e29b7cd..ef1c0df01 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -786,7 +786,6 @@ impl ExprCollector<'_> { ast::Pat::PlaceholderPat(_) => Pat::Wild, ast::Pat::RecordPat(p) => { let path = p.path().and_then(|path| self.expander.parse_path(path)); - let args: Vec<_> = p .record_pat_field_list() .expect("every struct should have a field list") diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 7708ae806..713aebcfa 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -1128,7 +1128,7 @@ pub struct BoxPat { } impl BoxPat { pub fn box_token(&self) -> Option { support::token(&self.syntax, T![box]) } - pub fn path(&self) -> Option { support::child(&self.syntax) } + pub fn pat(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct DotDotPat { diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 643668863..cb8a307fe 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -516,8 +516,8 @@ Pat = LiteralPat = Literal -PathPat = - Path +BindPat = + Attr* 'ref'? 'mut'? Name ('@' Pat)? PlaceholderPat = '_' @@ -540,29 +540,29 @@ RecordPatFieldList = RecordPatField = Attr* (NameRef ':')? Pat -OrPat = - Pat* +TupleStructPat = + Path '(' args:(Pat (',' Pat)* ','?)? ')' + +TuplePat = + '(' args:(Pat (',' Pat)* ','?)? ')' ParenPat = '(' Pat ')' -BoxPat = - 'box' Path +SlicePat = + '[' args:(Pat (',' Pat)* ','?)? ']' -BindPat = - Attr* 'ref'? 'mut'? Name ('@' Pat)? +PathPat = + Path + +OrPat = + (Pat ('|' Pat)* '|'?) + +BoxPat = + 'box' Pat DotDotPat = '..' -SlicePat = - '[' args:Pat* ']' - MacroPat = MacroCall - -TupleStructPat = - Path '(' args:Pat* ')' - -TuplePat = - '(' args:Pat* ')' -- cgit v1.2.3