diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-25 10:47:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-25 10:47:44 +0100 |
commit | 866b41ddd86cbe9c3e8d9cb2896477bab060a044 (patch) | |
tree | 2108601228076d62e833b732de52e182b8be4a0b /crates/ra_syntax/test_data/parser/err | |
parent | fdece911fe8e2f3c22760ea22038a6d00cb70dfa (diff) | |
parent | c93903e9c7f64be2edcae0dfe62d8390514658b1 (diff) |
Merge #1733
1733: Parse arbitrarily complex `box` patterns. r=matklad a=ecstatic-morse
This fully resolves the pattern part of #1412 by enabling the parsing of complex `box` patterns such as:
```rust
let box Struct { box i, j: box Inner(box &x) } = todo!();
```
This introduces a new `ast::BoxPat` (in the mold of `ast::RefPat`) that gets translated to `hir::Pat::Missing`.
Co-authored-by: Dylan MacKenzie <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/err')
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rs | 6 | ||||
-rw-r--r-- | crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt | 95 |
2 files changed, 101 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rs b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rs new file mode 100644 index 000000000..d3fa2e468 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn main() { | ||
2 | let ref box i = (); | ||
3 | let mut box i = (); | ||
4 | let ref mut box i = (); | ||
5 | } | ||
6 | |||
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt new file mode 100644 index 000000000..0cdca4b55 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.txt | |||
@@ -0,0 +1,95 @@ | |||
1 | SOURCE_FILE@[0; 91) | ||
2 | FN_DEF@[0; 89) | ||
3 | FN_KW@[0; 2) "fn" | ||
4 | WHITESPACE@[2; 3) " " | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) "(" | ||
9 | R_PAREN@[8; 9) ")" | ||
10 | WHITESPACE@[9; 10) " " | ||
11 | BLOCK@[10; 89) | ||
12 | L_CURLY@[10; 11) "{" | ||
13 | WHITESPACE@[11; 16) "\n " | ||
14 | LET_STMT@[16; 27) | ||
15 | LET_KW@[16; 19) "let" | ||
16 | WHITESPACE@[19; 20) " " | ||
17 | BIND_PAT@[20; 27) | ||
18 | REF_KW@[20; 23) "ref" | ||
19 | WHITESPACE@[23; 24) " " | ||
20 | ERROR@[24; 27) | ||
21 | BOX_KW@[24; 27) "box" | ||
22 | WHITESPACE@[27; 28) " " | ||
23 | EXPR_STMT@[28; 35) | ||
24 | BIN_EXPR@[28; 34) | ||
25 | PATH_EXPR@[28; 29) | ||
26 | PATH@[28; 29) | ||
27 | PATH_SEGMENT@[28; 29) | ||
28 | NAME_REF@[28; 29) | ||
29 | IDENT@[28; 29) "i" | ||
30 | WHITESPACE@[29; 30) " " | ||
31 | EQ@[30; 31) "=" | ||
32 | WHITESPACE@[31; 32) " " | ||
33 | TUPLE_EXPR@[32; 34) | ||
34 | L_PAREN@[32; 33) "(" | ||
35 | R_PAREN@[33; 34) ")" | ||
36 | SEMI@[34; 35) ";" | ||
37 | WHITESPACE@[35; 40) "\n " | ||
38 | LET_STMT@[40; 51) | ||
39 | LET_KW@[40; 43) "let" | ||
40 | WHITESPACE@[43; 44) " " | ||
41 | BIND_PAT@[44; 51) | ||
42 | MUT_KW@[44; 47) "mut" | ||
43 | WHITESPACE@[47; 48) " " | ||
44 | ERROR@[48; 51) | ||
45 | BOX_KW@[48; 51) "box" | ||
46 | WHITESPACE@[51; 52) " " | ||
47 | EXPR_STMT@[52; 59) | ||
48 | BIN_EXPR@[52; 58) | ||
49 | PATH_EXPR@[52; 53) | ||
50 | PATH@[52; 53) | ||
51 | PATH_SEGMENT@[52; 53) | ||
52 | NAME_REF@[52; 53) | ||
53 | IDENT@[52; 53) "i" | ||
54 | WHITESPACE@[53; 54) " " | ||
55 | EQ@[54; 55) "=" | ||
56 | WHITESPACE@[55; 56) " " | ||
57 | TUPLE_EXPR@[56; 58) | ||
58 | L_PAREN@[56; 57) "(" | ||
59 | R_PAREN@[57; 58) ")" | ||
60 | SEMI@[58; 59) ";" | ||
61 | WHITESPACE@[59; 64) "\n " | ||
62 | LET_STMT@[64; 79) | ||
63 | LET_KW@[64; 67) "let" | ||
64 | WHITESPACE@[67; 68) " " | ||
65 | BIND_PAT@[68; 79) | ||
66 | REF_KW@[68; 71) "ref" | ||
67 | WHITESPACE@[71; 72) " " | ||
68 | MUT_KW@[72; 75) "mut" | ||
69 | WHITESPACE@[75; 76) " " | ||
70 | ERROR@[76; 79) | ||
71 | BOX_KW@[76; 79) "box" | ||
72 | WHITESPACE@[79; 80) " " | ||
73 | EXPR_STMT@[80; 87) | ||
74 | BIN_EXPR@[80; 86) | ||
75 | PATH_EXPR@[80; 81) | ||
76 | PATH@[80; 81) | ||
77 | PATH_SEGMENT@[80; 81) | ||
78 | NAME_REF@[80; 81) | ||
79 | IDENT@[80; 81) "i" | ||
80 | WHITESPACE@[81; 82) " " | ||
81 | EQ@[82; 83) "=" | ||
82 | WHITESPACE@[83; 84) " " | ||
83 | TUPLE_EXPR@[84; 86) | ||
84 | L_PAREN@[84; 85) "(" | ||
85 | R_PAREN@[85; 86) ")" | ||
86 | SEMI@[86; 87) ";" | ||
87 | WHITESPACE@[87; 88) "\n" | ||
88 | R_CURLY@[88; 89) "}" | ||
89 | WHITESPACE@[89; 91) "\n\n" | ||
90 | error 24: expected a name | ||
91 | error 27: expected SEMI | ||
92 | error 48: expected a name | ||
93 | error 51: expected SEMI | ||
94 | error 76: expected a name | ||
95 | error 79: expected SEMI | ||