aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/test_data/parser/inline
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-08 14:04:28 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-08 14:04:28 +0100
commit87608904f697a3f58ddb71a7f6828dac80f8b3ce (patch)
tree11907e37146390bd033a9667995a5e8c9d61a9ed /crates/ra_syntax/test_data/parser/inline
parentde4523fae07a2bf0c058d021bd4cfdb53946c4bf (diff)
parent6fa2d8214784b6ecfc3fbcd98778d4e58fa8664e (diff)
Merge #1661
1661: Parse function parameters attributes r=matklad a=eupn Fixes #1397. The [RFC-2565](https://github.com/rust-lang/rfcs/blob/master/text/2565-formal-function-parameter-attributes.md) specifies `#[attributes]` to function parameters: ```rust fn foo(#[attr] a, #[unused] b, #[must_use] ...) { // ... } ``` This PR adds those attributes into grammar and to the parser, extending corresponding inline tests. Co-authored-by: Evgenii P <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.txt23
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.txt32
4 files changed, 57 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs
new file mode 100644
index 000000000..35155057a
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rs
@@ -0,0 +1 @@
fn f(#[must_use] self) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.txt
new file mode 100644
index 000000000..49b14e632
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.txt
@@ -0,0 +1,23 @@
1SOURCE_FILE@[0; 26)
2 FN_DEF@[0; 25)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 4)
6 IDENT@[3; 4) "f"
7 PARAM_LIST@[4; 22)
8 L_PAREN@[4; 5) "("
9 ATTR@[5; 16)
10 POUND@[5; 6) "#"
11 TOKEN_TREE@[6; 16)
12 L_BRACK@[6; 7) "["
13 IDENT@[7; 15) "must_use"
14 R_BRACK@[15; 16) "]"
15 WHITESPACE@[16; 17) " "
16 SELF_PARAM@[17; 21)
17 SELF_KW@[17; 21) "self"
18 R_PAREN@[21; 22) ")"
19 WHITESPACE@[22; 23) " "
20 BLOCK@[23; 25)
21 L_CURLY@[23; 24) "{"
22 R_CURLY@[24; 25) "}"
23 WHITESPACE@[25; 26) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs
new file mode 100644
index 000000000..c238be791
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rs
@@ -0,0 +1 @@
fn f(#[attr1] pat: Type) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.txt
new file mode 100644
index 000000000..91c5e5f9a
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.txt
@@ -0,0 +1,32 @@
1SOURCE_FILE@[0; 28)
2 FN_DEF@[0; 27)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 4)
6 IDENT@[3; 4) "f"
7 PARAM_LIST@[4; 24)
8 L_PAREN@[4; 5) "("
9 ATTR@[5; 13)
10 POUND@[5; 6) "#"
11 TOKEN_TREE@[6; 13)
12 L_BRACK@[6; 7) "["
13 IDENT@[7; 12) "attr1"
14 R_BRACK@[12; 13) "]"
15 WHITESPACE@[13; 14) " "
16 PARAM@[14; 23)
17 BIND_PAT@[14; 17)
18 NAME@[14; 17)
19 IDENT@[14; 17) "pat"
20 COLON@[17; 18) ":"
21 WHITESPACE@[18; 19) " "
22 PATH_TYPE@[19; 23)
23 PATH@[19; 23)
24 PATH_SEGMENT@[19; 23)
25 NAME_REF@[19; 23)
26 IDENT@[19; 23) "Type"
27 R_PAREN@[23; 24) ")"
28 WHITESPACE@[24; 25) " "
29 BLOCK@[25; 27)
30 L_CURLY@[25; 26) "{"
31 R_CURLY@[26; 27) "}"
32 WHITESPACE@[27; 28) "\n"