aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/grammar/items/nominal.rs4
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.rs2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.txt62
3 files changed, 68 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/grammar/items/nominal.rs b/crates/ra_syntax/src/grammar/items/nominal.rs
index 8d02ad555..495462ca7 100644
--- a/crates/ra_syntax/src/grammar/items/nominal.rs
+++ b/crates/ra_syntax/src/grammar/items/nominal.rs
@@ -29,6 +29,10 @@ pub(super) fn struct_def(p: &mut Parser, kind: SyntaxKind) {
29 L_CURLY => named_field_def_list(p), 29 L_CURLY => named_field_def_list(p),
30 L_PAREN if kind == STRUCT_KW => { 30 L_PAREN if kind == STRUCT_KW => {
31 pos_field_list(p); 31 pos_field_list(p);
32 // test tuple_struct_where
33 // struct Test<T>(T) where T: Clone;
34 // struct Test<T>(T);
35 type_params::opt_where_clause(p);
32 p.expect(SEMI); 36 p.expect(SEMI);
33 } 37 }
34 _ if kind == STRUCT_KW => { 38 _ if kind == STRUCT_KW => {
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.rs
new file mode 100644
index 000000000..ddd59016d
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.rs
@@ -0,0 +1,2 @@
1struct Test<T>(T) where T: Clone;
2struct Test<T>(T);
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.txt
new file mode 100644
index 000000000..b7de83072
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0114_tuple_struct_where.txt
@@ -0,0 +1,62 @@
1SOURCE_FILE@[0; 53)
2 STRUCT_DEF@[0; 33)
3 STRUCT_KW@[0; 6)
4 WHITESPACE@[6; 7)
5 NAME@[7; 11)
6 IDENT@[7; 11) "Test"
7 TYPE_PARAM_LIST@[11; 14)
8 L_ANGLE@[11; 12)
9 TYPE_PARAM@[12; 13)
10 NAME@[12; 13)
11 IDENT@[12; 13) "T"
12 R_ANGLE@[13; 14)
13 POS_FIELD_LIST@[14; 17)
14 L_PAREN@[14; 15)
15 POS_FIELD@[15; 16)
16 PATH_TYPE@[15; 16)
17 PATH@[15; 16)
18 PATH_SEGMENT@[15; 16)
19 NAME_REF@[15; 16)
20 IDENT@[15; 16) "T"
21 R_PAREN@[16; 17)
22 WHITESPACE@[17; 18)
23 WHERE_CLAUSE@[18; 32)
24 WHERE_KW@[18; 23)
25 WHITESPACE@[23; 24)
26 WHERE_PRED@[24; 32)
27 PATH_TYPE@[24; 25)
28 PATH@[24; 25)
29 PATH_SEGMENT@[24; 25)
30 NAME_REF@[24; 25)
31 IDENT@[24; 25) "T"
32 COLON@[25; 26)
33 WHITESPACE@[26; 27)
34 PATH_TYPE@[27; 32)
35 PATH@[27; 32)
36 PATH_SEGMENT@[27; 32)
37 NAME_REF@[27; 32)
38 IDENT@[27; 32) "Clone"
39 SEMI@[32; 33)
40 WHITESPACE@[33; 34)
41 STRUCT_DEF@[34; 52)
42 STRUCT_KW@[34; 40)
43 WHITESPACE@[40; 41)
44 NAME@[41; 45)
45 IDENT@[41; 45) "Test"
46 TYPE_PARAM_LIST@[45; 48)
47 L_ANGLE@[45; 46)
48 TYPE_PARAM@[46; 47)
49 NAME@[46; 47)
50 IDENT@[46; 47) "T"
51 R_ANGLE@[47; 48)
52 POS_FIELD_LIST@[48; 51)
53 L_PAREN@[48; 49)
54 POS_FIELD@[49; 50)
55 PATH_TYPE@[49; 50)
56 PATH@[49; 50)
57 PATH_SEGMENT@[49; 50)
58 NAME_REF@[49; 50)
59 IDENT@[49; 50) "T"
60 R_PAREN@[50; 51)
61 SEMI@[51; 52)
62 WHITESPACE@[52; 53)