aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-04 14:48:55 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-04 14:48:55 +0000
commitbbaf750b10810c21d42710a5d12181ca73099525 (patch)
tree39296669d8596c646067641dff27b0c9e71a3a4f /crates
parent11e0851dcfddfe2337bb2d404d716dbd8e4c11d7 (diff)
parent90122542b2708a4dde36758d1ff5848764858ac0 (diff)
Merge #929
929: allow `mut ident` patterns in trait methods r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_parser/src/grammar/params.rs3
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt35
3 files changed, 28 insertions, 12 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs
index a70f067f9..d027578b6 100644
--- a/crates/ra_parser/src/grammar/params.rs
+++ b/crates/ra_parser/src/grammar/params.rs
@@ -83,9 +83,10 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) {
83 83
84 // test trait_fn_placeholder_parameter 84 // test trait_fn_placeholder_parameter
85 // trait Foo { 85 // trait Foo {
86 // fn bar(_: u64); 86 // fn bar(_: u64, mut x: i32);
87 // } 87 // }
88 if (la0 == IDENT || la0 == UNDERSCORE) && la1 == COLON 88 if (la0 == IDENT || la0 == UNDERSCORE) && la1 == COLON
89 || la0 == MUT_KW && la1 == IDENT && la2 == COLON
89 || la0 == AMP && la1 == IDENT && la2 == COLON 90 || la0 == AMP && la1 == IDENT && la2 == COLON
90 || la0 == AMP && la1 == MUT_KW && la2 == IDENT && la3 == COLON 91 || la0 == AMP && la1 == MUT_KW && la2 == IDENT && la3 == COLON
91 { 92 {
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs
index aede3f4fe..472cb8803 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs
@@ -1,3 +1,3 @@
1trait Foo { 1trait Foo {
2 fn bar(_: u64); 2 fn bar(_: u64, mut x: i32);
3} 3}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt
index 248d491df..00217aef1 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt
@@ -1,19 +1,19 @@
1SOURCE_FILE@[0; 34) 1SOURCE_FILE@[0; 46)
2 TRAIT_DEF@[0; 33) 2 TRAIT_DEF@[0; 45)
3 TRAIT_KW@[0; 5) 3 TRAIT_KW@[0; 5)
4 WHITESPACE@[5; 6) 4 WHITESPACE@[5; 6)
5 NAME@[6; 9) 5 NAME@[6; 9)
6 IDENT@[6; 9) "Foo" 6 IDENT@[6; 9) "Foo"
7 WHITESPACE@[9; 10) 7 WHITESPACE@[9; 10)
8 ITEM_LIST@[10; 33) 8 ITEM_LIST@[10; 45)
9 L_CURLY@[10; 11) 9 L_CURLY@[10; 11)
10 WHITESPACE@[11; 16) 10 WHITESPACE@[11; 16)
11 FN_DEF@[16; 31) 11 FN_DEF@[16; 43)
12 FN_KW@[16; 18) 12 FN_KW@[16; 18)
13 WHITESPACE@[18; 19) 13 WHITESPACE@[18; 19)
14 NAME@[19; 22) 14 NAME@[19; 22)
15 IDENT@[19; 22) "bar" 15 IDENT@[19; 22) "bar"
16 PARAM_LIST@[22; 30) 16 PARAM_LIST@[22; 42)
17 L_PAREN@[22; 23) 17 L_PAREN@[22; 23)
18 PARAM@[23; 29) 18 PARAM@[23; 29)
19 PLACEHOLDER_PAT@[23; 24) 19 PLACEHOLDER_PAT@[23; 24)
@@ -25,8 +25,23 @@ SOURCE_FILE@[0; 34)
25 PATH_SEGMENT@[26; 29) 25 PATH_SEGMENT@[26; 29)
26 NAME_REF@[26; 29) 26 NAME_REF@[26; 29)
27 IDENT@[26; 29) "u64" 27 IDENT@[26; 29) "u64"
28 R_PAREN@[29; 30) 28 COMMA@[29; 30)
29 SEMI@[30; 31) 29 WHITESPACE@[30; 31)
30 WHITESPACE@[31; 32) 30 PARAM@[31; 41)
31 R_CURLY@[32; 33) 31 BIND_PAT@[31; 36)
32 WHITESPACE@[33; 34) 32 MUT_KW@[31; 34)
33 WHITESPACE@[34; 35)
34 NAME@[35; 36)
35 IDENT@[35; 36) "x"
36 COLON@[36; 37)
37 WHITESPACE@[37; 38)
38 PATH_TYPE@[38; 41)
39 PATH@[38; 41)
40 PATH_SEGMENT@[38; 41)
41 NAME_REF@[38; 41)
42 IDENT@[38; 41) "i32"
43 R_PAREN@[41; 42)
44 SEMI@[42; 43)
45 WHITESPACE@[43; 44)
46 R_CURLY@[44; 45)
47 WHITESPACE@[45; 46)