diff options
Diffstat (limited to 'crates/syntax/test_data/parser/err')
87 files changed, 3862 insertions, 0 deletions
diff --git a/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast new file mode 100644 index 000000000..bbbf496c8 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rast | |||
@@ -0,0 +1,34 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "struct" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "S" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "{" | ||
10 | [email protected] "\n " | ||
11 | [email protected] | ||
12 | [email protected] | ||
13 | [email protected] "a" | ||
14 | [email protected] ":" | ||
15 | [email protected] " " | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "u32" | ||
21 | [email protected] "\n " | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] "b" | ||
25 | [email protected] ":" | ||
26 | [email protected] " " | ||
27 | [email protected] | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] "u32" | ||
32 | [email protected] "\n" | ||
33 | [email protected] "}" | ||
34 | error 21..21: expected COMMA | ||
diff --git a/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs new file mode 100644 index 000000000..fe5030d89 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0000_struct_field_missing_comma.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | struct S { | ||
2 | a: u32 | ||
3 | b: u32 | ||
4 | } \ No newline at end of file | ||
diff --git a/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast new file mode 100644 index 000000000..6dc73bfdb --- /dev/null +++ b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rast | |||
@@ -0,0 +1,18 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "if" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "match" | ||
7 | [email protected] "\n\n" | ||
8 | [email protected] | ||
9 | [email protected] "struct" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "S" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] "{" | ||
16 | [email protected] "}" | ||
17 | error 0..0: expected an item | ||
18 | error 3..3: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs new file mode 100644 index 000000000..98f23de1f --- /dev/null +++ b/crates/syntax/test_data/parser/err/0001_item_recovery_in_file.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | if match | ||
2 | |||
3 | struct S {} \ No newline at end of file | ||
diff --git a/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast new file mode 100644 index 000000000..4cfd1bce4 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rast | |||
@@ -0,0 +1,39 @@ | |||
1 | [email protected] | ||
2 | [email protected] "#!/use/bin/env rusti" | ||
3 | [email protected] "\n" | ||
4 | [email protected] | ||
5 | [email protected] "#" | ||
6 | [email protected] "!" | ||
7 | [email protected] | ||
8 | [email protected] "/" | ||
9 | [email protected] | ||
10 | [email protected] "use" | ||
11 | [email protected] | ||
12 | [email protected] "/" | ||
13 | [email protected] | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "bin" | ||
18 | [email protected] | ||
19 | [email protected] "/" | ||
20 | [email protected] | ||
21 | [email protected] | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] "env" | ||
25 | [email protected] " " | ||
26 | [email protected] | ||
27 | [email protected] "rusti" | ||
28 | [email protected] "\n" | ||
29 | error 23..23: expected `[` | ||
30 | error 23..23: expected an item | ||
31 | error 27..27: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
32 | error 28..28: expected SEMICOLON | ||
33 | error 31..31: expected BANG | ||
34 | error 31..31: expected `{`, `[`, `(` | ||
35 | error 31..31: expected SEMICOLON | ||
36 | error 31..31: expected an item | ||
37 | error 35..35: expected BANG | ||
38 | error 41..41: expected `{`, `[`, `(` | ||
39 | error 41..41: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs new file mode 100644 index 000000000..48a3a3980 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0002_duplicate_shebang.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/use/bin/env rusti | ||
2 | #!/use/bin/env rusti | ||
diff --git a/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast new file mode 100644 index 000000000..7763fad84 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rast | |||
@@ -0,0 +1,39 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "struct" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "S" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "{" | ||
10 | [email protected] "\n " | ||
11 | [email protected] | ||
12 | [email protected] | ||
13 | [email protected] "a" | ||
14 | [email protected] ":" | ||
15 | [email protected] " " | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "i32" | ||
21 | [email protected] "," | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] "b" | ||
26 | [email protected] ":" | ||
27 | [email protected] " " | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] "String" | ||
33 | [email protected] "," | ||
34 | [email protected] "\n" | ||
35 | [email protected] "}" | ||
36 | [email protected] | ||
37 | [email protected] ";" | ||
38 | error 39..39: expected item, found `;` | ||
39 | consider removing this semicolon | ||
diff --git a/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs new file mode 100644 index 000000000..009312270 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0003_C++_semicolon.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | struct S { | ||
2 | a: i32, | ||
3 | b: String, | ||
4 | }; \ No newline at end of file | ||
diff --git a/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast new file mode 100644 index 000000000..9a0f4665e --- /dev/null +++ b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rast | |||
@@ -0,0 +1,15 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] | ||
10 | [email protected] "foo" | ||
11 | [email protected] "::" | ||
12 | [email protected] | ||
13 | [email protected] "92" | ||
14 | [email protected] ";" | ||
15 | error 9..9: expected identifier | ||
diff --git a/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs new file mode 100644 index 000000000..060e65d06 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0004_use_path_bad_segment.rs | |||
@@ -0,0 +1 @@ | |||
use foo::92; \ No newline at end of file | |||
diff --git a/crates/syntax/test_data/parser/err/0005_attribute_recover.rast b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast new file mode 100644 index 000000000..4845a6563 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0005_attribute_recover.rast | |||
@@ -0,0 +1,59 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] | ||
4 | [email protected] "#" | ||
5 | [email protected] "[" | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] "foo" | ||
10 | [email protected] | ||
11 | [email protected] "(" | ||
12 | [email protected] "foo" | ||
13 | [email protected] "," | ||
14 | [email protected] " " | ||
15 | [email protected] "+" | ||
16 | [email protected] "," | ||
17 | [email protected] " " | ||
18 | [email protected] "92" | ||
19 | [email protected] ")" | ||
20 | [email protected] "]" | ||
21 | [email protected] "\n" | ||
22 | [email protected] "fn" | ||
23 | [email protected] " " | ||
24 | [email protected] | ||
25 | [email protected] "foo" | ||
26 | [email protected] | ||
27 | [email protected] "(" | ||
28 | [email protected] ")" | ||
29 | [email protected] " " | ||
30 | [email protected] | ||
31 | [email protected] "{" | ||
32 | [email protected] "\n" | ||
33 | [email protected] "}" | ||
34 | [email protected] "\n\n\n" | ||
35 | [email protected] | ||
36 | [email protected] "#" | ||
37 | [email protected] "[" | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] | ||
41 | [email protected] "foo" | ||
42 | [email protected] | ||
43 | [email protected] "(" | ||
44 | [email protected] "\n" | ||
45 | [email protected] "fn" | ||
46 | [email protected] " " | ||
47 | [email protected] "foo" | ||
48 | [email protected] | ||
49 | [email protected] "(" | ||
50 | [email protected] ")" | ||
51 | [email protected] " " | ||
52 | [email protected] | ||
53 | [email protected] "{" | ||
54 | [email protected] "\n" | ||
55 | [email protected] "}" | ||
56 | [email protected] "\n" | ||
57 | error 53..53: expected R_PAREN | ||
58 | error 53..53: expected `]` | ||
59 | error 53..53: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0005_attribute_recover.rs b/crates/syntax/test_data/parser/err/0005_attribute_recover.rs new file mode 100644 index 000000000..de7f81628 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0005_attribute_recover.rs | |||
@@ -0,0 +1,8 @@ | |||
1 | #[foo(foo, +, 92)] | ||
2 | fn foo() { | ||
3 | } | ||
4 | |||
5 | |||
6 | #[foo( | ||
7 | fn foo() { | ||
8 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast new file mode 100644 index 000000000..5f85c3943 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rast | |||
@@ -0,0 +1,74 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "struct" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "S" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "{" | ||
10 | [email protected] "\n " | ||
11 | [email protected] | ||
12 | [email protected] | ||
13 | [email protected] "f" | ||
14 | [email protected] ":" | ||
15 | [email protected] " " | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "u32" | ||
21 | [email protected] "," | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] "pub" | ||
25 | [email protected] " " | ||
26 | [email protected] | ||
27 | [email protected] "92" | ||
28 | [email protected] "\n " | ||
29 | [email protected] | ||
30 | [email protected] "+" | ||
31 | [email protected] " " | ||
32 | [email protected] | ||
33 | [email protected] "-" | ||
34 | [email protected] " " | ||
35 | [email protected] | ||
36 | [email protected] "*" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] "pub" | ||
41 | [email protected] " " | ||
42 | [email protected] | ||
43 | [email protected] "x" | ||
44 | [email protected] ":" | ||
45 | [email protected] " " | ||
46 | [email protected] | ||
47 | [email protected] | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] "u32" | ||
51 | [email protected] "," | ||
52 | [email protected] "\n " | ||
53 | [email protected] | ||
54 | [email protected] | ||
55 | [email protected] "z" | ||
56 | [email protected] ":" | ||
57 | [email protected] " " | ||
58 | [email protected] | ||
59 | [email protected] | ||
60 | [email protected] | ||
61 | [email protected] | ||
62 | [email protected] "f64" | ||
63 | [email protected] "," | ||
64 | [email protected] "\n" | ||
65 | [email protected] "}" | ||
66 | [email protected] "\n" | ||
67 | error 31..31: expected field declaration | ||
68 | error 33..33: expected COMMA | ||
69 | error 38..38: expected field declaration | ||
70 | error 39..39: expected COMMA | ||
71 | error 40..40: expected field declaration | ||
72 | error 41..41: expected COMMA | ||
73 | error 42..42: expected field declaration | ||
74 | error 43..43: expected COMMA | ||
diff --git a/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs new file mode 100644 index 000000000..8069c111b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0006_named_field_recovery.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | struct S { | ||
2 | f: u32, | ||
3 | pub 92 | ||
4 | + - * | ||
5 | pub x: u32, | ||
6 | z: f64, | ||
7 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast new file mode 100644 index 000000000..560bfd751 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rast | |||
@@ -0,0 +1,32 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "}" | ||
4 | [email protected] "\n\n" | ||
5 | [email protected] | ||
6 | [email protected] "struct" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "S" | ||
10 | [email protected] ";" | ||
11 | [email protected] "\n\n" | ||
12 | [email protected] | ||
13 | [email protected] "}" | ||
14 | [email protected] "\n\n" | ||
15 | [email protected] | ||
16 | [email protected] "fn" | ||
17 | [email protected] " " | ||
18 | [email protected] | ||
19 | [email protected] "foo" | ||
20 | [email protected] | ||
21 | [email protected] "(" | ||
22 | [email protected] ")" | ||
23 | [email protected] | ||
24 | [email protected] "{" | ||
25 | [email protected] "}" | ||
26 | [email protected] "\n\n" | ||
27 | [email protected] | ||
28 | [email protected] "}" | ||
29 | [email protected] "\n" | ||
30 | error 0..0: unmatched `}` | ||
31 | error 14..14: unmatched `}` | ||
32 | error 29..29: unmatched `}` | ||
diff --git a/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs new file mode 100644 index 000000000..dc869fb78 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0007_stray_curly_in_file.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | } | ||
2 | |||
3 | struct S; | ||
4 | |||
5 | } | ||
6 | |||
7 | fn foo(){} | ||
8 | |||
9 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast new file mode 100644 index 000000000..1e9637c26 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rast | |||
@@ -0,0 +1,77 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n" | ||
14 | [email protected] "}" | ||
15 | [email protected] "\n\n" | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "bar" | ||
21 | [email protected] | ||
22 | [email protected] "(" | ||
23 | [email protected] ")" | ||
24 | [email protected] " " | ||
25 | [email protected] | ||
26 | [email protected] "{" | ||
27 | [email protected] "\n " | ||
28 | [email protected] | ||
29 | [email protected] "if" | ||
30 | [email protected] " " | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] "true" | ||
34 | [email protected] " " | ||
35 | [email protected] | ||
36 | [email protected] "{" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] "1" | ||
40 | [email protected] "\n " | ||
41 | [email protected] "}" | ||
42 | [email protected] " " | ||
43 | [email protected] "else" | ||
44 | [email protected] " " | ||
45 | [email protected] | ||
46 | [email protected] "{" | ||
47 | [email protected] "\n " | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] "2" | ||
51 | [email protected] " " | ||
52 | [email protected] "+" | ||
53 | [email protected] " " | ||
54 | [email protected] | ||
55 | [email protected] "3" | ||
56 | [email protected] "\n " | ||
57 | [email protected] "}" | ||
58 | [email protected] "\n" | ||
59 | [email protected] "}" | ||
60 | [email protected] "\n\n" | ||
61 | [email protected] | ||
62 | [email protected] "fn" | ||
63 | [email protected] " " | ||
64 | [email protected] | ||
65 | [email protected] "baz" | ||
66 | [email protected] | ||
67 | [email protected] "(" | ||
68 | [email protected] ")" | ||
69 | [email protected] " " | ||
70 | [email protected] | ||
71 | [email protected] "{" | ||
72 | [email protected] "\n" | ||
73 | [email protected] "}" | ||
74 | [email protected] "\n" | ||
75 | error 17..17: expected BANG | ||
76 | error 19..19: expected SEMICOLON | ||
77 | error 20..20: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs new file mode 100644 index 000000000..9fcac19b5 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0008_item_block_recovery.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | fn foo() { | ||
2 | } | ||
3 | |||
4 | bar() { | ||
5 | if true { | ||
6 | 1 | ||
7 | } else { | ||
8 | 2 + 3 | ||
9 | } | ||
10 | } | ||
11 | |||
12 | fn baz() { | ||
13 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast new file mode 100644 index 000000000..dacf71aa1 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast | |||
@@ -0,0 +1,58 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "struct" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "S" | ||
7 | [email protected] | ||
8 | [email protected] "<" | ||
9 | [email protected] | ||
10 | [email protected] "90" | ||
11 | [email protected] " " | ||
12 | [email protected] | ||
13 | [email protected] "+" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] "2" | ||
17 | [email protected] | ||
18 | [email protected] ">" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "{" | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] "f" | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] ":" | ||
32 | [email protected] " " | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] | ||
36 | [email protected] | ||
37 | [email protected] "u32" | ||
38 | [email protected] "\n" | ||
39 | [email protected] "}" | ||
40 | [email protected] "\n\n" | ||
41 | [email protected] | ||
42 | [email protected] "struct" | ||
43 | [email protected] " " | ||
44 | [email protected] | ||
45 | [email protected] "T" | ||
46 | [email protected] ";" | ||
47 | [email protected] "\n" | ||
48 | error 9..9: expected type parameter | ||
49 | error 11..11: expected COMMA | ||
50 | error 11..11: expected R_ANGLE | ||
51 | error 11..11: expected `;`, `{`, or `(` | ||
52 | error 12..12: expected an item | ||
53 | error 14..14: expected an item | ||
54 | error 15..15: expected an item | ||
55 | error 17..17: expected an item | ||
56 | error 24..24: expected SEMICOLON | ||
57 | error 24..24: expected expression | ||
58 | error 25..25: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs new file mode 100644 index 000000000..0dd30d0bd --- /dev/null +++ b/crates/syntax/test_data/parser/err/0009_broken_struct_type_parameter.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | struct S<90 + 2> { | ||
2 | f: u32 | ||
3 | } | ||
4 | |||
5 | struct T; | ||
diff --git a/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast new file mode 100644 index 000000000..e0f1d0c27 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rast | |||
@@ -0,0 +1,44 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "|" | ||
18 | [email protected] "|" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "->" | ||
22 | [email protected] " " | ||
23 | [email protected] | ||
24 | [email protected] "(" | ||
25 | [email protected] ")" | ||
26 | [email protected] " " | ||
27 | [email protected] | ||
28 | [email protected] | ||
29 | [email protected] "unsafe" | ||
30 | [email protected] " " | ||
31 | [email protected] | ||
32 | [email protected] "{" | ||
33 | [email protected] " " | ||
34 | [email protected] | ||
35 | [email protected] "(" | ||
36 | [email protected] ")" | ||
37 | [email protected] " " | ||
38 | [email protected] "}" | ||
39 | [email protected] ";" | ||
40 | [email protected] "\n" | ||
41 | [email protected] "}" | ||
42 | [email protected] "\n" | ||
43 | error 24..24: expected a block | ||
44 | error 24..24: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs new file mode 100644 index 000000000..985775282 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0010_unsafe_lambda_block.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | || -> () unsafe { () }; | ||
3 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0011_extern_struct.rast b/crates/syntax/test_data/parser/err/0011_extern_struct.rast new file mode 100644 index 000000000..b02d390af --- /dev/null +++ b/crates/syntax/test_data/parser/err/0011_extern_struct.rast | |||
@@ -0,0 +1,13 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] | ||
4 | [email protected] "extern" | ||
5 | [email protected] " " | ||
6 | [email protected] | ||
7 | [email protected] "struct" | ||
8 | [email protected] " " | ||
9 | [email protected] | ||
10 | [email protected] "Foo" | ||
11 | [email protected] ";" | ||
12 | [email protected] "\n" | ||
13 | error 6..6: expected existential, fn, trait or impl | ||
diff --git a/crates/syntax/test_data/parser/err/0011_extern_struct.rs b/crates/syntax/test_data/parser/err/0011_extern_struct.rs new file mode 100644 index 000000000..c1bd0a2d1 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0011_extern_struct.rs | |||
@@ -0,0 +1 @@ | |||
extern struct Foo; | |||
diff --git a/crates/syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/syntax/test_data/parser/err/0012_broken_lambda.rast new file mode 100644 index 000000000..f31c27633 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0012_broken_lambda.rast | |||
@@ -0,0 +1,387 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] | ||
4 | [email protected] | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] | ||
12 | [email protected] "process" | ||
13 | [email protected] | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "'a" | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] | ||
21 | [email protected] "S" | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] "Sink" | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] "'a" | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] | ||
39 | [email protected] "builder" | ||
40 | [email protected] | ||
41 | [email protected] | ||
42 | [email protected] | ||
43 | [email protected] | ||
44 | [email protected] | ||
45 | [email protected] | ||
46 | [email protected] | ||
47 | [email protected] | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] "S" | ||
51 | [email protected] | ||
52 | [email protected] | ||
53 | [email protected] | ||
54 | [email protected] | ||
55 | [email protected] | ||
56 | [email protected] "tokens" | ||
57 | [email protected] | ||
58 | [email protected] | ||
59 | [email protected] | ||
60 | [email protected] | ||
61 | [email protected] | ||
62 | [email protected] | ||
63 | [email protected] | ||
64 | [email protected] | ||
65 | [email protected] | ||
66 | [email protected] | ||
67 | [email protected] "Token" | ||
68 | [email protected] | ||
69 | [email protected] | ||
70 | [email protected] | ||
71 | [email protected] | ||
72 | [email protected] | ||
73 | [email protected] | ||
74 | [email protected] "events" | ||
75 | [email protected] | ||
76 | [email protected] | ||
77 | [email protected] | ||
78 | [email protected] | ||
79 | [email protected] | ||
80 | [email protected] | ||
81 | [email protected] "Vec" | ||
82 | [email protected] | ||
83 | [email protected] | ||
84 | [email protected] | ||
85 | [email protected] | ||
86 | [email protected] | ||
87 | [email protected] | ||
88 | [email protected] | ||
89 | [email protected] "Event" | ||
90 | [email protected] | ||
91 | [email protected] | ||
92 | [email protected] | ||
93 | [email protected] | ||
94 | [email protected] | ||
95 | [email protected] | ||
96 | [email protected] | ||
97 | [email protected] | ||
98 | [email protected] | ||
99 | [email protected] | ||
100 | [email protected] | ||
101 | [email protected] | ||
102 | [email protected] | ||
103 | [email protected] "next_tok_idx" | ||
104 | [email protected] | ||
105 | [email protected] | ||
106 | [email protected] | ||
107 | [email protected] | ||
108 | [email protected] "0" | ||
109 | [email protected] | ||
110 | [email protected] | ||
111 | [email protected] | ||
112 | [email protected] | ||
113 | [email protected] | ||
114 | [email protected] | ||
115 | [email protected] | ||
116 | [email protected] "eat_ws" | ||
117 | [email protected] | ||
118 | [email protected] | ||
119 | [email protected] | ||
120 | [email protected] | ||
121 | [email protected] | ||
122 | [email protected] | ||
123 | [email protected] | ||
124 | [email protected] | ||
125 | [email protected] | ||
126 | [email protected] "idx" | ||
127 | [email protected] | ||
128 | [email protected] | ||
129 | [email protected] | ||
130 | [email protected] | ||
131 | [email protected] | ||
132 | [email protected] | ||
133 | [email protected] | ||
134 | [email protected] | ||
135 | [email protected] | ||
136 | [email protected] | ||
137 | [email protected] "usize" | ||
138 | [email protected] | ||
139 | [email protected] | ||
140 | [email protected] | ||
141 | [email protected] | ||
142 | [email protected] | ||
143 | [email protected] | ||
144 | [email protected] | ||
145 | err: `expected pattern` | ||
146 | [email protected] | ||
147 | [email protected] | ||
148 | err: `expected COMMA` | ||
149 | [email protected] | ||
150 | err: `expected pattern` | ||
151 | [email protected] | ||
152 | [email protected] | ||
153 | [email protected] | ||
154 | err: `expected COMMA` | ||
155 | [email protected] | ||
156 | err: `expected pattern` | ||
157 | [email protected] | ||
158 | [email protected] | ||
159 | [email protected] | ||
160 | err: `expected COMMA` | ||
161 | [email protected] | ||
162 | err: `expected pattern` | ||
163 | [email protected] | ||
164 | [email protected] | ||
165 | [email protected] | ||
166 | err: `expected COMMA` | ||
167 | [email protected] | ||
168 | [email protected] | ||
169 | [email protected] | ||
170 | [email protected] | ||
171 | [email protected] | ||
172 | [email protected] | ||
173 | [email protected] "Some" | ||
174 | [email protected] | ||
175 | [email protected] | ||
176 | [email protected] | ||
177 | [email protected] "token" | ||
178 | [email protected] | ||
179 | err: `expected COMMA` | ||
180 | [email protected] | ||
181 | err: `expected pattern` | ||
182 | [email protected] | ||
183 | [email protected] | ||
184 | [email protected] | ||
185 | err: `expected COMMA` | ||
186 | [email protected] | ||
187 | [email protected] | ||
188 | [email protected] | ||
189 | [email protected] | ||
190 | [email protected] "tokens" | ||
191 | err: `expected COMMA` | ||
192 | err: `expected pattern` | ||
193 | [email protected] | ||
194 | [email protected] | ||
195 | [email protected] | ||
196 | err: `expected COMMA` | ||
197 | [email protected] | ||
198 | [email protected] | ||
199 | [email protected] | ||
200 | [email protected] | ||
201 | [email protected] | ||
202 | [email protected] "get" | ||
203 | [email protected] | ||
204 | err: `expected pattern` | ||
205 | [email protected] | ||
206 | [email protected] | ||
207 | err: `expected COMMA` | ||
208 | [email protected] | ||
209 | [email protected] | ||
210 | [email protected] "idx" | ||
211 | [email protected] | ||
212 | err: `expected COMMA` | ||
213 | [email protected] | ||
214 | err: `expected pattern` | ||
215 | [email protected] | ||
216 | [email protected] | ||
217 | [email protected] | ||
218 | err: `expected COMMA` | ||
219 | [email protected] | ||
220 | err: `expected pattern` | ||
221 | [email protected] | ||
222 | [email protected] | ||
223 | [email protected] | ||
224 | err: `expected COMMA` | ||
225 | [email protected] | ||
226 | err: `expected pattern` | ||
227 | [email protected] | ||
228 | [email protected] | ||
229 | [email protected] | ||
230 | err: `expected COMMA` | ||
231 | [email protected] | ||
232 | [email protected] | ||
233 | [email protected] | ||
234 | [email protected] "token" | ||
235 | err: `expected COMMA` | ||
236 | err: `expected pattern` | ||
237 | [email protected] | ||
238 | [email protected] | ||
239 | [email protected] | ||
240 | err: `expected COMMA` | ||
241 | [email protected] | ||
242 | [email protected] | ||
243 | [email protected] | ||
244 | [email protected] "kind" | ||
245 | err: `expected COMMA` | ||
246 | err: `expected pattern` | ||
247 | [email protected] | ||
248 | [email protected] | ||
249 | [email protected] | ||
250 | err: `expected COMMA` | ||
251 | [email protected] | ||
252 | [email protected] | ||
253 | [email protected] | ||
254 | [email protected] | ||
255 | [email protected] | ||
256 | [email protected] "is_trivia" | ||
257 | [email protected] | ||
258 | [email protected] | ||
259 | err: `expected COMMA` | ||
260 | [email protected] | ||
261 | err: `expected pattern` | ||
262 | [email protected] | ||
263 | [email protected] | ||
264 | [email protected] | ||
265 | err: `expected COMMA` | ||
266 | [email protected] | ||
267 | [email protected] | ||
268 | [email protected] | ||
269 | [email protected] | ||
270 | [email protected] "break" | ||
271 | err: `expected COMMA` | ||
272 | err: `expected pattern` | ||
273 | [email protected] | ||
274 | [email protected] | ||
275 | [email protected] | ||
276 | err: `expected COMMA` | ||
277 | [email protected] | ||
278 | err: `expected pattern` | ||
279 | [email protected] | ||
280 | [email protected] | ||
281 | [email protected] | ||
282 | err: `expected COMMA` | ||
283 | [email protected] | ||
284 | [email protected] | ||
285 | [email protected] | ||
286 | [email protected] | ||
287 | [email protected] "builder" | ||
288 | err: `expected COMMA` | ||
289 | err: `expected pattern` | ||
290 | [email protected] | ||
291 | [email protected] | ||
292 | [email protected] | ||
293 | err: `expected COMMA` | ||
294 | [email protected] | ||
295 | [email protected] | ||
296 | [email protected] | ||
297 | [email protected] | ||
298 | [email protected] | ||
299 | [email protected] "leaf" | ||
300 | [email protected] | ||
301 | [email protected] | ||
302 | [email protected] | ||
303 | [email protected] "token" | ||
304 | err: `expected COMMA` | ||
305 | err: `expected pattern` | ||
306 | [email protected] | ||
307 | [email protected] | ||
308 | err: `expected COMMA` | ||
309 | [email protected] | ||
310 | [email protected] | ||
311 | [email protected] "kind" | ||
312 | [email protected] | ||
313 | [email protected] | ||
314 | [email protected] | ||
315 | [email protected] | ||
316 | [email protected] "token" | ||
317 | err: `expected COMMA` | ||
318 | err: `expected pattern` | ||
319 | [email protected] | ||
320 | [email protected] | ||
321 | err: `expected COMMA` | ||
322 | [email protected] | ||
323 | [email protected] | ||
324 | [email protected] "len" | ||
325 | [email protected] | ||
326 | err: `expected COMMA` | ||
327 | err: `expected pattern` | ||
328 | [email protected] | ||
329 | [email protected] | ||
330 | [email protected] | ||
331 | err: `expected COMMA` | ||
332 | [email protected] | ||
333 | err: `expected pattern` | ||
334 | [email protected] | ||
335 | [email protected] | ||
336 | [email protected] | ||
337 | err: `expected COMMA` | ||
338 | [email protected] | ||
339 | [email protected] | ||
340 | [email protected] | ||
341 | [email protected] "idx" | ||
342 | err: `expected COMMA` | ||
343 | [email protected] | ||
344 | err: `expected pattern` | ||
345 | [email protected] | ||
346 | [email protected] | ||
347 | [email protected] | ||
348 | err: `expected COMMA` | ||
349 | err: `expected pattern` | ||
350 | [email protected] | ||
351 | [email protected] | ||
352 | [email protected] | ||
353 | err: `expected COMMA` | ||
354 | [email protected] | ||
355 | [email protected] | ||
356 | [email protected] | ||
357 | [email protected] "1" | ||
358 | err: `expected COMMA` | ||
359 | [email protected] | ||
360 | err: `expected pattern` | ||
361 | [email protected] | ||
362 | [email protected] | ||
363 | [email protected] | ||
364 | err: `expected COMMA` | ||
365 | [email protected] | ||
366 | err: `expected pattern` | ||
367 | [email protected] | ||
368 | [email protected] | ||
369 | [email protected] | ||
370 | err: `expected COMMA` | ||
371 | err: `expected pattern` | ||
372 | [email protected] | ||
373 | [email protected] | ||
374 | [email protected] | ||
375 | err: `expected COMMA` | ||
376 | [email protected] | ||
377 | err: `expected pattern` | ||
378 | [email protected] | ||
379 | [email protected] | ||
380 | [email protected] | ||
381 | err: `expected COMMA` | ||
382 | err: `expected PIPE` | ||
383 | [email protected] | ||
384 | err: `expected expression` | ||
385 | err: `expected SEMI` | ||
386 | err: `expected R_CURLY` | ||
387 | [email protected] | ||
diff --git a/crates/syntax/test_data/parser/err/0013_invalid_type.rast b/crates/syntax/test_data/parser/err/0013_invalid_type.rast new file mode 100644 index 000000000..f48ab6e71 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0013_invalid_type.rast | |||
@@ -0,0 +1,89 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] | ||
4 | [email protected] "pub" | ||
5 | [email protected] " " | ||
6 | [email protected] "struct" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "Cache" | ||
10 | [email protected] | ||
11 | [email protected] "(" | ||
12 | [email protected] "\n " | ||
13 | [email protected] | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] "RefCell" | ||
19 | [email protected] | ||
20 | [email protected] "<" | ||
21 | [email protected] | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] "HashMap" | ||
27 | [email protected] | ||
28 | [email protected] "<" | ||
29 | [email protected] "\n " | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] "TypeId" | ||
36 | [email protected] "," | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] | ||
41 | [email protected] | ||
42 | [email protected] | ||
43 | [email protected] "Box" | ||
44 | [email protected] | ||
45 | [email protected] "<" | ||
46 | [email protected] | ||
47 | [email protected] | ||
48 | [email protected] "@" | ||
49 | [email protected] " " | ||
50 | [email protected] | ||
51 | [email protected] | ||
52 | [email protected] | ||
53 | [email protected] | ||
54 | [email protected] | ||
55 | [email protected] "Any" | ||
56 | [email protected] | ||
57 | [email protected] | ||
58 | [email protected] ">" | ||
59 | [email protected] | ||
60 | [email protected] "," | ||
61 | [email protected] "\n " | ||
62 | [email protected] | ||
63 | [email protected] ">" | ||
64 | [email protected] | ||
65 | [email protected] ">" | ||
66 | [email protected] "\n" | ||
67 | [email protected] | ||
68 | [email protected] ")" | ||
69 | [email protected] | ||
70 | [email protected] ";" | ||
71 | [email protected] "\n\n" | ||
72 | error 67..67: expected type | ||
73 | error 68..68: expected COMMA | ||
74 | error 68..68: expected R_ANGLE | ||
75 | error 68..68: expected COMMA | ||
76 | error 68..68: expected R_ANGLE | ||
77 | error 68..68: expected COMMA | ||
78 | error 68..68: expected R_ANGLE | ||
79 | error 68..68: expected COMMA | ||
80 | error 72..72: expected COMMA | ||
81 | error 72..72: expected a type | ||
82 | error 72..72: expected R_PAREN | ||
83 | error 72..72: expected SEMICOLON | ||
84 | error 72..72: expected an item | ||
85 | error 73..73: expected an item | ||
86 | error 79..79: expected an item | ||
87 | error 80..80: expected an item | ||
88 | error 82..82: expected an item | ||
89 | error 83..83: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0013_invalid_type.rs b/crates/syntax/test_data/parser/err/0013_invalid_type.rs new file mode 100644 index 000000000..20dde3bc3 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0013_invalid_type.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | pub struct Cache( | ||
2 | RefCell<HashMap< | ||
3 | TypeId, | ||
4 | Box<@ Any>, | ||
5 | >> | ||
6 | ); | ||
7 | |||
diff --git a/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast new file mode 100644 index 000000000..a1f39b22a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rast | |||
@@ -0,0 +1,31 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "<" | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] "T" | ||
12 | [email protected] ">" | ||
13 | [email protected] | ||
14 | [email protected] "(" | ||
15 | [email protected] ")" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "where" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] "T" | ||
26 | [email protected] " " | ||
27 | [email protected] | ||
28 | [email protected] "{" | ||
29 | [email protected] "}" | ||
30 | [email protected] "\n" | ||
31 | error 19..19: expected colon | ||
diff --git a/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs new file mode 100644 index 000000000..75c1d2f98 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0014_where_no_bounds.rs | |||
@@ -0,0 +1 @@ | |||
fn foo<T>() where T {} | |||
diff --git a/crates/syntax/test_data/parser/err/0015_curly_in_params.rast b/crates/syntax/test_data/parser/err/0015_curly_in_params.rast new file mode 100644 index 000000000..a3c25b450 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0015_curly_in_params.rast | |||
@@ -0,0 +1,24 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] | ||
10 | [email protected] "}" | ||
11 | [email protected] | ||
12 | [email protected] ")" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] "{" | ||
16 | [email protected] "\n" | ||
17 | [email protected] "}" | ||
18 | [email protected] "\n" | ||
19 | error 7..7: expected value parameter | ||
20 | error 7..7: expected R_PAREN | ||
21 | error 7..7: expected a block | ||
22 | error 7..7: unmatched `}` | ||
23 | error 8..8: expected an item | ||
24 | error 10..10: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0015_curly_in_params.rs b/crates/syntax/test_data/parser/err/0015_curly_in_params.rs new file mode 100644 index 000000000..156e70251 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0015_curly_in_params.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn foo(}) { | ||
2 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0016_missing_semi.rast b/crates/syntax/test_data/parser/err/0016_missing_semi.rast new file mode 100644 index 000000000..66157c3dc --- /dev/null +++ b/crates/syntax/test_data/parser/err/0016_missing_semi.rast | |||
@@ -0,0 +1,43 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "foo" | ||
21 | [email protected] | ||
22 | [email protected] "(" | ||
23 | [email protected] "\n " | ||
24 | [email protected] | ||
25 | [email protected] "1" | ||
26 | [email protected] "," | ||
27 | [email protected] " " | ||
28 | [email protected] | ||
29 | [email protected] "2" | ||
30 | [email protected] "\n " | ||
31 | [email protected] ")" | ||
32 | [email protected] "\n " | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] "return" | ||
36 | [email protected] " " | ||
37 | [email protected] | ||
38 | [email protected] "92" | ||
39 | [email protected] ";" | ||
40 | [email protected] "\n" | ||
41 | [email protected] "}" | ||
42 | [email protected] "\n" | ||
43 | error 38..38: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0016_missing_semi.rs b/crates/syntax/test_data/parser/err/0016_missing_semi.rs new file mode 100644 index 000000000..9ae857686 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0016_missing_semi.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn foo() { | ||
2 | foo( | ||
3 | 1, 2 | ||
4 | ) | ||
5 | return 92; | ||
6 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast new file mode 100644 index 000000000..fe094f61c --- /dev/null +++ b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rast | |||
@@ -0,0 +1,46 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] | ||
12 | [email protected] "foo" | ||
13 | [email protected] ":" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "i32" | ||
20 | [email protected] ")" | ||
21 | [email protected] " " | ||
22 | [email protected] | ||
23 | [email protected] "{" | ||
24 | [email protected] "\n " | ||
25 | [email protected] | ||
26 | [email protected] "let" | ||
27 | [email protected] " " | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] "bar" | ||
31 | [email protected] " " | ||
32 | [email protected] "=" | ||
33 | [email protected] " " | ||
34 | [email protected] | ||
35 | [email protected] "92" | ||
36 | [email protected] ";" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] "1" | ||
41 | [email protected] " " | ||
42 | [email protected] "+" | ||
43 | [email protected] "\n" | ||
44 | [email protected] "}" | ||
45 | [email protected] "\n" | ||
46 | error 44..44: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs new file mode 100644 index 000000000..17bd49777 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0017_incomplete_binexpr.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn foo(foo: i32) { | ||
2 | let bar = 92; | ||
3 | 1 + | ||
4 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast new file mode 100644 index 000000000..72939fc98 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rast | |||
@@ -0,0 +1,131 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "impl" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] "FnScopes" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "fn" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "new_scope" | ||
19 | [email protected] | ||
20 | [email protected] "(" | ||
21 | [email protected] | ||
22 | [email protected] | ||
23 | [email protected] "&" | ||
24 | [email protected] ")" | ||
25 | [email protected] " " | ||
26 | [email protected] | ||
27 | [email protected] "->" | ||
28 | [email protected] " " | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] "ScopeId" | ||
34 | [email protected] " " | ||
35 | [email protected] | ||
36 | [email protected] "{" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] "let" | ||
40 | [email protected] " " | ||
41 | [email protected] | ||
42 | [email protected] | ||
43 | [email protected] "res" | ||
44 | [email protected] " " | ||
45 | [email protected] "=" | ||
46 | [email protected] " " | ||
47 | [email protected] | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] | ||
52 | [email protected] "self" | ||
53 | [email protected] "." | ||
54 | [email protected] | ||
55 | [email protected] "scopes" | ||
56 | [email protected] "." | ||
57 | [email protected] | ||
58 | [email protected] "len" | ||
59 | [email protected] | ||
60 | [email protected] "(" | ||
61 | [email protected] ")" | ||
62 | [email protected] ";" | ||
63 | [email protected] "\n " | ||
64 | [email protected] | ||
65 | [email protected] | ||
66 | [email protected] | ||
67 | [email protected] | ||
68 | [email protected] | ||
69 | [email protected] "self" | ||
70 | [email protected] "." | ||
71 | [email protected] | ||
72 | [email protected] "scopes" | ||
73 | [email protected] "." | ||
74 | [email protected] | ||
75 | [email protected] "push" | ||
76 | [email protected] | ||
77 | [email protected] "(" | ||
78 | [email protected] | ||
79 | [email protected] | ||
80 | [email protected] | ||
81 | [email protected] | ||
82 | [email protected] "ScopeData" | ||
83 | [email protected] " " | ||
84 | [email protected] | ||
85 | [email protected] "{" | ||
86 | [email protected] " " | ||
87 | [email protected] | ||
88 | [email protected] | ||
89 | [email protected] "parent" | ||
90 | [email protected] ":" | ||
91 | [email protected] " " | ||
92 | [email protected] | ||
93 | [email protected] | ||
94 | [email protected] | ||
95 | [email protected] | ||
96 | [email protected] "None" | ||
97 | [email protected] "," | ||
98 | [email protected] " " | ||
99 | [email protected] | ||
100 | [email protected] | ||
101 | [email protected] "entries" | ||
102 | [email protected] ":" | ||
103 | [email protected] " " | ||
104 | [email protected] | ||
105 | [email protected] | ||
106 | [email protected] | ||
107 | [email protected] | ||
108 | [email protected] "vec" | ||
109 | [email protected] "!" | ||
110 | [email protected] | ||
111 | [email protected] "[" | ||
112 | [email protected] "]" | ||
113 | [email protected] " " | ||
114 | [email protected] "}" | ||
115 | [email protected] ")" | ||
116 | [email protected] "\n " | ||
117 | [email protected] "}" | ||
118 | [email protected] "\n\n " | ||
119 | [email protected] | ||
120 | [email protected] "fn" | ||
121 | [email protected] " " | ||
122 | [email protected] | ||
123 | [email protected] "set_parent" | ||
124 | [email protected] "\n" | ||
125 | [email protected] "}" | ||
126 | [email protected] "\n" | ||
127 | error 34..34: expected pattern | ||
128 | error 34..34: expected COLON | ||
129 | error 34..34: expected type | ||
130 | error 180..180: expected function arguments | ||
131 | error 180..180: expected a block | ||
diff --git a/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs new file mode 100644 index 000000000..fe604006c --- /dev/null +++ b/crates/syntax/test_data/parser/err/0018_incomplete_fn.rs | |||
@@ -0,0 +1,8 @@ | |||
1 | impl FnScopes { | ||
2 | fn new_scope(&) -> ScopeId { | ||
3 | let res = self.scopes.len(); | ||
4 | self.scopes.push(ScopeData { parent: None, entries: vec![] }) | ||
5 | } | ||
6 | |||
7 | fn set_parent | ||
8 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0019_let_recover.rast b/crates/syntax/test_data/parser/err/0019_let_recover.rast new file mode 100644 index 000000000..72c05bd96 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0019_let_recover.rast | |||
@@ -0,0 +1,103 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "let" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "foo" | ||
20 | [email protected] " " | ||
21 | [email protected] "=" | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] "let" | ||
25 | [email protected] " " | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] "bar" | ||
29 | [email protected] " " | ||
30 | [email protected] "=" | ||
31 | [email protected] " " | ||
32 | [email protected] | ||
33 | [email protected] "1" | ||
34 | [email protected] ";" | ||
35 | [email protected] "\n " | ||
36 | [email protected] | ||
37 | [email protected] "let" | ||
38 | [email protected] "\n " | ||
39 | [email protected] | ||
40 | [email protected] "let" | ||
41 | [email protected] " " | ||
42 | [email protected] | ||
43 | [email protected] | ||
44 | [email protected] "baz" | ||
45 | [email protected] " " | ||
46 | [email protected] "=" | ||
47 | [email protected] " " | ||
48 | [email protected] | ||
49 | [email protected] "92" | ||
50 | [email protected] ";" | ||
51 | [email protected] "\n " | ||
52 | [email protected] | ||
53 | [email protected] "let" | ||
54 | [email protected] "\n " | ||
55 | [email protected] | ||
56 | [email protected] | ||
57 | [email protected] "if" | ||
58 | [email protected] " " | ||
59 | [email protected] | ||
60 | [email protected] | ||
61 | [email protected] "true" | ||
62 | [email protected] " " | ||
63 | [email protected] | ||
64 | [email protected] "{" | ||
65 | [email protected] "}" | ||
66 | [email protected] "\n " | ||
67 | [email protected] | ||
68 | [email protected] "let" | ||
69 | [email protected] "\n " | ||
70 | [email protected] | ||
71 | [email protected] | ||
72 | [email protected] "while" | ||
73 | [email protected] " " | ||
74 | [email protected] | ||
75 | [email protected] | ||
76 | [email protected] "true" | ||
77 | [email protected] " " | ||
78 | [email protected] | ||
79 | [email protected] "{" | ||
80 | [email protected] "}" | ||
81 | [email protected] "\n " | ||
82 | [email protected] | ||
83 | [email protected] "let" | ||
84 | [email protected] "\n " | ||
85 | [email protected] | ||
86 | [email protected] "loop" | ||
87 | [email protected] " " | ||
88 | [email protected] | ||
89 | [email protected] "{" | ||
90 | [email protected] "}" | ||
91 | [email protected] "\n" | ||
92 | [email protected] "}" | ||
93 | [email protected] "\n" | ||
94 | error 24..24: expected expression | ||
95 | error 24..24: expected SEMICOLON | ||
96 | error 49..49: expected pattern | ||
97 | error 49..49: expected SEMICOLON | ||
98 | error 75..75: expected pattern | ||
99 | error 75..75: expected SEMICOLON | ||
100 | error 98..98: expected pattern | ||
101 | error 98..98: expected SEMICOLON | ||
102 | error 124..124: expected pattern | ||
103 | error 124..124: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0019_let_recover.rs b/crates/syntax/test_data/parser/err/0019_let_recover.rs new file mode 100644 index 000000000..48bf3d68b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0019_let_recover.rs | |||
@@ -0,0 +1,12 @@ | |||
1 | fn foo() { | ||
2 | let foo = | ||
3 | let bar = 1; | ||
4 | let | ||
5 | let baz = 92; | ||
6 | let | ||
7 | if true {} | ||
8 | let | ||
9 | while true {} | ||
10 | let | ||
11 | loop {} | ||
12 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0020_fn_recover.rast b/crates/syntax/test_data/parser/err/0020_fn_recover.rast new file mode 100644 index 000000000..6f6feba5a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0020_fn_recover.rast | |||
@@ -0,0 +1,20 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] "\n\n" | ||
5 | [email protected] | ||
6 | [email protected] "fn" | ||
7 | [email protected] " " | ||
8 | [email protected] | ||
9 | [email protected] "foo" | ||
10 | [email protected] | ||
11 | [email protected] "(" | ||
12 | [email protected] ")" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] "{" | ||
16 | [email protected] "}" | ||
17 | [email protected] "\n" | ||
18 | error 2..2: expected a name | ||
19 | error 2..2: expected function arguments | ||
20 | error 2..2: expected a block | ||
diff --git a/crates/syntax/test_data/parser/err/0020_fn_recover.rs b/crates/syntax/test_data/parser/err/0020_fn_recover.rs new file mode 100644 index 000000000..3393b668b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0020_fn_recover.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn | ||
2 | |||
3 | fn foo() {} | ||
diff --git a/crates/syntax/test_data/parser/err/0021_incomplete_param.rast b/crates/syntax/test_data/parser/err/0021_incomplete_param.rast new file mode 100644 index 000000000..b32845537 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0021_incomplete_param.rast | |||
@@ -0,0 +1,34 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] | ||
12 | [email protected] "x" | ||
13 | [email protected] ":" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "i32" | ||
20 | [email protected] "," | ||
21 | [email protected] " " | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] "y" | ||
26 | [email protected] ")" | ||
27 | [email protected] " " | ||
28 | [email protected] | ||
29 | [email protected] "{" | ||
30 | [email protected] "\n" | ||
31 | [email protected] "}" | ||
32 | [email protected] "\n" | ||
33 | error 16..16: expected COLON | ||
34 | error 16..16: expected type | ||
diff --git a/crates/syntax/test_data/parser/err/0021_incomplete_param.rs b/crates/syntax/test_data/parser/err/0021_incomplete_param.rs new file mode 100644 index 000000000..7a6c264f6 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0021_incomplete_param.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | fn foo(x: i32, y) { | ||
2 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/syntax/test_data/parser/err/0022_bad_exprs.rast new file mode 100644 index 000000000..71fb19783 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0022_bad_exprs.rast | |||
@@ -0,0 +1,180 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "a" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "[" | ||
17 | [email protected] | ||
18 | [email protected] "1" | ||
19 | [email protected] "," | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "2" | ||
23 | [email protected] "," | ||
24 | [email protected] " " | ||
25 | [email protected] | ||
26 | [email protected] "@" | ||
27 | [email protected] | ||
28 | [email protected] | ||
29 | [email protected] "," | ||
30 | [email protected] " " | ||
31 | [email protected] | ||
32 | [email protected] "struct" | ||
33 | [email protected] | ||
34 | [email protected] "," | ||
35 | [email protected] " " | ||
36 | [email protected] | ||
37 | [email protected] "let" | ||
38 | [email protected] | ||
39 | [email protected] "]" | ||
40 | [email protected] " " | ||
41 | [email protected] "}" | ||
42 | [email protected] "\n" | ||
43 | [email protected] | ||
44 | [email protected] "fn" | ||
45 | [email protected] " " | ||
46 | [email protected] | ||
47 | [email protected] "b" | ||
48 | [email protected] | ||
49 | [email protected] "(" | ||
50 | [email protected] ")" | ||
51 | [email protected] " " | ||
52 | [email protected] | ||
53 | [email protected] "{" | ||
54 | [email protected] " " | ||
55 | [email protected] | ||
56 | [email protected] | ||
57 | [email protected] | ||
58 | [email protected] | ||
59 | [email protected] | ||
60 | [email protected] | ||
61 | [email protected] "foo" | ||
62 | [email protected] | ||
63 | [email protected] "(" | ||
64 | [email protected] | ||
65 | [email protected] "1" | ||
66 | [email protected] "," | ||
67 | [email protected] " " | ||
68 | [email protected] | ||
69 | [email protected] "2" | ||
70 | [email protected] "," | ||
71 | [email protected] " " | ||
72 | [email protected] | ||
73 | [email protected] "@" | ||
74 | [email protected] | ||
75 | [email protected] | ||
76 | [email protected] "," | ||
77 | [email protected] " " | ||
78 | [email protected] | ||
79 | [email protected] "impl" | ||
80 | [email protected] | ||
81 | [email protected] | ||
82 | [email protected] "," | ||
83 | [email protected] " " | ||
84 | [email protected] | ||
85 | [email protected] "let" | ||
86 | [email protected] | ||
87 | [email protected] ")" | ||
88 | [email protected] " " | ||
89 | [email protected] "}" | ||
90 | [email protected] "\n" | ||
91 | [email protected] | ||
92 | [email protected] "fn" | ||
93 | [email protected] " " | ||
94 | [email protected] | ||
95 | [email protected] "c" | ||
96 | [email protected] | ||
97 | [email protected] "(" | ||
98 | [email protected] ")" | ||
99 | [email protected] " " | ||
100 | [email protected] | ||
101 | [email protected] "{" | ||
102 | [email protected] " " | ||
103 | [email protected] | ||
104 | [email protected] | ||
105 | [email protected] | ||
106 | [email protected] | ||
107 | [email protected] | ||
108 | [email protected] | ||
109 | [email protected] "foo" | ||
110 | [email protected] "." | ||
111 | [email protected] | ||
112 | [email protected] "bar" | ||
113 | [email protected] | ||
114 | [email protected] "(" | ||
115 | [email protected] | ||
116 | [email protected] "1" | ||
117 | [email protected] "," | ||
118 | [email protected] " " | ||
119 | [email protected] | ||
120 | [email protected] "2" | ||
121 | [email protected] "," | ||
122 | [email protected] " " | ||
123 | [email protected] | ||
124 | [email protected] "@" | ||
125 | [email protected] | ||
126 | [email protected] | ||
127 | [email protected] "," | ||
128 | [email protected] " " | ||
129 | [email protected] | ||
130 | [email protected] | ||
131 | [email protected] "]" | ||
132 | [email protected] | ||
133 | [email protected] | ||
134 | [email protected] "," | ||
135 | [email protected] " " | ||
136 | [email protected] | ||
137 | [email protected] "trait" | ||
138 | [email protected] | ||
139 | [email protected] "," | ||
140 | [email protected] " " | ||
141 | [email protected] | ||
142 | [email protected] "let" | ||
143 | [email protected] | ||
144 | [email protected] ")" | ||
145 | [email protected] " " | ||
146 | [email protected] "}" | ||
147 | [email protected] "\n" | ||
148 | error 16..16: expected expression | ||
149 | error 17..17: expected R_BRACK | ||
150 | error 17..17: expected SEMICOLON | ||
151 | error 17..17: expected expression | ||
152 | error 18..18: expected SEMICOLON | ||
153 | error 25..25: expected a name | ||
154 | error 26..26: expected `;`, `{`, or `(` | ||
155 | error 30..30: expected pattern | ||
156 | error 31..31: expected SEMICOLON | ||
157 | error 53..53: expected expression | ||
158 | error 54..54: expected SEMICOLON | ||
159 | error 54..54: expected expression | ||
160 | error 55..55: expected SEMICOLON | ||
161 | error 60..60: expected type | ||
162 | error 60..60: expected `{` | ||
163 | error 60..60: expected expression | ||
164 | error 61..61: expected SEMICOLON | ||
165 | error 65..65: expected pattern | ||
166 | error 65..65: expected SEMICOLON | ||
167 | error 65..65: expected expression | ||
168 | error 92..92: expected expression | ||
169 | error 93..93: expected SEMICOLON | ||
170 | error 93..93: expected expression | ||
171 | error 94..94: expected SEMICOLON | ||
172 | error 95..95: expected expression | ||
173 | error 96..96: expected SEMICOLON | ||
174 | error 96..96: expected expression | ||
175 | error 97..97: expected SEMICOLON | ||
176 | error 103..103: expected a name | ||
177 | error 104..104: expected `{` | ||
178 | error 108..108: expected pattern | ||
179 | error 108..108: expected SEMICOLON | ||
180 | error 108..108: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0022_bad_exprs.rs b/crates/syntax/test_data/parser/err/0022_bad_exprs.rs new file mode 100644 index 000000000..cd2d493a1 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0022_bad_exprs.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn a() { [1, 2, @, struct, let] } | ||
2 | fn b() { foo(1, 2, @, impl, let) } | ||
3 | fn c() { foo.bar(1, 2, @, ], trait, let) } | ||
diff --git a/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast new file mode 100644 index 000000000..5ffefd742 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rast | |||
@@ -0,0 +1,43 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] "foo" | ||
19 | [email protected] "!" | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "(" | ||
23 | [email protected] "\n " | ||
24 | [email protected] "bar" | ||
25 | [email protected] "," | ||
26 | [email protected] " " | ||
27 | [email protected] "\"baz\"" | ||
28 | [email protected] "," | ||
29 | [email protected] " " | ||
30 | [email protected] "1" | ||
31 | [email protected] "," | ||
32 | [email protected] " " | ||
33 | [email protected] "2.0" | ||
34 | [email protected] "\n " | ||
35 | [email protected] "}" | ||
36 | [email protected] " " | ||
37 | [email protected] "//~ ERROR incorrect c ..." | ||
38 | [email protected] "\n" | ||
39 | [email protected] | ||
40 | [email protected] "}" | ||
41 | [email protected] "\n" | ||
42 | error 49..49: unmatched `}` | ||
43 | error 92..92: unmatched `}` | ||
diff --git a/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs new file mode 100644 index 000000000..0206d563e --- /dev/null +++ b/crates/syntax/test_data/parser/err/0023_mismatched_paren.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn main() { | ||
2 | foo! ( | ||
3 | bar, "baz", 1, 2.0 | ||
4 | } //~ ERROR incorrect close delimiter | ||
5 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast new file mode 100644 index 000000000..e3be6b22e --- /dev/null +++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast | |||
@@ -0,0 +1,319 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "f" | ||
7 | [email protected] | ||
8 | [email protected] "<" | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] "T" | ||
12 | [email protected] ":" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "(" | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] | ||
21 | [email protected] "Copy" | ||
22 | [email protected] ")" | ||
23 | [email protected] " " | ||
24 | [email protected] "+" | ||
25 | [email protected] " " | ||
26 | [email protected] | ||
27 | [email protected] "(" | ||
28 | [email protected] "?" | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] "Sized" | ||
34 | [email protected] ")" | ||
35 | [email protected] " " | ||
36 | [email protected] "+" | ||
37 | [email protected] " " | ||
38 | [email protected] | ||
39 | [email protected] "(" | ||
40 | [email protected] | ||
41 | [email protected] "for" | ||
42 | [email protected] | ||
43 | [email protected] "<" | ||
44 | [email protected] | ||
45 | [email protected] "\'a" | ||
46 | [email protected] ">" | ||
47 | [email protected] " " | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] | ||
52 | [email protected] "Trait" | ||
53 | [email protected] | ||
54 | [email protected] "<" | ||
55 | [email protected] | ||
56 | [email protected] "\'a" | ||
57 | [email protected] ">" | ||
58 | [email protected] ")" | ||
59 | [email protected] ">" | ||
60 | [email protected] | ||
61 | [email protected] "(" | ||
62 | [email protected] ")" | ||
63 | [email protected] " " | ||
64 | [email protected] | ||
65 | [email protected] "{" | ||
66 | [email protected] "}" | ||
67 | [email protected] "\n\n" | ||
68 | [email protected] | ||
69 | [email protected] "fn" | ||
70 | [email protected] " " | ||
71 | [email protected] | ||
72 | [email protected] "main" | ||
73 | [email protected] | ||
74 | [email protected] "(" | ||
75 | [email protected] ")" | ||
76 | [email protected] " " | ||
77 | [email protected] | ||
78 | [email protected] "{" | ||
79 | [email protected] "\n " | ||
80 | [email protected] | ||
81 | [email protected] "let" | ||
82 | [email protected] " " | ||
83 | [email protected] | ||
84 | [email protected] "_" | ||
85 | [email protected] ":" | ||
86 | [email protected] " " | ||
87 | [email protected] | ||
88 | [email protected] | ||
89 | [email protected] | ||
90 | [email protected] | ||
91 | [email protected] | ||
92 | [email protected] | ||
93 | [email protected] | ||
94 | [email protected] "Box" | ||
95 | [email protected] | ||
96 | [email protected] "<" | ||
97 | [email protected] | ||
98 | [email protected] | ||
99 | [email protected] "(" | ||
100 | [email protected] | ||
101 | [email protected] | ||
102 | [email protected] | ||
103 | [email protected] | ||
104 | [email protected] "Copy" | ||
105 | [email protected] ")" | ||
106 | [email protected] " " | ||
107 | [email protected] "+" | ||
108 | [email protected] " " | ||
109 | [email protected] | ||
110 | [email protected] "(" | ||
111 | [email protected] "?" | ||
112 | [email protected] | ||
113 | [email protected] | ||
114 | [email protected] | ||
115 | [email protected] | ||
116 | [email protected] "Sized" | ||
117 | [email protected] ")" | ||
118 | [email protected] " " | ||
119 | [email protected] "+" | ||
120 | [email protected] " " | ||
121 | [email protected] | ||
122 | [email protected] "(" | ||
123 | [email protected] | ||
124 | [email protected] "for" | ||
125 | [email protected] | ||
126 | [email protected] "<" | ||
127 | [email protected] | ||
128 | [email protected] "\'a" | ||
129 | [email protected] ">" | ||
130 | [email protected] " " | ||
131 | [email protected] | ||
132 | [email protected] | ||
133 | [email protected] | ||
134 | [email protected] | ||
135 | [email protected] "Trait" | ||
136 | [email protected] | ||
137 | [email protected] "<" | ||
138 | [email protected] | ||
139 | [email protected] "\'a" | ||
140 | [email protected] ">" | ||
141 | [email protected] ")" | ||
142 | [email protected] | ||
143 | [email protected] | ||
144 | [email protected] ">" | ||
145 | [email protected] ";" | ||
146 | [email protected] "\n " | ||
147 | [email protected] | ||
148 | [email protected] "let" | ||
149 | [email protected] " " | ||
150 | [email protected] | ||
151 | [email protected] "_" | ||
152 | [email protected] ":" | ||
153 | [email protected] " " | ||
154 | [email protected] | ||
155 | [email protected] | ||
156 | [email protected] | ||
157 | [email protected] | ||
158 | [email protected] "Box" | ||
159 | [email protected] | ||
160 | [email protected] "<" | ||
161 | [email protected] | ||
162 | [email protected] | ||
163 | [email protected] "(" | ||
164 | [email protected] | ||
165 | [email protected] "?" | ||
166 | [email protected] | ||
167 | [email protected] | ||
168 | [email protected] | ||
169 | [email protected] | ||
170 | [email protected] | ||
171 | [email protected] "Sized" | ||
172 | [email protected] | ||
173 | [email protected] | ||
174 | [email protected] ")" | ||
175 | [email protected] " " | ||
176 | [email protected] | ||
177 | [email protected] | ||
178 | [email protected] "+" | ||
179 | [email protected] " " | ||
180 | [email protected] | ||
181 | [email protected] | ||
182 | [email protected] "(" | ||
183 | [email protected] | ||
184 | [email protected] "for" | ||
185 | [email protected] | ||
186 | [email protected] | ||
187 | [email protected] | ||
188 | [email protected] "<" | ||
189 | [email protected] | ||
190 | [email protected] "\'a" | ||
191 | [email protected] ">" | ||
192 | [email protected] " " | ||
193 | [email protected] | ||
194 | [email protected] | ||
195 | [email protected] | ||
196 | [email protected] | ||
197 | [email protected] | ||
198 | [email protected] | ||
199 | [email protected] | ||
200 | [email protected] | ||
201 | [email protected] "Trait" | ||
202 | [email protected] "<" | ||
203 | [email protected] | ||
204 | [email protected] "\'a" | ||
205 | [email protected] ">" | ||
206 | [email protected] | ||
207 | [email protected] ")" | ||
208 | [email protected] " " | ||
209 | [email protected] "+" | ||
210 | [email protected] " " | ||
211 | [email protected] | ||
212 | [email protected] "(" | ||
213 | [email protected] | ||
214 | [email protected] | ||
215 | [email protected] | ||
216 | [email protected] | ||
217 | [email protected] "Copy" | ||
218 | [email protected] ")" | ||
219 | [email protected] ">" | ||
220 | [email protected] | ||
221 | [email protected] ";" | ||
222 | [email protected] "\n " | ||
223 | [email protected] | ||
224 | [email protected] "let" | ||
225 | [email protected] " " | ||
226 | [email protected] | ||
227 | [email protected] "_" | ||
228 | [email protected] ":" | ||
229 | [email protected] " " | ||
230 | [email protected] | ||
231 | [email protected] | ||
232 | [email protected] | ||
233 | [email protected] | ||
234 | [email protected] | ||
235 | [email protected] | ||
236 | [email protected] | ||
237 | [email protected] "Box" | ||
238 | [email protected] | ||
239 | [email protected] "<" | ||
240 | [email protected] | ||
241 | [email protected] | ||
242 | [email protected] "(" | ||
243 | [email protected] | ||
244 | [email protected] "for" | ||
245 | [email protected] | ||
246 | [email protected] "<" | ||
247 | [email protected] | ||
248 | [email protected] "\'a" | ||
249 | [email protected] ">" | ||
250 | [email protected] " " | ||
251 | [email protected] | ||
252 | [email protected] | ||
253 | [email protected] | ||
254 | [email protected] | ||
255 | [email protected] "Trait" | ||
256 | [email protected] | ||
257 | [email protected] "<" | ||
258 | [email protected] | ||
259 | [email protected] "\'a" | ||
260 | [email protected] ">" | ||
261 | [email protected] ")" | ||
262 | [email protected] " " | ||
263 | [email protected] "+" | ||
264 | [email protected] " " | ||
265 | [email protected] | ||
266 | [email protected] "(" | ||
267 | [email protected] | ||
268 | [email protected] | ||
269 | [email protected] | ||
270 | [email protected] | ||
271 | [email protected] "Copy" | ||
272 | [email protected] ")" | ||
273 | [email protected] " " | ||
274 | [email protected] "+" | ||
275 | [email protected] " " | ||
276 | [email protected] | ||
277 | [email protected] "(" | ||
278 | [email protected] "?" | ||
279 | [email protected] | ||
280 | [email protected] | ||
281 | [email protected] | ||
282 | [email protected] | ||
283 | [email protected] "Sized" | ||
284 | [email protected] ")" | ||
285 | [email protected] | ||
286 | [email protected] | ||
287 | [email protected] ">" | ||
288 | [email protected] ";" | ||
289 | [email protected] "\n" | ||
290 | [email protected] "}" | ||
291 | [email protected] "\n" | ||
292 | error 88..88: expected COMMA | ||
293 | error 88..88: expected R_ANGLE | ||
294 | error 121..121: expected SEMICOLON | ||
295 | error 121..121: expected expression | ||
296 | error 140..140: expected type | ||
297 | error 141..141: expected R_PAREN | ||
298 | error 141..141: expected COMMA | ||
299 | error 141..141: expected R_ANGLE | ||
300 | error 141..141: expected SEMICOLON | ||
301 | error 146..146: expected SEMICOLON | ||
302 | error 146..146: expected expression | ||
303 | error 147..147: expected SEMICOLON | ||
304 | error 148..148: expected expression | ||
305 | error 149..149: expected SEMICOLON | ||
306 | error 155..155: expected type | ||
307 | error 158..158: expected IN_KW | ||
308 | error 165..165: expected expression | ||
309 | error 168..168: expected expression | ||
310 | error 179..179: expected expression | ||
311 | error 180..180: expected a block | ||
312 | error 180..180: expected COMMA | ||
313 | error 180..180: expected expression | ||
314 | error 180..180: expected R_PAREN | ||
315 | error 180..180: expected SEMICOLON | ||
316 | error 215..215: expected COMMA | ||
317 | error 215..215: expected R_ANGLE | ||
318 | error 235..235: expected SEMICOLON | ||
319 | error 235..235: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rs b/crates/syntax/test_data/parser/err/0024_many_type_parens.rs new file mode 100644 index 000000000..6c2e95c02 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | fn f<T: (Copy) + (?Sized) + (for<'a> Trait<'a>)>() {} | ||
2 | |||
3 | fn main() { | ||
4 | let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>; | ||
5 | let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>; | ||
6 | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>; | ||
7 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0025_nope.rast b/crates/syntax/test_data/parser/err/0025_nope.rast new file mode 100644 index 000000000..83fc9fe77 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0025_nope.rast | |||
@@ -0,0 +1,202 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "enum" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "Test" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "{" | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] "Var1" | ||
26 | [email protected] "," | ||
27 | [email protected] "\n " | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] "Var2" | ||
31 | [email protected] | ||
32 | [email protected] "(" | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "String" | ||
39 | [email protected] ")" | ||
40 | [email protected] "," | ||
41 | [email protected] "\n " | ||
42 | [email protected] | ||
43 | [email protected] | ||
44 | [email protected] "Var3" | ||
45 | [email protected] " " | ||
46 | [email protected] | ||
47 | [email protected] "{" | ||
48 | [email protected] "\n " | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] "abc" | ||
52 | [email protected] ":" | ||
53 | [email protected] " " | ||
54 | [email protected] | ||
55 | [email protected] "{" | ||
56 | [email protected] "}" | ||
57 | [email protected] | ||
58 | [email protected] "," | ||
59 | [email protected] " " | ||
60 | [email protected] "//~ ERROR: expected t ..." | ||
61 | [email protected] "\n " | ||
62 | [email protected] "}" | ||
63 | [email protected] "," | ||
64 | [email protected] "\n " | ||
65 | [email protected] "}" | ||
66 | [email protected] "\n\n " | ||
67 | [email protected] "// recover..." | ||
68 | [email protected] "\n " | ||
69 | [email protected] | ||
70 | [email protected] "let" | ||
71 | [email protected] " " | ||
72 | [email protected] | ||
73 | [email protected] | ||
74 | [email protected] "a" | ||
75 | [email protected] " " | ||
76 | [email protected] "=" | ||
77 | [email protected] " " | ||
78 | [email protected] | ||
79 | [email protected] "1" | ||
80 | [email protected] ";" | ||
81 | [email protected] "\n " | ||
82 | [email protected] | ||
83 | [email protected] "enum" | ||
84 | [email protected] " " | ||
85 | [email protected] | ||
86 | [email protected] "Test2" | ||
87 | [email protected] " " | ||
88 | [email protected] | ||
89 | [email protected] "{" | ||
90 | [email protected] "\n " | ||
91 | [email protected] | ||
92 | [email protected] | ||
93 | [email protected] "Fine" | ||
94 | [email protected] "," | ||
95 | [email protected] "\n " | ||
96 | [email protected] "}" | ||
97 | [email protected] "\n\n " | ||
98 | [email protected] | ||
99 | [email protected] "enum" | ||
100 | [email protected] " " | ||
101 | [email protected] | ||
102 | [email protected] "Test3" | ||
103 | [email protected] " " | ||
104 | [email protected] | ||
105 | [email protected] "{" | ||
106 | [email protected] "\n " | ||
107 | [email protected] | ||
108 | [email protected] | ||
109 | [email protected] "StillFine" | ||
110 | [email protected] " " | ||
111 | [email protected] | ||
112 | [email protected] "{" | ||
113 | [email protected] "\n " | ||
114 | [email protected] | ||
115 | [email protected] | ||
116 | [email protected] "def" | ||
117 | [email protected] ":" | ||
118 | [email protected] " " | ||
119 | [email protected] | ||
120 | [email protected] | ||
121 | [email protected] | ||
122 | [email protected] | ||
123 | [email protected] "i32" | ||
124 | [email protected] "," | ||
125 | [email protected] "\n " | ||
126 | [email protected] "}" | ||
127 | [email protected] "," | ||
128 | [email protected] "\n " | ||
129 | [email protected] "}" | ||
130 | [email protected] "\n\n " | ||
131 | [email protected] | ||
132 | [email protected] | ||
133 | [email protected] "{" | ||
134 | [email protected] "\n " | ||
135 | [email protected] | ||
136 | [email protected] "// fail again" | ||
137 | [email protected] "\n " | ||
138 | [email protected] "enum" | ||
139 | [email protected] " " | ||
140 | [email protected] | ||
141 | [email protected] "Test4" | ||
142 | [email protected] " " | ||
143 | [email protected] | ||
144 | [email protected] "{" | ||
145 | [email protected] "\n " | ||
146 | [email protected] | ||
147 | [email protected] | ||
148 | [email protected] "Nope" | ||
149 | [email protected] | ||
150 | [email protected] "(" | ||
151 | [email protected] | ||
152 | [email protected] | ||
153 | [email protected] | ||
154 | [email protected] | ||
155 | [email protected] | ||
156 | [email protected] "i32" | ||
157 | [email protected] " " | ||
158 | [email protected] | ||
159 | [email protected] | ||
160 | [email protected] "{" | ||
161 | [email protected] "}" | ||
162 | [email protected] | ||
163 | [email protected] ")" | ||
164 | [email protected] " " | ||
165 | [email protected] "//~ ERROR: found `{`" | ||
166 | [email protected] "\n ..." | ||
167 | [email protected] "//~^ ERROR: found `{`" | ||
168 | [email protected] "\n " | ||
169 | [email protected] "}" | ||
170 | [email protected] "\n " | ||
171 | [email protected] "}" | ||
172 | [email protected] "\n " | ||
173 | [email protected] "// still recover later" | ||
174 | [email protected] "\n " | ||
175 | [email protected] | ||
176 | [email protected] "let" | ||
177 | [email protected] " " | ||
178 | [email protected] | ||
179 | [email protected] | ||
180 | [email protected] "bad_syntax" | ||
181 | [email protected] " " | ||
182 | [email protected] "=" | ||
183 | [email protected] " " | ||
184 | [email protected] | ||
185 | [email protected] "_" | ||
186 | [email protected] ";" | ||
187 | [email protected] " " | ||
188 | [email protected] "//~ ERROR: expected e ..." | ||
189 | [email protected] "\n" | ||
190 | [email protected] "}" | ||
191 | [email protected] "\n" | ||
192 | error 95..95: expected type | ||
193 | error 95..95: expected COMMA | ||
194 | error 96..96: expected field | ||
195 | error 98..98: expected field declaration | ||
196 | error 371..371: expected COMMA | ||
197 | error 372..372: expected a type | ||
198 | error 372..372: expected R_PAREN | ||
199 | error 372..372: expected COMMA | ||
200 | error 372..372: expected enum variant | ||
201 | error 374..374: expected enum variant | ||
202 | error 508..508: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0025_nope.rs b/crates/syntax/test_data/parser/err/0025_nope.rs new file mode 100644 index 000000000..28726ed51 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0025_nope.rs | |||
@@ -0,0 +1,31 @@ | |||
1 | fn main() { | ||
2 | enum Test { | ||
3 | Var1, | ||
4 | Var2(String), | ||
5 | Var3 { | ||
6 | abc: {}, //~ ERROR: expected type, found `{` | ||
7 | }, | ||
8 | } | ||
9 | |||
10 | // recover... | ||
11 | let a = 1; | ||
12 | enum Test2 { | ||
13 | Fine, | ||
14 | } | ||
15 | |||
16 | enum Test3 { | ||
17 | StillFine { | ||
18 | def: i32, | ||
19 | }, | ||
20 | } | ||
21 | |||
22 | { | ||
23 | // fail again | ||
24 | enum Test4 { | ||
25 | Nope(i32 {}) //~ ERROR: found `{` | ||
26 | //~^ ERROR: found `{` | ||
27 | } | ||
28 | } | ||
29 | // still recover later | ||
30 | let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` | ||
31 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/syntax/test_data/parser/err/0026_imp_recovery.rast new file mode 100644 index 000000000..1b08c834e --- /dev/null +++ b/crates/syntax/test_data/parser/err/0026_imp_recovery.rast | |||
@@ -0,0 +1,49 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "impl" | ||
4 | [email protected] | ||
5 | [email protected] "<" | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] "T" | ||
9 | [email protected] ":" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] | ||
13 | [email protected] | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "Clone" | ||
18 | [email protected] ">" | ||
19 | [email protected] "\n" | ||
20 | [email protected] | ||
21 | [email protected] "impl" | ||
22 | [email protected] | ||
23 | [email protected] "<" | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] "T" | ||
27 | [email protected] ">" | ||
28 | [email protected] " " | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] "OnceCell" | ||
34 | [email protected] | ||
35 | [email protected] "<" | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] | ||
41 | [email protected] "T" | ||
42 | [email protected] ">" | ||
43 | [email protected] " " | ||
44 | [email protected] | ||
45 | [email protected] "{" | ||
46 | [email protected] "}" | ||
47 | [email protected] "\n" | ||
48 | error 14..14: expected trait or type | ||
49 | error 14..14: expected `{` | ||
diff --git a/crates/syntax/test_data/parser/err/0026_imp_recovery.rs b/crates/syntax/test_data/parser/err/0026_imp_recovery.rs new file mode 100644 index 000000000..829ca1c4b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0026_imp_recovery.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | impl<T: Clone> | ||
2 | impl<T> OnceCell<T> {} | ||
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast new file mode 100644 index 000000000..a8e42e6ea --- /dev/null +++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast | |||
@@ -0,0 +1,27 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] "\n " | ||
11 | [email protected] | ||
12 | [email protected] "where" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] "for" | ||
16 | [email protected] | ||
17 | [email protected] "<" | ||
18 | [email protected] | ||
19 | [email protected] "\'a" | ||
20 | [email protected] ">" | ||
21 | [email protected] "\n" | ||
22 | [email protected] | ||
23 | [email protected] "{" | ||
24 | [email protected] "}" | ||
25 | [email protected] "\n" | ||
26 | error 26..26: expected type | ||
27 | error 26..26: expected colon | ||
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs new file mode 100644 index 000000000..2792c2084 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn foo() | ||
2 | where for<'a> | ||
3 | {} | ||
diff --git a/crates/syntax/test_data/parser/err/0029_field_completion.rast b/crates/syntax/test_data/parser/err/0029_field_completion.rast new file mode 100644 index 000000000..c6402cdd8 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0029_field_completion.rast | |||
@@ -0,0 +1,35 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] | ||
10 | [email protected] | ||
11 | [email protected] | ||
12 | [email protected] "a" | ||
13 | [email protected] ":" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "A" | ||
20 | [email protected] ")" | ||
21 | [email protected] " " | ||
22 | [email protected] | ||
23 | [email protected] "{" | ||
24 | [email protected] "\n " | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] "a" | ||
31 | [email protected] "." | ||
32 | [email protected] "\n" | ||
33 | [email protected] "}" | ||
34 | [email protected] "\n" | ||
35 | error 21..21: expected field name or number | ||
diff --git a/crates/syntax/test_data/parser/err/0029_field_completion.rs b/crates/syntax/test_data/parser/err/0029_field_completion.rs new file mode 100644 index 000000000..a7cdc17bb --- /dev/null +++ b/crates/syntax/test_data/parser/err/0029_field_completion.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn foo(a: A) { | ||
2 | a. | ||
3 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast new file mode 100644 index 000000000..a443b37db --- /dev/null +++ b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rast | |||
@@ -0,0 +1,121 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "block" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "let" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] "inner" | ||
20 | [email protected] " " | ||
21 | [email protected] "=" | ||
22 | [email protected] " " | ||
23 | [email protected] | ||
24 | [email protected] "{" | ||
25 | [email protected] "\n " | ||
26 | [email protected] | ||
27 | [email protected] "#" | ||
28 | [email protected] "!" | ||
29 | [email protected] "[" | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] "doc" | ||
34 | [email protected] | ||
35 | [email protected] "(" | ||
36 | [email protected] "\"Inner attributes not ..." | ||
37 | [email protected] ")" | ||
38 | [email protected] "]" | ||
39 | [email protected] "\n " | ||
40 | [email protected] "//! Nor are ModuleDoc ..." | ||
41 | [email protected] "\n " | ||
42 | [email protected] "}" | ||
43 | [email protected] ";" | ||
44 | [email protected] "\n " | ||
45 | [email protected] | ||
46 | [email protected] | ||
47 | [email protected] "if" | ||
48 | [email protected] " " | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] "true" | ||
52 | [email protected] " " | ||
53 | [email protected] | ||
54 | [email protected] "{" | ||
55 | [email protected] "\n " | ||
56 | [email protected] | ||
57 | [email protected] "#" | ||
58 | [email protected] "!" | ||
59 | [email protected] "[" | ||
60 | [email protected] | ||
61 | [email protected] | ||
62 | [email protected] | ||
63 | [email protected] "doc" | ||
64 | [email protected] | ||
65 | [email protected] "(" | ||
66 | [email protected] "\"Nor here\"" | ||
67 | [email protected] ")" | ||
68 | [email protected] "]" | ||
69 | [email protected] "\n " | ||
70 | [email protected] | ||
71 | [email protected] "#" | ||
72 | [email protected] "!" | ||
73 | [email protected] "[" | ||
74 | [email protected] | ||
75 | [email protected] | ||
76 | [email protected] | ||
77 | [email protected] "doc" | ||
78 | [email protected] | ||
79 | [email protected] "(" | ||
80 | [email protected] "\"We error on each attr\"" | ||
81 | [email protected] ")" | ||
82 | [email protected] "]" | ||
83 | [email protected] "\n " | ||
84 | [email protected] "//! Nor are ModuleDoc ..." | ||
85 | [email protected] "\n " | ||
86 | [email protected] "}" | ||
87 | [email protected] "\n " | ||
88 | [email protected] | ||
89 | [email protected] "while" | ||
90 | [email protected] " " | ||
91 | [email protected] | ||
92 | [email protected] | ||
93 | [email protected] "true" | ||
94 | [email protected] " " | ||
95 | [email protected] | ||
96 | [email protected] "{" | ||
97 | [email protected] "\n " | ||
98 | [email protected] | ||
99 | [email protected] "#" | ||
100 | [email protected] "!" | ||
101 | [email protected] "[" | ||
102 | [email protected] | ||
103 | [email protected] | ||
104 | [email protected] | ||
105 | [email protected] "doc" | ||
106 | [email protected] | ||
107 | [email protected] "(" | ||
108 | [email protected] "\"Nor here\"" | ||
109 | [email protected] ")" | ||
110 | [email protected] "]" | ||
111 | [email protected] "\n " | ||
112 | [email protected] "//! Nor are ModuleDoc ..." | ||
113 | [email protected] "\n " | ||
114 | [email protected] "}" | ||
115 | [email protected] "\n" | ||
116 | [email protected] "}" | ||
117 | [email protected] "\n" | ||
118 | error 39..83: A block in this position cannot accept inner attributes | ||
119 | error 152..171: A block in this position cannot accept inner attributes | ||
120 | error 180..212: A block in this position cannot accept inner attributes | ||
121 | error 283..302: A block in this position cannot accept inner attributes | ||
diff --git a/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs new file mode 100644 index 000000000..6a04f2d0a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0031_block_inner_attrs.rs | |||
@@ -0,0 +1,15 @@ | |||
1 | fn block() { | ||
2 | let inner = { | ||
3 | #![doc("Inner attributes not allowed here")] | ||
4 | //! Nor are ModuleDoc comments | ||
5 | }; | ||
6 | if true { | ||
7 | #![doc("Nor here")] | ||
8 | #![doc("We error on each attr")] | ||
9 | //! Nor are ModuleDoc comments | ||
10 | } | ||
11 | while true { | ||
12 | #![doc("Nor here")] | ||
13 | //! Nor are ModuleDoc comments | ||
14 | } | ||
15 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast new file mode 100644 index 000000000..672dd054a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast | |||
@@ -0,0 +1,203 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "match" | ||
17 | [email protected] " " | ||
18 | [email protected] | ||
19 | [email protected] "(" | ||
20 | [email protected] ")" | ||
21 | [email protected] " " | ||
22 | [email protected] | ||
23 | [email protected] "{" | ||
24 | [email protected] "\n " | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] "_" | ||
28 | [email protected] " " | ||
29 | [email protected] "=>" | ||
30 | [email protected] " " | ||
31 | [email protected] | ||
32 | [email protected] "(" | ||
33 | [email protected] ")" | ||
34 | [email protected] "," | ||
35 | [email protected] "\n " | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "#" | ||
39 | [email protected] | ||
40 | [email protected] "!" | ||
41 | [email protected] | ||
42 | [email protected] "[" | ||
43 | [email protected] | ||
44 | [email protected] | ||
45 | [email protected] | ||
46 | [email protected] | ||
47 | [email protected] | ||
48 | [email protected] "doc" | ||
49 | [email protected] | ||
50 | [email protected] "(" | ||
51 | [email protected] | ||
52 | [email protected] "\"Not allowed here\"" | ||
53 | [email protected] ")" | ||
54 | [email protected] "]" | ||
55 | [email protected] "\n " | ||
56 | [email protected] | ||
57 | [email protected] | ||
58 | [email protected] "_" | ||
59 | [email protected] " " | ||
60 | [email protected] "=>" | ||
61 | [email protected] " " | ||
62 | [email protected] | ||
63 | [email protected] "(" | ||
64 | [email protected] ")" | ||
65 | [email protected] "," | ||
66 | [email protected] "\n " | ||
67 | [email protected] "}" | ||
68 | [email protected] "\n\n " | ||
69 | [email protected] | ||
70 | [email protected] | ||
71 | [email protected] "match" | ||
72 | [email protected] " " | ||
73 | [email protected] | ||
74 | [email protected] "(" | ||
75 | [email protected] ")" | ||
76 | [email protected] " " | ||
77 | [email protected] | ||
78 | [email protected] "{" | ||
79 | [email protected] "\n " | ||
80 | [email protected] | ||
81 | [email protected] | ||
82 | [email protected] "_" | ||
83 | [email protected] " " | ||
84 | [email protected] "=>" | ||
85 | [email protected] " " | ||
86 | [email protected] | ||
87 | [email protected] "(" | ||
88 | [email protected] ")" | ||
89 | [email protected] "," | ||
90 | [email protected] "\n " | ||
91 | [email protected] | ||
92 | [email protected] | ||
93 | [email protected] "_" | ||
94 | [email protected] " " | ||
95 | [email protected] "=>" | ||
96 | [email protected] " " | ||
97 | [email protected] | ||
98 | [email protected] "(" | ||
99 | [email protected] ")" | ||
100 | [email protected] "," | ||
101 | [email protected] "\n " | ||
102 | [email protected] | ||
103 | [email protected] | ||
104 | [email protected] "#" | ||
105 | [email protected] | ||
106 | [email protected] "!" | ||
107 | [email protected] | ||
108 | [email protected] "[" | ||
109 | [email protected] | ||
110 | [email protected] | ||
111 | [email protected] | ||
112 | [email protected] | ||
113 | [email protected] | ||
114 | [email protected] "doc" | ||
115 | [email protected] | ||
116 | [email protected] "(" | ||
117 | [email protected] | ||
118 | [email protected] "\"Nor here\"" | ||
119 | [email protected] ")" | ||
120 | [email protected] "]" | ||
121 | [email protected] "\n " | ||
122 | [email protected] "}" | ||
123 | [email protected] "\n\n " | ||
124 | [email protected] | ||
125 | [email protected] "match" | ||
126 | [email protected] " " | ||
127 | [email protected] | ||
128 | [email protected] "(" | ||
129 | [email protected] ")" | ||
130 | [email protected] " " | ||
131 | [email protected] | ||
132 | [email protected] "{" | ||
133 | [email protected] "\n " | ||
134 | [email protected] | ||
135 | [email protected] | ||
136 | [email protected] "#" | ||
137 | [email protected] "[" | ||
138 | [email protected] | ||
139 | [email protected] | ||
140 | [email protected] | ||
141 | [email protected] "cfg" | ||
142 | [email protected] | ||
143 | [email protected] "(" | ||
144 | [email protected] "test" | ||
145 | [email protected] ")" | ||
146 | [email protected] "]" | ||
147 | [email protected] "\n " | ||
148 | [email protected] | ||
149 | [email protected] "#" | ||
150 | [email protected] | ||
151 | [email protected] "!" | ||
152 | [email protected] | ||
153 | [email protected] "[" | ||
154 | [email protected] | ||
155 | [email protected] | ||
156 | [email protected] | ||
157 | [email protected] | ||
158 | [email protected] | ||
159 | [email protected] "doc" | ||
160 | [email protected] | ||
161 | [email protected] "(" | ||
162 | [email protected] | ||
163 | [email protected] "\"Nor here\"" | ||
164 | [email protected] ")" | ||
165 | [email protected] "]" | ||
166 | [email protected] "\n " | ||
167 | [email protected] | ||
168 | [email protected] | ||
169 | [email protected] "_" | ||
170 | [email protected] " " | ||
171 | [email protected] "=>" | ||
172 | [email protected] " " | ||
173 | [email protected] | ||
174 | [email protected] "(" | ||
175 | [email protected] ")" | ||
176 | [email protected] "," | ||
177 | [email protected] "\n " | ||
178 | [email protected] | ||
179 | [email protected] | ||
180 | [email protected] "_" | ||
181 | [email protected] " " | ||
182 | [email protected] "=>" | ||
183 | [email protected] " " | ||
184 | [email protected] | ||
185 | [email protected] "(" | ||
186 | [email protected] ")" | ||
187 | [email protected] "," | ||
188 | [email protected] "\n " | ||
189 | [email protected] "}" | ||
190 | [email protected] "\n" | ||
191 | [email protected] "}" | ||
192 | [email protected] "\n" | ||
193 | error 52..52: expected `[` | ||
194 | error 52..52: expected pattern | ||
195 | error 53..53: expected FAT_ARROW | ||
196 | error 78..78: expected COMMA | ||
197 | error 161..161: expected `[` | ||
198 | error 161..161: expected pattern | ||
199 | error 162..162: expected FAT_ARROW | ||
200 | error 232..232: expected `[` | ||
201 | error 232..232: expected pattern | ||
202 | error 233..233: expected FAT_ARROW | ||
203 | error 250..250: expected COMMA | ||
diff --git a/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs new file mode 100644 index 000000000..06aa47770 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0032_match_arms_inner_attrs.rs | |||
@@ -0,0 +1,20 @@ | |||
1 | fn foo() { | ||
2 | match () { | ||
3 | _ => (), | ||
4 | #![doc("Not allowed here")] | ||
5 | _ => (), | ||
6 | } | ||
7 | |||
8 | match () { | ||
9 | _ => (), | ||
10 | _ => (), | ||
11 | #![doc("Nor here")] | ||
12 | } | ||
13 | |||
14 | match () { | ||
15 | #[cfg(test)] | ||
16 | #![doc("Nor here")] | ||
17 | _ => (), | ||
18 | _ => (), | ||
19 | } | ||
20 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast new file mode 100644 index 000000000..33bb085e9 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast | |||
@@ -0,0 +1,66 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "match" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "(" | ||
19 | [email protected] ")" | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "{" | ||
23 | [email protected] "\n " | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] "_" | ||
27 | [email protected] " " | ||
28 | [email protected] "=>" | ||
29 | [email protected] " " | ||
30 | [email protected] | ||
31 | [email protected] "(" | ||
32 | [email protected] ")" | ||
33 | [email protected] "," | ||
34 | [email protected] "\n " | ||
35 | [email protected] | ||
36 | [email protected] | ||
37 | [email protected] "_" | ||
38 | [email protected] " " | ||
39 | [email protected] "=>" | ||
40 | [email protected] " " | ||
41 | [email protected] | ||
42 | [email protected] "(" | ||
43 | [email protected] ")" | ||
44 | [email protected] "," | ||
45 | [email protected] "\n " | ||
46 | [email protected] | ||
47 | [email protected] | ||
48 | [email protected] "#" | ||
49 | [email protected] "[" | ||
50 | [email protected] | ||
51 | [email protected] | ||
52 | [email protected] | ||
53 | [email protected] "cfg" | ||
54 | [email protected] | ||
55 | [email protected] "(" | ||
56 | [email protected] "test" | ||
57 | [email protected] ")" | ||
58 | [email protected] "]" | ||
59 | [email protected] "\n " | ||
60 | [email protected] "}" | ||
61 | [email protected] "\n" | ||
62 | [email protected] "}" | ||
63 | [email protected] "\n" | ||
64 | error 80..80: expected pattern | ||
65 | error 80..80: expected FAT_ARROW | ||
66 | error 80..80: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs new file mode 100644 index 000000000..4635222da --- /dev/null +++ b/crates/syntax/test_data/parser/err/0033_match_arms_outer_attrs.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | fn foo() { | ||
2 | match () { | ||
3 | _ => (), | ||
4 | _ => (), | ||
5 | #[cfg(test)] | ||
6 | } | ||
7 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast new file mode 100644 index 000000000..d9d49bfb5 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rast | |||
@@ -0,0 +1,95 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] "let" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "ref" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "box" | ||
22 | [email protected] " " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] | ||
29 | [email protected] "i" | ||
30 | [email protected] " " | ||
31 | [email protected] "=" | ||
32 | [email protected] " " | ||
33 | [email protected] | ||
34 | [email protected] "(" | ||
35 | [email protected] ")" | ||
36 | [email protected] ";" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] "let" | ||
40 | [email protected] " " | ||
41 | [email protected] | ||
42 | [email protected] "mut" | ||
43 | [email protected] " " | ||
44 | [email protected] | ||
45 | [email protected] "box" | ||
46 | [email protected] " " | ||
47 | [email protected] | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] | ||
52 | [email protected] | ||
53 | [email protected] "i" | ||
54 | [email protected] " " | ||
55 | [email protected] "=" | ||
56 | [email protected] " " | ||
57 | [email protected] | ||
58 | [email protected] "(" | ||
59 | [email protected] ")" | ||
60 | [email protected] ";" | ||
61 | [email protected] "\n " | ||
62 | [email protected] | ||
63 | [email protected] "let" | ||
64 | [email protected] " " | ||
65 | [email protected] | ||
66 | [email protected] "ref" | ||
67 | [email protected] " " | ||
68 | [email protected] "mut" | ||
69 | [email protected] " " | ||
70 | [email protected] | ||
71 | [email protected] "box" | ||
72 | [email protected] " " | ||
73 | [email protected] | ||
74 | [email protected] | ||
75 | [email protected] | ||
76 | [email protected] | ||
77 | [email protected] | ||
78 | [email protected] | ||
79 | [email protected] "i" | ||
80 | [email protected] " " | ||
81 | [email protected] "=" | ||
82 | [email protected] " " | ||
83 | [email protected] | ||
84 | [email protected] "(" | ||
85 | [email protected] ")" | ||
86 | [email protected] ";" | ||
87 | [email protected] "\n" | ||
88 | [email protected] "}" | ||
89 | [email protected] "\n\n" | ||
90 | error 24..24: expected a name | ||
91 | error 27..27: expected SEMICOLON | ||
92 | error 48..48: expected a name | ||
93 | error 51..51: expected SEMICOLON | ||
94 | error 76..76: expected a name | ||
95 | error 79..79: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs b/crates/syntax/test_data/parser/err/0034_bad_box_pattern.rs new file mode 100644 index 000000000..d3fa2e468 --- /dev/null +++ b/crates/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/syntax/test_data/parser/err/0035_use_recover.rast b/crates/syntax/test_data/parser/err/0035_use_recover.rast new file mode 100644 index 000000000..2f03709eb --- /dev/null +++ b/crates/syntax/test_data/parser/err/0035_use_recover.rast | |||
@@ -0,0 +1,53 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] | ||
10 | [email protected] "foo" | ||
11 | [email protected] "::" | ||
12 | [email protected] | ||
13 | [email protected] | ||
14 | [email protected] "bar" | ||
15 | [email protected] ";" | ||
16 | [email protected] "\n" | ||
17 | [email protected] | ||
18 | [email protected] "use" | ||
19 | [email protected] "\n" | ||
20 | [email protected] | ||
21 | [email protected] "use" | ||
22 | [email protected] " " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] "crate" | ||
28 | [email protected] "::" | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] "baz" | ||
32 | [email protected] ";" | ||
33 | [email protected] "\n" | ||
34 | [email protected] | ||
35 | [email protected] "use" | ||
36 | [email protected] "\n" | ||
37 | [email protected] | ||
38 | [email protected] "fn" | ||
39 | [email protected] " " | ||
40 | [email protected] | ||
41 | [email protected] "f" | ||
42 | [email protected] | ||
43 | [email protected] "(" | ||
44 | [email protected] ")" | ||
45 | [email protected] " " | ||
46 | [email protected] | ||
47 | [email protected] "{" | ||
48 | [email protected] "}" | ||
49 | [email protected] "\n" | ||
50 | error 17..17: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
51 | error 17..17: expected SEMICOLON | ||
52 | error 37..37: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
53 | error 37..37: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0035_use_recover.rs b/crates/syntax/test_data/parser/err/0035_use_recover.rs new file mode 100644 index 000000000..4a2668126 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0035_use_recover.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | use foo::bar; | ||
2 | use | ||
3 | use crate::baz; | ||
4 | use | ||
5 | fn f() {} | ||
diff --git a/crates/syntax/test_data/parser/err/0036_partial_use.rast b/crates/syntax/test_data/parser/err/0036_partial_use.rast new file mode 100644 index 000000000..ef6172f8a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0036_partial_use.rast | |||
@@ -0,0 +1,51 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] "std" | ||
10 | [email protected] "::" | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] "error" | ||
19 | [email protected] "::" | ||
20 | [email protected] | ||
21 | [email protected] | ||
22 | [email protected] "Error" | ||
23 | [email protected] | ||
24 | [email protected] ";" | ||
25 | [email protected] "\n" | ||
26 | [email protected] | ||
27 | [email protected] "use" | ||
28 | [email protected] " " | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] "std" | ||
35 | [email protected] "::" | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "io" | ||
39 | [email protected] | ||
40 | [email protected] ";" | ||
41 | [email protected] "\n" | ||
42 | error 22..22: expected COMMA | ||
43 | error 22..22: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
44 | error 23..23: expected COMMA | ||
45 | error 24..24: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
46 | error 27..27: expected COMMA | ||
47 | error 35..35: expected COMMA | ||
48 | error 35..35: expected one of `*`, `::`, `{`, `self`, `super` or an identifier | ||
49 | error 36..36: expected COMMA | ||
50 | error 36..36: expected R_CURLY | ||
51 | error 36..36: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0036_partial_use.rs b/crates/syntax/test_data/parser/err/0036_partial_use.rs new file mode 100644 index 000000000..d521a5bb2 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0036_partial_use.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | use std::{error::Error; | ||
2 | use std::io; | ||
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast new file mode 100644 index 000000000..faf87d6e5 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rast | |||
@@ -0,0 +1,97 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "impl" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] | ||
9 | [email protected] "T" | ||
10 | [email protected] " " | ||
11 | [email protected] "for" | ||
12 | [email protected] " " | ||
13 | [email protected] | ||
14 | [email protected] "(" | ||
15 | [email protected] ")" | ||
16 | [email protected] " " | ||
17 | [email protected] | ||
18 | [email protected] "{" | ||
19 | [email protected] "\n " | ||
20 | [email protected] | ||
21 | [email protected] "fn" | ||
22 | [email protected] " " | ||
23 | [email protected] | ||
24 | [email protected] "foo" | ||
25 | [email protected] | ||
26 | [email protected] "(" | ||
27 | [email protected] ")" | ||
28 | [email protected] " " | ||
29 | [email protected] | ||
30 | [email protected] "{" | ||
31 | [email protected] "}" | ||
32 | [email protected] "\n " | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] "pub" | ||
36 | [email protected] " " | ||
37 | [email protected] "fn" | ||
38 | [email protected] " " | ||
39 | [email protected] | ||
40 | [email protected] "bar" | ||
41 | [email protected] | ||
42 | [email protected] "(" | ||
43 | [email protected] ")" | ||
44 | [email protected] " " | ||
45 | [email protected] | ||
46 | [email protected] "{" | ||
47 | [email protected] "}" | ||
48 | [email protected] "\n " | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] "pub" | ||
52 | [email protected] "(" | ||
53 | [email protected] "crate" | ||
54 | [email protected] ")" | ||
55 | [email protected] " " | ||
56 | [email protected] "type" | ||
57 | [email protected] " " | ||
58 | [email protected] | ||
59 | [email protected] "Baz" | ||
60 | [email protected] " " | ||
61 | [email protected] "=" | ||
62 | [email protected] " " | ||
63 | [email protected] | ||
64 | [email protected] "(" | ||
65 | [email protected] ")" | ||
66 | [email protected] ";" | ||
67 | [email protected] "\n " | ||
68 | [email protected] | ||
69 | [email protected] | ||
70 | [email protected] "pub" | ||
71 | [email protected] "(" | ||
72 | [email protected] "crate" | ||
73 | [email protected] ")" | ||
74 | [email protected] " " | ||
75 | [email protected] "const" | ||
76 | [email protected] " " | ||
77 | [email protected] | ||
78 | [email protected] "C" | ||
79 | [email protected] ":" | ||
80 | [email protected] " " | ||
81 | [email protected] | ||
82 | [email protected] | ||
83 | [email protected] | ||
84 | [email protected] | ||
85 | [email protected] "i32" | ||
86 | [email protected] " " | ||
87 | [email protected] "=" | ||
88 | [email protected] " " | ||
89 | [email protected] | ||
90 | [email protected] "92" | ||
91 | [email protected] ";" | ||
92 | [email protected] "\n" | ||
93 | [email protected] "}" | ||
94 | [email protected] "\n" | ||
95 | error 36..39: Unnecessary visibility qualifier | ||
96 | error 56..66: Unnecessary visibility qualifier | ||
97 | error 86..96: Unnecessary visibility qualifier | ||
diff --git a/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs new file mode 100644 index 000000000..a43e7ef10 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0037_visibility_in_traits.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | impl T for () { | ||
2 | fn foo() {} | ||
3 | pub fn bar() {} | ||
4 | pub(crate) type Baz = (); | ||
5 | pub(crate) const C: i32 = 92; | ||
6 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast new file mode 100644 index 000000000..bed7ad6c3 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rast | |||
@@ -0,0 +1,29 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "0" | ||
18 | [email protected] "..=" | ||
19 | [email protected] ";" | ||
20 | [email protected] "\n " | ||
21 | [email protected] | ||
22 | [email protected] | ||
23 | [email protected] "..=" | ||
24 | [email protected] ";" | ||
25 | [email protected] "\n" | ||
26 | [email protected] "}" | ||
27 | [email protected] "\n" | ||
28 | error 16..20: An inclusive range must have an end expression | ||
29 | error 26..29: An inclusive range must have an end expression | ||
diff --git a/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs new file mode 100644 index 000000000..0b4ed7a2b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0038_endless_inclusive_range.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn main() { | ||
2 | 0..=; | ||
3 | ..=; | ||
4 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast new file mode 100644 index 000000000..a9c5b70fd --- /dev/null +++ b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rast | |||
@@ -0,0 +1,82 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "foo" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "->" | ||
13 | [email protected] " " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] "i32" | ||
19 | [email protected] " " | ||
20 | [email protected] | ||
21 | [email protected] "{" | ||
22 | [email protected] "\n " | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] "[" | ||
29 | [email protected] | ||
30 | [email protected] "1" | ||
31 | [email protected] "," | ||
32 | [email protected] " " | ||
33 | [email protected] | ||
34 | [email protected] "2" | ||
35 | [email protected] "," | ||
36 | [email protected] " " | ||
37 | [email protected] | ||
38 | [email protected] "3" | ||
39 | [email protected] "]" | ||
40 | [email protected] "." | ||
41 | [email protected] | ||
42 | [email protected] "iter" | ||
43 | [email protected] | ||
44 | [email protected] "(" | ||
45 | [email protected] ")" | ||
46 | [email protected] "\n " | ||
47 | [email protected] "." | ||
48 | [email protected] | ||
49 | [email protected] "map" | ||
50 | [email protected] | ||
51 | [email protected] "(" | ||
52 | [email protected] | ||
53 | [email protected] | ||
54 | [email protected] "|" | ||
55 | [email protected] | ||
56 | [email protected] | ||
57 | [email protected] | ||
58 | [email protected] "it" | ||
59 | [email protected] "|" | ||
60 | [email protected] ")" | ||
61 | [email protected] "\n " | ||
62 | [email protected] "." | ||
63 | [email protected] | ||
64 | [email protected] "max" | ||
65 | [email protected] | ||
66 | [email protected] "::" | ||
67 | [email protected] "<" | ||
68 | [email protected] | ||
69 | [email protected] | ||
70 | [email protected] | ||
71 | [email protected] | ||
72 | [email protected] | ||
73 | [email protected] "i32" | ||
74 | [email protected] ">" | ||
75 | [email protected] | ||
76 | [email protected] "(" | ||
77 | [email protected] ")" | ||
78 | [email protected] ";" | ||
79 | [email protected] "\n" | ||
80 | [email protected] "}" | ||
81 | [email protected] "\n" | ||
82 | error 56..56: expected expression | ||
diff --git a/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs new file mode 100644 index 000000000..a2f74bd87 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0039_lambda_recovery.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo() -> i32 { | ||
2 | [1, 2, 3].iter() | ||
3 | .map(|it|) | ||
4 | .max::<i32>(); | ||
5 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast new file mode 100644 index 000000000..284c8715b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rast | |||
@@ -0,0 +1,91 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] "::" | ||
9 | [email protected] "crate" | ||
10 | [email protected] ";" | ||
11 | [email protected] "\n" | ||
12 | [email protected] | ||
13 | [email protected] "use" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] "{" | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] | ||
21 | [email protected] "crate" | ||
22 | [email protected] "," | ||
23 | [email protected] " " | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] "foo" | ||
29 | [email protected] "::" | ||
30 | [email protected] | ||
31 | [email protected] "{" | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] | ||
35 | [email protected] | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "crate" | ||
39 | [email protected] "::" | ||
40 | [email protected] | ||
41 | [email protected] | ||
42 | [email protected] "foo" | ||
43 | [email protected] "::" | ||
44 | [email protected] | ||
45 | [email protected] | ||
46 | [email protected] "bar" | ||
47 | [email protected] "::" | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] "baz" | ||
51 | [email protected] "}" | ||
52 | [email protected] "}" | ||
53 | [email protected] ";" | ||
54 | [email protected] "\n" | ||
55 | [email protected] | ||
56 | [email protected] "use" | ||
57 | [email protected] " " | ||
58 | [email protected] | ||
59 | [email protected] | ||
60 | [email protected] | ||
61 | [email protected] | ||
62 | [email protected] | ||
63 | [email protected] "hello" | ||
64 | [email protected] "::" | ||
65 | [email protected] | ||
66 | [email protected] "crate" | ||
67 | [email protected] ";" | ||
68 | [email protected] "\n" | ||
69 | [email protected] | ||
70 | [email protected] "use" | ||
71 | [email protected] " " | ||
72 | [email protected] | ||
73 | [email protected] | ||
74 | [email protected] | ||
75 | [email protected] | ||
76 | [email protected] | ||
77 | [email protected] | ||
78 | [email protected] "hello" | ||
79 | [email protected] "::" | ||
80 | [email protected] | ||
81 | [email protected] "crate" | ||
82 | [email protected] "::" | ||
83 | [email protected] | ||
84 | [email protected] | ||
85 | [email protected] "there" | ||
86 | [email protected] ";" | ||
87 | [email protected] "\n" | ||
88 | error 6..11: The `crate` keyword is only allowed as the first segment of a path | ||
89 | error 31..36: The `crate` keyword is only allowed as the first segment of a path | ||
90 | error 66..71: The `crate` keyword is only allowed as the first segment of a path | ||
91 | error 84..89: The `crate` keyword is only allowed as the first segment of a path | ||
diff --git a/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs new file mode 100644 index 000000000..508def2c7 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0040_illegal_crate_kw_location.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | use ::crate; | ||
2 | use {crate, foo::{crate::foo::bar::baz}}; | ||
3 | use hello::crate; | ||
4 | use hello::crate::there; | ||
diff --git a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast new file mode 100644 index 000000000..2049a9d72 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast | |||
@@ -0,0 +1,70 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] "::" | ||
9 | [email protected] "super" | ||
10 | [email protected] ";" | ||
11 | [email protected] "\n" | ||
12 | [email protected] | ||
13 | [email protected] "use" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "a" | ||
21 | [email protected] "::" | ||
22 | [email protected] | ||
23 | [email protected] "super" | ||
24 | [email protected] ";" | ||
25 | [email protected] "\n" | ||
26 | [email protected] | ||
27 | [email protected] "use" | ||
28 | [email protected] " " | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] | ||
33 | [email protected] | ||
34 | [email protected] "super" | ||
35 | [email protected] "::" | ||
36 | [email protected] | ||
37 | [email protected] | ||
38 | [email protected] "a" | ||
39 | [email protected] "::" | ||
40 | [email protected] | ||
41 | [email protected] "super" | ||
42 | [email protected] ";" | ||
43 | [email protected] "\n" | ||
44 | [email protected] | ||
45 | [email protected] "use" | ||
46 | [email protected] " " | ||
47 | [email protected] | ||
48 | [email protected] | ||
49 | [email protected] | ||
50 | [email protected] | ||
51 | [email protected] "a" | ||
52 | [email protected] "::" | ||
53 | [email protected] | ||
54 | [email protected] "{" | ||
55 | [email protected] | ||
56 | [email protected] | ||
57 | [email protected] | ||
58 | [email protected] | ||
59 | [email protected] "super" | ||
60 | [email protected] "::" | ||
61 | [email protected] | ||
62 | [email protected] | ||
63 | [email protected] "b" | ||
64 | [email protected] "}" | ||
65 | [email protected] ";" | ||
66 | [email protected] "\n" | ||
67 | error 6..11: The `super` keyword may only be preceded by other `super`s | ||
68 | error 20..25: The `super` keyword may only be preceded by other `super`s | ||
69 | error 41..46: The `super` keyword may only be preceded by other `super`s | ||
70 | error 56..61: The `super` keyword may only be preceded by other `super`s | ||
diff --git a/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs new file mode 100644 index 000000000..bd4d58042 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0041_illegal_super_keyword_location.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | use ::super; | ||
2 | use a::super; | ||
3 | use super::a::super; | ||
4 | use a::{super::b}; | ||
diff --git a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast new file mode 100644 index 000000000..deadf56b4 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rast | |||
@@ -0,0 +1,27 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "use" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] | ||
7 | [email protected] | ||
8 | [email protected] "::" | ||
9 | [email protected] "self" | ||
10 | [email protected] ";" | ||
11 | [email protected] "\n" | ||
12 | [email protected] | ||
13 | [email protected] "use" | ||
14 | [email protected] " " | ||
15 | [email protected] | ||
16 | [email protected] | ||
17 | [email protected] | ||
18 | [email protected] | ||
19 | [email protected] | ||
20 | [email protected] "a" | ||
21 | [email protected] "::" | ||
22 | [email protected] | ||
23 | [email protected] "self" | ||
24 | [email protected] ";" | ||
25 | [email protected] "\n" | ||
26 | error 6..10: The `self` keyword is only allowed as the first segment of a path | ||
27 | error 19..23: The `self` keyword is only allowed as the first segment of a path | ||
diff --git a/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs new file mode 100644 index 000000000..b9e1d7d8b --- /dev/null +++ b/crates/syntax/test_data/parser/err/0042_illegal_self_keyword_location.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | use ::self; | ||
2 | use a::self; | ||
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast new file mode 100644 index 000000000..df29017e7 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast | |||
@@ -0,0 +1,71 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "fn" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "main" | ||
7 | [email protected] | ||
8 | [email protected] "(" | ||
9 | [email protected] ")" | ||
10 | [email protected] " " | ||
11 | [email protected] | ||
12 | [email protected] "{" | ||
13 | [email protected] "\n " | ||
14 | [email protected] | ||
15 | [email protected] | ||
16 | [email protected] "{" | ||
17 | [email protected] " " | ||
18 | [email protected] | ||
19 | [email protected] "unsafe" | ||
20 | [email protected] " " | ||
21 | [email protected] | ||
22 | [email protected] "92" | ||
23 | [email protected] " " | ||
24 | [email protected] "}" | ||
25 | [email protected] "\n " | ||
26 | [email protected] | ||
27 | [email protected] | ||
28 | [email protected] "{" | ||
29 | [email protected] " " | ||
30 | [email protected] | ||
31 | [email protected] "async" | ||
32 | [email protected] " " | ||
33 | [email protected] | ||
34 | [email protected] "92" | ||
35 | [email protected] " " | ||
36 | [email protected] "}" | ||
37 | [email protected] "\n " | ||
38 | [email protected] | ||
39 | [email protected] | ||
40 | [email protected] "{" | ||
41 | [email protected] " " | ||
42 | [email protected] | ||
43 | [email protected] | ||
44 | [email protected] "try" | ||
45 | [email protected] " " | ||
46 | [email protected] | ||
47 | [email protected] "92" | ||
48 | [email protected] " " | ||
49 | [email protected] "}" | ||
50 | [email protected] "\n " | ||
51 | [email protected] | ||
52 | [email protected] "{" | ||
53 | [email protected] " " | ||
54 | [email protected] | ||
55 | [email protected] | ||
56 | [email protected] | ||
57 | [email protected] "\'label" | ||
58 | [email protected] ":" | ||
59 | [email protected] " " | ||
60 | [email protected] | ||
61 | [email protected] "92" | ||
62 | [email protected] " " | ||
63 | [email protected] "}" | ||
64 | [email protected] "\n" | ||
65 | [email protected] "}" | ||
66 | [email protected] "\n" | ||
67 | error 24..24: expected existential, fn, trait or impl | ||
68 | error 41..41: expected existential, fn, trait or impl | ||
69 | error 56..56: expected a block | ||
70 | error 75..75: expected a loop | ||
71 | error 75..75: expected SEMICOLON | ||
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rs b/crates/syntax/test_data/parser/err/0043_weird_blocks.rs new file mode 100644 index 000000000..8fa324c1a --- /dev/null +++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rs | |||
@@ -0,0 +1,6 @@ | |||
1 | fn main() { | ||
2 | { unsafe 92 } | ||
3 | { async 92 } | ||
4 | { try 92 } | ||
5 | { 'label: 92 } | ||
6 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast new file mode 100644 index 000000000..71aa86494 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast | |||
@@ -0,0 +1,240 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "type" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "ForRef" | ||
7 | [email protected] " " | ||
8 | [email protected] "=" | ||
9 | [email protected] " " | ||
10 | [email protected] | ||
11 | [email protected] "for" | ||
12 | [email protected] | ||
13 | [email protected] "<" | ||
14 | [email protected] | ||
15 | [email protected] "\'a" | ||
16 | [email protected] ">" | ||
17 | [email protected] " " | ||
18 | [email protected] | ||
19 | [email protected] "&" | ||
20 | [email protected] "\'a" | ||
21 | [email protected] " " | ||
22 | [email protected] | ||
23 | [email protected] | ||
24 | [email protected] | ||
25 | [email protected] | ||
26 | [email protected] "u32" | ||
27 | [email protected] ";" | ||
28 | [email protected] "\n" | ||
29 | [email protected] | ||
30 | [email protected] "type" | ||
31 | [email protected] " " | ||
32 | [email protected] | ||
33 | [email protected] "ForTup" | ||
34 | [email protected] " " | ||
35 | [email protected] "=" | ||
36 | [email protected] " " | ||
37 | [email protected] | ||
38 | [email protected] "for" | ||
39 | [email protected] | ||
40 | [email protected] "<" | ||
41 | [email protected] | ||
42 | [email protected] "\'a" | ||
43 | [email protected] ">" | ||
44 | [email protected] " " | ||
45 | [email protected] | ||
46 | [email protected] "(" | ||
47 | [email protected] | ||
48 | [email protected] "&" | ||
49 | [email protected] "\'a" | ||
50 | [email protected] " " | ||
51 | [email protected] | ||
52 | [email protected] | ||
53 | [email protected] | ||
54 | [email protected] | ||
55 | [email protected] "u32" | ||
56 | [email protected] "," | ||
57 | [email protected] ")" | ||
58 | [email protected] ";" | ||
59 | [email protected] "\n" | ||
60 | [email protected] | ||
61 | [email protected] "type" | ||
62 | [email protected] " " | ||
63 | [email protected] | ||
64 | [email protected] "ForSlice" | ||
65 | [email protected] " " | ||
66 | [email protected] "=" | ||
67 | [email protected] " " | ||
68 | [email protected] | ||
69 | [email protected] "for" | ||
70 | [email protected] | ||
71 | [email protected] "<" | ||
72 | [email protected] | ||
73 | [email protected] "\'a" | ||
74 | [email protected] ">" | ||
75 | [email protected] " " | ||
76 | [email protected] | ||
77 | [email protected] "[" | ||
78 | [email protected] | ||
79 | [email protected] | ||
80 | [email protected] | ||
81 | [email protected] | ||
82 | [email protected] "u32" | ||
83 | [email protected] "]" | ||
84 | [email protected] ";" | ||
85 | [email protected] "\n" | ||
86 | [email protected] | ||
87 | [email protected] "type" | ||
88 | [email protected] " " | ||
89 | [email protected] | ||
90 | [email protected] "ForForFn" | ||
91 | [email protected] " " | ||
92 | [email protected] "=" | ||
93 | [email protected] " " | ||
94 | [email protected] | ||
95 | [email protected] "for" | ||
96 | [email protected] | ||
97 | [email protected] "<" | ||
98 | [email protected] | ||
99 | [email protected] "\'a" | ||
100 | [email protected] ">" | ||
101 | [email protected] " " | ||
102 | [email protected] | ||
103 | [email protected] "for" | ||
104 | [email protected] | ||
105 | [email protected] "<" | ||
106 | [email protected] | ||
107 | [email protected] "\'b" | ||
108 | [email protected] ">" | ||
109 | [email protected] " " | ||
110 | [email protected] | ||
111 | [email protected] "fn" | ||
112 | [email protected] | ||
113 | [email protected] "(" | ||
114 | [email protected] | ||
115 | [email protected] | ||
116 | [email protected] "&" | ||
117 | [email protected] "\'a" | ||
118 | [email protected] " " | ||
119 | [email protected] | ||
120 | [email protected] | ||
121 | [email protected] | ||
122 | [email protected] | ||
123 | [email protected] "i32" | ||
124 | [email protected] "," | ||
125 | [email protected] " " | ||
126 | [email protected] | ||
127 | [email protected] | ||
128 | [email protected] "&" | ||
129 | [email protected] "\'b" | ||
130 | [email protected] " " | ||
131 | [email protected] | ||
132 | [email protected] | ||
133 | [email protected] | ||
134 | [email protected] | ||
135 | [email protected] "i32" | ||
136 | [email protected] ")" | ||
137 | [email protected] ";" | ||
138 | [email protected] "\n" | ||
139 | [email protected] | ||
140 | [email protected] "fn" | ||
141 | [email protected] " " | ||
142 | [email protected] | ||
143 | [email protected] "for_for_for" | ||
144 | [email protected] | ||
145 | [email protected] "<" | ||
146 | [email protected] | ||
147 | [email protected] | ||
148 | [email protected] "T" | ||
149 | [email protected] ">" | ||
150 | [email protected] | ||
151 | [email protected] "(" | ||
152 | [email protected] ")" | ||
153 | [email protected] "\n" | ||
154 | [email protected] | ||
155 | [email protected] "where" | ||
156 | [email protected] "\n " | ||
157 | [email protected] | ||
158 | [email protected] "for" | ||
159 | [email protected] | ||
160 | [email protected] "<" | ||
161 | [email protected] | ||
162 | [email protected] "\'a" | ||
163 | [email protected] ">" | ||
164 | [email protected] " " | ||
165 | [email protected] | ||
166 | [email protected] "for" | ||
167 | [email protected] | ||
168 | [email protected] "<" | ||
169 | [email protected] | ||
170 | [email protected] "\'b" | ||
171 | [email protected] ">" | ||
172 | [email protected] " " | ||
173 | [email protected] | ||
174 | [email protected] "for" | ||
175 | [email protected] | ||
176 | [email protected] "<" | ||
177 | [email protected] | ||
178 | [email protected] "\'c" | ||
179 | [email protected] ">" | ||
180 | [email protected] " " | ||
181 | [email protected] | ||
182 | [email protected] "fn" | ||
183 | [email protected] | ||
184 | [email protected] "(" | ||
185 | [email protected] | ||
186 | [email protected] | ||
187 | [email protected] "&" | ||
188 | [email protected] "\'a" | ||
189 | [email protected] " " | ||
190 | [email protected] | ||
191 | [email protected] | ||
192 | [email protected] | ||
193 | [email protected] | ||
194 | [email protected] "T" | ||
195 | [email protected] "," | ||
196 | [email protected] " " | ||
197 | [email protected] | ||
198 | [email protected] | ||
199 | [email protected] "&" | ||
200 | [email protected] "\'b" | ||
201 | [email protected] " " | ||
202 | [email protected] | ||
203 | [email protected] | ||
204 | [email protected] | ||
205 | [email protected] | ||
206 | [email protected] "T" | ||
207 | [email protected] "," | ||
208 | [email protected] " " | ||
209 | [email protected] | ||
210 | [email protected] | ||
211 | [email protected] "&" | ||
212 | [email protected] "\'c" | ||
213 | [email protected] " " | ||
214 | [email protected] | ||
215 | [email protected] | ||
216 | [email protected] | ||
217 | [email protected] | ||
218 | [email protected] "T" | ||
219 | [email protected] ")" | ||
220 | [email protected] ":" | ||
221 | [email protected] " " | ||
222 | [email protected] | ||
223 | [email protected] | ||
224 | [email protected] | ||
225 | [email protected] | ||
226 | [email protected] | ||
227 | [email protected] | ||
228 | [email protected] "Copy" | ||
229 | [email protected] "," | ||
230 | [email protected] "\n" | ||
231 | [email protected] | ||
232 | [email protected] "{" | ||
233 | [email protected] "\n" | ||
234 | [email protected] "}" | ||
235 | [email protected] "\n" | ||
236 | error 21..21: expected a function pointer or path | ||
237 | error 52..52: expected a function pointer or path | ||
238 | error 88..88: expected a function pointer or path | ||
239 | error 119..119: expected a function pointer or path | ||
240 | error 195..195: expected a function pointer or path | ||
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs new file mode 100644 index 000000000..0e9f8ccb4 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | type ForRef = for<'a> &'a u32; | ||
2 | type ForTup = for<'a> (&'a u32,); | ||
3 | type ForSlice = for<'a> [u32]; | ||
4 | type ForForFn = for<'a> for<'b> fn(&'a i32, &'b i32); | ||
5 | fn for_for_for<T>() | ||
6 | where | ||
7 | for<'a> for<'b> for<'c> fn(&'a T, &'b T, &'c T): Copy, | ||
8 | { | ||
9 | } | ||
diff --git a/crates/syntax/test_data/parser/err/0045_item_modifiers.rast b/crates/syntax/test_data/parser/err/0045_item_modifiers.rast new file mode 100644 index 000000000..a6e6552a9 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0045_item_modifiers.rast | |||
@@ -0,0 +1,45 @@ | |||
1 | [email protected] | ||
2 | [email protected] | ||
3 | [email protected] "unsafe" | ||
4 | [email protected] " " | ||
5 | [email protected] | ||
6 | [email protected] "async" | ||
7 | [email protected] " " | ||
8 | [email protected] "fn" | ||
9 | [email protected] " " | ||
10 | [email protected] | ||
11 | [email protected] "foo" | ||
12 | [email protected] | ||
13 | [email protected] "(" | ||
14 | [email protected] ")" | ||
15 | [email protected] " " | ||
16 | [email protected] | ||
17 | [email protected] "{" | ||
18 | [email protected] "}" | ||
19 | [email protected] "\n" | ||
20 | [email protected] | ||
21 | [email protected] "unsafe" | ||
22 | [email protected] " " | ||
23 | [email protected] "const" | ||
24 | [email protected] " " | ||
25 | [email protected] | ||
26 | [email protected] "fn" | ||
27 | [email protected] " " | ||
28 | [email protected] | ||
29 | [email protected] | ||
30 | [email protected] | ||
31 | [email protected] | ||
32 | [email protected] "bar" | ||
33 | [email protected] | ||
34 | [email protected] "(" | ||
35 | [email protected] ")" | ||
36 | [email protected] " " | ||
37 | [email protected] | ||
38 | [email protected] "{" | ||
39 | [email protected] "}" | ||
40 | [email protected] "\n" | ||
41 | error 6..6: expected existential, fn, trait or impl | ||
42 | error 38..38: expected a name | ||
43 | error 40..40: expected COLON | ||
44 | error 46..46: expected SEMICOLON | ||
45 | error 47..47: expected an item | ||
diff --git a/crates/syntax/test_data/parser/err/0045_item_modifiers.rs b/crates/syntax/test_data/parser/err/0045_item_modifiers.rs new file mode 100644 index 000000000..731e58013 --- /dev/null +++ b/crates/syntax/test_data/parser/err/0045_item_modifiers.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | unsafe async fn foo() {} | ||
2 | unsafe const fn bar() {} | ||