From a1c187eef3ba08076aedb5154929f7eda8d1b424 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 18:26:51 +0200 Subject: Rename ra_syntax -> syntax --- .../inline/err/0001_array_type_missing_semi.rast | 27 ++++++++ .../inline/err/0001_array_type_missing_semi.rs | 1 + .../inline/err/0002_misplaced_label_err.rast | 28 ++++++++ .../parser/inline/err/0002_misplaced_label_err.rs | 3 + .../err/0003_pointer_type_no_mutability.rast | 17 +++++ .../inline/err/0003_pointer_type_no_mutability.rs | 1 + .../parser/inline/err/0004_impl_type.rast | 79 ++++++++++++++++++++++ .../test_data/parser/inline/err/0004_impl_type.rs | 4 ++ .../err/0005_fn_pointer_type_missing_fn.rast | 23 +++++++ .../inline/err/0005_fn_pointer_type_missing_fn.rs | 1 + .../inline/err/0006_unsafe_block_in_mod.rast | 35 ++++++++++ .../parser/inline/err/0006_unsafe_block_in_mod.rs | 1 + .../inline/err/0007_async_without_semicolon.rast | 31 +++++++++ .../inline/err/0007_async_without_semicolon.rs | 1 + .../test_data/parser/inline/err/0008_pub_expr.rast | 25 +++++++ .../test_data/parser/inline/err/0008_pub_expr.rs | 1 + .../inline/err/0009_attr_on_expr_not_allowed.rast | 58 ++++++++++++++++ .../inline/err/0009_attr_on_expr_not_allowed.rs | 4 ++ .../inline/err/0010_bad_tuple_index_expr.rast | 52 ++++++++++++++ .../parser/inline/err/0010_bad_tuple_index_expr.rs | 5 ++ .../parser/inline/err/0013_static_underscore.rast | 21 ++++++ .../parser/inline/err/0013_static_underscore.rs | 1 + ...14_record_literal_before_ellipsis_recovery.rast | 48 +++++++++++++ ...0014_record_literal_before_ellipsis_recovery.rs | 3 + .../parser/inline/err/0015_empty_segment.rast | 15 ++++ .../parser/inline/err/0015_empty_segment.rs | 1 + 26 files changed, 486 insertions(+) create mode 100644 crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0004_impl_type.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0004_impl_type.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs create mode 100644 crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast create mode 100644 crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs (limited to 'crates/syntax/test_data/parser/inline/err') diff --git a/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast new file mode 100644 index 000000000..0b9bbec07 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast @@ -0,0 +1,27 @@ +SOURCE_FILE@0..18 + TYPE_ALIAS@0..12 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + SLICE_TYPE@9..12 + L_BRACK@9..10 "[" + TUPLE_TYPE@10..12 + L_PAREN@10..11 "(" + R_PAREN@11..12 ")" + WHITESPACE@12..13 " " + ERROR@13..15 + INT_NUMBER@13..15 "92" + ERROR@15..16 + R_BRACK@15..16 "]" + ERROR@16..17 + SEMICOLON@16..17 ";" + WHITESPACE@17..18 "\n" +error 12..12: expected `;` or `]` +error 12..12: expected SEMICOLON +error 13..13: expected an item +error 15..15: expected an item +error 16..16: expected an item diff --git a/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs new file mode 100644 index 000000000..a94851443 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs @@ -0,0 +1 @@ +type T = [() 92]; diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast new file mode 100644 index 000000000..a4271fc87 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast @@ -0,0 +1,28 @@ +SOURCE_FILE@0..30 + FN@0..29 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..7 + IDENT@3..7 "main" + PARAM_LIST@7..9 + L_PAREN@7..8 "(" + R_PAREN@8..9 ")" + WHITESPACE@9..10 " " + BLOCK_EXPR@10..29 + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + EXPR_STMT@16..22 + ERROR@16..22 + LABEL@16..22 + LIFETIME@16..21 "\'loop" + COLON@21..22 ":" + WHITESPACE@22..23 " " + IMPL@23..27 + IMPL_KW@23..27 "impl" + WHITESPACE@27..28 "\n" + R_CURLY@28..29 "}" + WHITESPACE@29..30 "\n" +error 22..22: expected a loop +error 22..22: expected SEMICOLON +error 27..27: expected type +error 27..27: expected `{` diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs new file mode 100644 index 000000000..a2164c510 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs @@ -0,0 +1,3 @@ +fn main() { + 'loop: impl +} diff --git a/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast new file mode 100644 index 000000000..0d8bf6dd6 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast @@ -0,0 +1,17 @@ +SOURCE_FILE@0..14 + TYPE_ALIAS@0..13 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PTR_TYPE@9..12 + STAR@9..10 "*" + TUPLE_TYPE@10..12 + L_PAREN@10..11 "(" + R_PAREN@11..12 ")" + SEMICOLON@12..13 ";" + WHITESPACE@13..14 "\n" +error 10..10: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) diff --git a/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs new file mode 100644 index 000000000..fae705131 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs @@ -0,0 +1 @@ +type T = *(); diff --git a/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast new file mode 100644 index 000000000..29d6b3974 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rast @@ -0,0 +1,79 @@ +SOURCE_FILE@0..87 + IMPL@0..12 + IMPL_KW@0..4 "impl" + WHITESPACE@4..5 " " + PATH_TYPE@5..9 + PATH@5..9 + PATH_SEGMENT@5..9 + NAME_REF@5..9 + IDENT@5..9 "Type" + WHITESPACE@9..10 " " + ASSOC_ITEM_LIST@10..12 + L_CURLY@10..11 "{" + R_CURLY@11..12 "}" + WHITESPACE@12..13 "\n" + IMPL@13..33 + IMPL_KW@13..17 "impl" + WHITESPACE@17..18 " " + PATH_TYPE@18..24 + PATH@18..24 + PATH_SEGMENT@18..24 + NAME_REF@18..24 + IDENT@18..24 "Trait1" + WHITESPACE@24..25 " " + FOR_KW@25..28 "for" + WHITESPACE@28..29 " " + PATH_TYPE@29..30 + PATH@29..30 + PATH_SEGMENT@29..30 + NAME_REF@29..30 + IDENT@29..30 "T" + WHITESPACE@30..31 " " + ASSOC_ITEM_LIST@31..33 + L_CURLY@31..32 "{" + R_CURLY@32..33 "}" + WHITESPACE@33..34 "\n" + IMPL@34..38 + IMPL_KW@34..38 "impl" + WHITESPACE@38..39 " " + IMPL@39..54 + IMPL_KW@39..43 "impl" + WHITESPACE@43..44 " " + PATH_TYPE@44..51 + PATH@44..51 + PATH_SEGMENT@44..51 + NAME_REF@44..51 + IDENT@44..51 "NotType" + WHITESPACE@51..52 " " + ASSOC_ITEM_LIST@52..54 + L_CURLY@52..53 "{" + R_CURLY@53..54 "}" + WHITESPACE@54..55 "\n" + IMPL@55..70 + IMPL_KW@55..59 "impl" + WHITESPACE@59..60 " " + PATH_TYPE@60..66 + PATH@60..66 + PATH_SEGMENT@60..66 + NAME_REF@60..66 + IDENT@60..66 "Trait2" + WHITESPACE@66..67 " " + FOR_KW@67..70 "for" + WHITESPACE@70..71 " " + IMPL@71..86 + IMPL_KW@71..75 "impl" + WHITESPACE@75..76 " " + PATH_TYPE@76..83 + PATH@76..83 + PATH_SEGMENT@76..83 + NAME_REF@76..83 + IDENT@76..83 "NotType" + WHITESPACE@83..84 " " + ASSOC_ITEM_LIST@84..86 + L_CURLY@84..85 "{" + R_CURLY@85..86 "}" + WHITESPACE@86..87 "\n" +error 38..38: expected trait or type +error 38..38: expected `{` +error 70..70: expected trait or type +error 70..70: expected `{` diff --git a/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs new file mode 100644 index 000000000..b8c7b65e3 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0004_impl_type.rs @@ -0,0 +1,4 @@ +impl Type {} +impl Trait1 for T {} +impl impl NotType {} +impl Trait2 for impl NotType {} diff --git a/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast new file mode 100644 index 000000000..776022fd9 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast @@ -0,0 +1,23 @@ +SOURCE_FILE@0..20 + TYPE_ALIAS@0..15 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "F" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + UNSAFE_KW@9..15 "unsafe" + WHITESPACE@15..16 " " + ERROR@16..17 + L_PAREN@16..17 "(" + ERROR@17..18 + R_PAREN@17..18 ")" + ERROR@18..19 + SEMICOLON@18..19 ";" + WHITESPACE@19..20 "\n" +error 15..15: expected `fn` +error 15..15: expected SEMICOLON +error 16..16: expected an item +error 17..17: expected an item +error 18..18: expected an item diff --git a/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs new file mode 100644 index 000000000..f014914ff --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs @@ -0,0 +1 @@ +type F = unsafe (); diff --git a/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast new file mode 100644 index 000000000..cc0f8bcaf --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast @@ -0,0 +1,35 @@ +SOURCE_FILE@0..33 + FN@0..10 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + BLOCK_EXPR@8..10 + L_CURLY@8..9 "{" + R_CURLY@9..10 "}" + WHITESPACE@10..11 " " + ERROR@11..17 + UNSAFE_KW@11..17 "unsafe" + WHITESPACE@17..18 " " + ERROR@18..21 + L_CURLY@18..19 "{" + WHITESPACE@19..20 " " + R_CURLY@20..21 "}" + WHITESPACE@21..22 " " + FN@22..32 + FN_KW@22..24 "fn" + WHITESPACE@24..25 " " + NAME@25..28 + IDENT@25..28 "bar" + PARAM_LIST@28..30 + L_PAREN@28..29 "(" + R_PAREN@29..30 ")" + BLOCK_EXPR@30..32 + L_CURLY@30..31 "{" + R_CURLY@31..32 "}" + WHITESPACE@32..33 "\n" +error 11..11: expected an item +error 18..18: expected an item diff --git a/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs new file mode 100644 index 000000000..26141e904 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs @@ -0,0 +1 @@ +fn foo(){} unsafe { } fn bar(){} diff --git a/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast new file mode 100644 index 000000000..2c9570678 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast @@ -0,0 +1,31 @@ +SOURCE_FILE@0..30 + FN@0..29 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..29 + L_CURLY@9..10 "{" + WHITESPACE@10..11 " " + LET_STMT@11..27 + LET_KW@11..14 "let" + WHITESPACE@14..15 " " + WILDCARD_PAT@15..16 + UNDERSCORE@15..16 "_" + WHITESPACE@16..17 " " + EQ@17..18 "=" + WHITESPACE@18..19 " " + EFFECT_EXPR@19..27 + ASYNC_KW@19..24 "async" + WHITESPACE@24..25 " " + BLOCK_EXPR@25..27 + L_CURLY@25..26 "{" + R_CURLY@26..27 "}" + WHITESPACE@27..28 " " + R_CURLY@28..29 "}" + WHITESPACE@29..30 "\n" +error 27..27: expected SEMICOLON diff --git a/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs new file mode 100644 index 000000000..9a423248c --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs @@ -0,0 +1 @@ +fn foo() { let _ = async {} } diff --git a/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast new file mode 100644 index 000000000..63a10127d --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rast @@ -0,0 +1,25 @@ +SOURCE_FILE@0..21 + FN@0..20 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..20 + L_CURLY@9..10 "{" + WHITESPACE@10..11 " " + ERROR@11..14 + VISIBILITY@11..14 + PUB_KW@11..14 "pub" + WHITESPACE@14..15 " " + EXPR_STMT@15..18 + LITERAL@15..17 + INT_NUMBER@15..17 "92" + SEMICOLON@17..18 ";" + WHITESPACE@18..19 " " + R_CURLY@19..20 "}" + WHITESPACE@20..21 "\n" +error 14..14: expected an item diff --git a/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs new file mode 100644 index 000000000..2976f6862 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0008_pub_expr.rs @@ -0,0 +1 @@ +fn foo() { pub 92; } diff --git a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast new file mode 100644 index 000000000..8fd8d5e59 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast @@ -0,0 +1,58 @@ +SOURCE_FILE@0..48 + FN@0..47 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..47 + L_CURLY@9..10 "{" + WHITESPACE@10..14 "\n " + EXPR_STMT@14..25 + ATTR@14..18 + POUND@14..15 "#" + L_BRACK@15..16 "[" + PATH@16..17 + PATH_SEGMENT@16..17 + NAME_REF@16..17 + IDENT@16..17 "A" + R_BRACK@17..18 "]" + WHITESPACE@18..19 " " + BIN_EXPR@19..24 + LITERAL@19..20 + INT_NUMBER@19..20 "1" + WHITESPACE@20..21 " " + PLUS@21..22 "+" + WHITESPACE@22..23 " " + LITERAL@23..24 + INT_NUMBER@23..24 "2" + SEMICOLON@24..25 ";" + WHITESPACE@25..29 "\n " + EXPR_STMT@29..45 + ATTR@29..33 + POUND@29..30 "#" + L_BRACK@30..31 "[" + PATH@31..32 + PATH_SEGMENT@31..32 + NAME_REF@31..32 + IDENT@31..32 "B" + R_BRACK@32..33 "]" + WHITESPACE@33..34 " " + IF_EXPR@34..44 + IF_KW@34..36 "if" + WHITESPACE@36..37 " " + CONDITION@37..41 + LITERAL@37..41 + TRUE_KW@37..41 "true" + WHITESPACE@41..42 " " + BLOCK_EXPR@42..44 + L_CURLY@42..43 "{" + R_CURLY@43..44 "}" + SEMICOLON@44..45 ";" + WHITESPACE@45..46 "\n" + R_CURLY@46..47 "}" + WHITESPACE@47..48 "\n" +error 24..24: attributes are not allowed on BIN_EXPR diff --git a/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs new file mode 100644 index 000000000..d725a07ce --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs @@ -0,0 +1,4 @@ +fn foo() { + #[A] 1 + 2; + #[B] if true {}; +} diff --git a/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast new file mode 100644 index 000000000..fa14e1e6d --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast @@ -0,0 +1,52 @@ +SOURCE_FILE@0..47 + FN@0..46 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..6 + IDENT@3..6 "foo" + PARAM_LIST@6..8 + L_PAREN@6..7 "(" + R_PAREN@7..8 ")" + WHITESPACE@8..9 " " + BLOCK_EXPR@9..46 + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + EXPR_STMT@15..20 + FIELD_EXPR@15..19 + PATH_EXPR@15..16 + PATH@15..16 + PATH_SEGMENT@15..16 + NAME_REF@15..16 + IDENT@15..16 "x" + DOT@16..17 "." + FLOAT_NUMBER@17..19 "0." + SEMICOLON@19..20 ";" + WHITESPACE@20..25 "\n " + EXPR_STMT@25..32 + FIELD_EXPR@25..31 + PATH_EXPR@25..26 + PATH@25..26 + PATH_SEGMENT@25..26 + NAME_REF@25..26 + IDENT@25..26 "x" + DOT@26..27 "." + NAME_REF@27..31 + INT_NUMBER@27..31 "1i32" + SEMICOLON@31..32 ";" + WHITESPACE@32..37 "\n " + EXPR_STMT@37..44 + FIELD_EXPR@37..43 + PATH_EXPR@37..38 + PATH@37..38 + PATH_SEGMENT@37..38 + NAME_REF@37..38 + IDENT@37..38 "x" + DOT@38..39 "." + NAME_REF@39..43 + INT_NUMBER@39..43 "0x01" + SEMICOLON@43..44 ";" + WHITESPACE@44..45 "\n" + R_CURLY@45..46 "}" + WHITESPACE@46..47 "\n" +error 27..31: Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix +error 39..43: Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix diff --git a/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs new file mode 100644 index 000000000..30cc49138 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs @@ -0,0 +1,5 @@ +fn foo() { + x.0.; + x.1i32; + x.0x01; +} diff --git a/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast new file mode 100644 index 000000000..8d761b907 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rast @@ -0,0 +1,21 @@ +SOURCE_FILE@0..19 + STATIC@0..18 + STATIC_KW@0..6 "static" + WHITESPACE@6..7 " " + ERROR@7..8 + UNDERSCORE@7..8 "_" + COLON@8..9 ":" + WHITESPACE@9..10 " " + PATH_TYPE@10..13 + PATH@10..13 + PATH_SEGMENT@10..13 + NAME_REF@10..13 + IDENT@10..13 "i32" + WHITESPACE@13..14 " " + EQ@14..15 "=" + WHITESPACE@15..16 " " + LITERAL@16..17 + INT_NUMBER@16..17 "5" + SEMICOLON@17..18 ";" + WHITESPACE@18..19 "\n" +error 7..7: expected a name diff --git a/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs new file mode 100644 index 000000000..df8cecb43 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0013_static_underscore.rs @@ -0,0 +1 @@ +static _: i32 = 5; diff --git a/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast new file mode 100644 index 000000000..a81c442c0 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast @@ -0,0 +1,48 @@ +SOURCE_FILE@0..45 + FN@0..44 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..7 + IDENT@3..7 "main" + PARAM_LIST@7..9 + L_PAREN@7..8 "(" + R_PAREN@8..9 ")" + WHITESPACE@9..10 " " + BLOCK_EXPR@10..44 + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + RECORD_EXPR@16..42 + PATH@16..17 + PATH_SEGMENT@16..17 + NAME_REF@16..17 + IDENT@16..17 "S" + WHITESPACE@17..18 " " + RECORD_EXPR_FIELD_LIST@18..42 + L_CURLY@18..19 "{" + WHITESPACE@19..20 " " + RECORD_EXPR_FIELD@20..40 + NAME_REF@20..25 + IDENT@20..25 "field" + WHITESPACE@25..26 " " + RANGE_EXPR@26..40 + DOT2@26..28 ".." + CALL_EXPR@28..40 + PATH_EXPR@28..38 + PATH@28..38 + PATH@28..29 + PATH_SEGMENT@28..29 + NAME_REF@28..29 + IDENT@28..29 "S" + COLON2@29..31 "::" + PATH_SEGMENT@31..38 + NAME_REF@31..38 + IDENT@31..38 "default" + ARG_LIST@38..40 + L_PAREN@38..39 "(" + R_PAREN@39..40 ")" + WHITESPACE@40..41 " " + R_CURLY@41..42 "}" + WHITESPACE@42..43 "\n" + R_CURLY@43..44 "}" + WHITESPACE@44..45 "\n" +error 25..25: expected COLON diff --git a/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs new file mode 100644 index 000000000..a4e5b2f69 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rs @@ -0,0 +1,3 @@ +fn main() { + S { field ..S::default() } +} diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast new file mode 100644 index 000000000..2f59d0606 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast @@ -0,0 +1,15 @@ +SOURCE_FILE@0..13 + USE@0..12 + USE_KW@0..3 "use" + WHITESPACE@3..4 " " + USE_TREE@4..12 + PATH@4..12 + PATH@4..9 + PATH_SEGMENT@4..9 + CRATE_KW@4..9 "crate" + COLON2@9..11 "::" + ERROR@11..12 + SEMICOLON@11..12 ";" + WHITESPACE@12..13 "\n" +error 11..11: expected identifier +error 12..12: expected SEMICOLON diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs new file mode 100644 index 000000000..7510664e1 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rs @@ -0,0 +1 @@ +use crate::; -- cgit v1.2.3 From ef462ed6af7ae8e0d30894baefe6ba1ff49aab8f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 18:28:23 +0200 Subject: Better recovery in `use foo::;` --- crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/syntax/test_data/parser/inline/err') diff --git a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast index 2f59d0606..e872526d9 100644 --- a/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast +++ b/crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast @@ -2,14 +2,12 @@ SOURCE_FILE@0..13 USE@0..12 USE_KW@0..3 "use" WHITESPACE@3..4 " " - USE_TREE@4..12 - PATH@4..12 + USE_TREE@4..11 + PATH@4..11 PATH@4..9 PATH_SEGMENT@4..9 CRATE_KW@4..9 "crate" COLON2@9..11 "::" - ERROR@11..12 - SEMICOLON@11..12 ";" + SEMICOLON@11..12 ";" WHITESPACE@12..13 "\n" error 11..11: expected identifier -error 12..12: expected SEMICOLON -- cgit v1.2.3