diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-10 08:04:49 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-10 08:04:49 +0000 |
commit | a8a4f8012e525c816aedf5b0bc51e3ad4c13a0ab (patch) | |
tree | cd2cd9080114eee7c079b2120e27fb5655cdb947 /crates/ra_syntax/tests/data/parser | |
parent | 8bcb84ea681f982946a24b5e000ddde58247adba (diff) | |
parent | c098a3fda52ef0b02188abfa91adcd67e82c0c02 (diff) |
Merge #773
773: Crash fixes r=matklad a=flodiebold
This fixes a bunch of crashes found while running type inference on the whole rustc repo :sweat_smile:
- avoid infinite recursion with ref bind patterns
- avoid another infinite recursion
- handle literal patterns, add a new LITERAL_PAT syntax node for this
- fix an expect that's wrong on some invalid code
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser')
3 files changed, 37 insertions, 25 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0055_literal_pattern.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0055_literal_pattern.txt index 71d62eaba..51c5ab7f2 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0055_literal_pattern.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0055_literal_pattern.txt | |||
@@ -22,9 +22,10 @@ SOURCE_FILE@[0; 113) | |||
22 | L_CURLY@[25; 26) | 22 | L_CURLY@[25; 26) |
23 | WHITESPACE@[26; 35) | 23 | WHITESPACE@[26; 35) |
24 | MATCH_ARM@[35; 43) | 24 | MATCH_ARM@[35; 43) |
25 | MINUS@[35; 36) | 25 | LITERAL_PAT@[35; 37) |
26 | LITERAL@[36; 37) | 26 | MINUS@[35; 36) |
27 | INT_NUMBER@[36; 37) "1" | 27 | LITERAL@[36; 37) |
28 | INT_NUMBER@[36; 37) "1" | ||
28 | WHITESPACE@[37; 38) | 29 | WHITESPACE@[37; 38) |
29 | FAT_ARROW@[38; 40) | 30 | FAT_ARROW@[38; 40) |
30 | WHITESPACE@[40; 41) | 31 | WHITESPACE@[40; 41) |
@@ -34,8 +35,9 @@ SOURCE_FILE@[0; 113) | |||
34 | COMMA@[43; 44) | 35 | COMMA@[43; 44) |
35 | WHITESPACE@[44; 53) | 36 | WHITESPACE@[44; 53) |
36 | MATCH_ARM@[53; 61) | 37 | MATCH_ARM@[53; 61) |
37 | LITERAL@[53; 55) | 38 | LITERAL_PAT@[53; 55) |
38 | INT_NUMBER@[53; 55) "92" | 39 | LITERAL@[53; 55) |
40 | INT_NUMBER@[53; 55) "92" | ||
39 | WHITESPACE@[55; 56) | 41 | WHITESPACE@[55; 56) |
40 | FAT_ARROW@[56; 58) | 42 | FAT_ARROW@[56; 58) |
41 | WHITESPACE@[58; 59) | 43 | WHITESPACE@[58; 59) |
@@ -45,8 +47,9 @@ SOURCE_FILE@[0; 113) | |||
45 | COMMA@[61; 62) | 47 | COMMA@[61; 62) |
46 | WHITESPACE@[62; 71) | 48 | WHITESPACE@[62; 71) |
47 | MATCH_ARM@[71; 80) | 49 | MATCH_ARM@[71; 80) |
48 | LITERAL@[71; 74) | 50 | LITERAL_PAT@[71; 74) |
49 | CHAR@[71; 74) | 51 | LITERAL@[71; 74) |
52 | CHAR@[71; 74) | ||
50 | WHITESPACE@[74; 75) | 53 | WHITESPACE@[74; 75) |
51 | FAT_ARROW@[75; 77) | 54 | FAT_ARROW@[75; 77) |
52 | WHITESPACE@[77; 78) | 55 | WHITESPACE@[77; 78) |
@@ -56,8 +59,9 @@ SOURCE_FILE@[0; 113) | |||
56 | COMMA@[80; 81) | 59 | COMMA@[80; 81) |
57 | WHITESPACE@[81; 90) | 60 | WHITESPACE@[81; 90) |
58 | MATCH_ARM@[90; 103) | 61 | MATCH_ARM@[90; 103) |
59 | LITERAL@[90; 97) | 62 | LITERAL_PAT@[90; 97) |
60 | STRING@[90; 97) | 63 | LITERAL@[90; 97) |
64 | STRING@[90; 97) | ||
61 | WHITESPACE@[97; 98) | 65 | WHITESPACE@[97; 98) |
62 | FAT_ARROW@[98; 100) | 66 | FAT_ARROW@[98; 100) |
63 | WHITESPACE@[100; 101) | 67 | WHITESPACE@[100; 101) |
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0058_range_pat.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0058_range_pat.txt index d47f38903..de54c49e6 100644 --- a/crates/ra_syntax/tests/data/parser/inline/ok/0058_range_pat.txt +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0058_range_pat.txt | |||
@@ -22,13 +22,15 @@ SOURCE_FILE@[0; 112) | |||
22 | WHITESPACE@[26; 35) | 22 | WHITESPACE@[26; 35) |
23 | MATCH_ARM@[35; 50) | 23 | MATCH_ARM@[35; 50) |
24 | RANGE_PAT@[35; 44) | 24 | RANGE_PAT@[35; 44) |
25 | LITERAL@[35; 36) | 25 | LITERAL_PAT@[35; 36) |
26 | INT_NUMBER@[35; 36) "0" | 26 | LITERAL@[35; 36) |
27 | INT_NUMBER@[35; 36) "0" | ||
27 | WHITESPACE@[36; 37) | 28 | WHITESPACE@[36; 37) |
28 | DOTDOTDOT@[37; 40) | 29 | DOTDOTDOT@[37; 40) |
29 | WHITESPACE@[40; 41) | 30 | WHITESPACE@[40; 41) |
30 | LITERAL@[41; 44) | 31 | LITERAL_PAT@[41; 44) |
31 | INT_NUMBER@[41; 44) "100" | 32 | LITERAL@[41; 44) |
33 | INT_NUMBER@[41; 44) "100" | ||
32 | WHITESPACE@[44; 45) | 34 | WHITESPACE@[44; 45) |
33 | FAT_ARROW@[45; 47) | 35 | FAT_ARROW@[45; 47) |
34 | WHITESPACE@[47; 48) | 36 | WHITESPACE@[47; 48) |
@@ -39,13 +41,15 @@ SOURCE_FILE@[0; 112) | |||
39 | WHITESPACE@[51; 60) | 41 | WHITESPACE@[51; 60) |
40 | MATCH_ARM@[60; 77) | 42 | MATCH_ARM@[60; 77) |
41 | RANGE_PAT@[60; 71) | 43 | RANGE_PAT@[60; 71) |
42 | LITERAL@[60; 63) | 44 | LITERAL_PAT@[60; 63) |
43 | INT_NUMBER@[60; 63) "101" | 45 | LITERAL@[60; 63) |
46 | INT_NUMBER@[60; 63) "101" | ||
44 | WHITESPACE@[63; 64) | 47 | WHITESPACE@[63; 64) |
45 | DOTDOTEQ@[64; 67) | 48 | DOTDOTEQ@[64; 67) |
46 | WHITESPACE@[67; 68) | 49 | WHITESPACE@[67; 68) |
47 | LITERAL@[68; 71) | 50 | LITERAL_PAT@[68; 71) |
48 | INT_NUMBER@[68; 71) "200" | 51 | LITERAL@[68; 71) |
52 | INT_NUMBER@[68; 71) "200" | ||
49 | WHITESPACE@[71; 72) | 53 | WHITESPACE@[71; 72) |
50 | FAT_ARROW@[72; 74) | 54 | FAT_ARROW@[72; 74) |
51 | WHITESPACE@[74; 75) | 55 | WHITESPACE@[74; 75) |
@@ -56,13 +60,15 @@ SOURCE_FILE@[0; 112) | |||
56 | WHITESPACE@[78; 87) | 60 | WHITESPACE@[78; 87) |
57 | MATCH_ARM@[87; 102) | 61 | MATCH_ARM@[87; 102) |
58 | RANGE_PAT@[87; 97) | 62 | RANGE_PAT@[87; 97) |
59 | LITERAL@[87; 90) | 63 | LITERAL_PAT@[87; 90) |
60 | INT_NUMBER@[87; 90) "200" | 64 | LITERAL@[87; 90) |
65 | INT_NUMBER@[87; 90) "200" | ||
61 | WHITESPACE@[90; 91) | 66 | WHITESPACE@[90; 91) |
62 | DOTDOT@[91; 93) | 67 | DOTDOT@[91; 93) |
63 | WHITESPACE@[93; 94) | 68 | WHITESPACE@[93; 94) |
64 | LITERAL@[94; 97) | 69 | LITERAL_PAT@[94; 97) |
65 | INT_NUMBER@[94; 97) "301" | 70 | LITERAL@[94; 97) |
71 | INT_NUMBER@[94; 97) "301" | ||
66 | FAT_ARROW@[97; 99) | 72 | FAT_ARROW@[97; 99) |
67 | WHITESPACE@[99; 100) | 73 | WHITESPACE@[99; 100) |
68 | TUPLE_EXPR@[100; 102) | 74 | TUPLE_EXPR@[100; 102) |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.txt b/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.txt index 20932a837..f3987c3b7 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.txt +++ b/crates/ra_syntax/tests/data/parser/ok/0035_weird_exprs.txt | |||
@@ -456,8 +456,9 @@ SOURCE_FILE@[0; 3813) | |||
456 | L_CURLY@[930; 931) | 456 | L_CURLY@[930; 931) |
457 | WHITESPACE@[931; 952) | 457 | WHITESPACE@[931; 952) |
458 | MATCH_ARM@[952; 1147) | 458 | MATCH_ARM@[952; 1147) |
459 | LITERAL@[952; 953) | 459 | LITERAL_PAT@[952; 953) |
460 | INT_NUMBER@[952; 953) "1" | 460 | LITERAL@[952; 953) |
461 | INT_NUMBER@[952; 953) "1" | ||
461 | WHITESPACE@[953; 954) | 462 | WHITESPACE@[953; 954) |
462 | FAT_ARROW@[954; 956) | 463 | FAT_ARROW@[954; 956) |
463 | WHITESPACE@[956; 957) | 464 | WHITESPACE@[956; 957) |
@@ -1080,8 +1081,9 @@ SOURCE_FILE@[0; 3813) | |||
1080 | L_CURLY@[1853; 1854) | 1081 | L_CURLY@[1853; 1854) |
1081 | WHITESPACE@[1854; 1855) | 1082 | WHITESPACE@[1854; 1855) |
1082 | MATCH_ARM@[1855; 1863) | 1083 | MATCH_ARM@[1855; 1863) |
1083 | LITERAL@[1855; 1856) | 1084 | LITERAL_PAT@[1855; 1856) |
1084 | INT_NUMBER@[1855; 1856) "1" | 1085 | LITERAL@[1855; 1856) |
1086 | INT_NUMBER@[1855; 1856) "1" | ||
1085 | WHITESPACE@[1856; 1857) | 1087 | WHITESPACE@[1856; 1857) |
1086 | FAT_ARROW@[1857; 1859) | 1088 | FAT_ARROW@[1857; 1859) |
1087 | WHITESPACE@[1859; 1860) | 1089 | WHITESPACE@[1859; 1860) |