From f73a6419d43b21d07b7ee5d3804bdd586ee8036f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Aug 2020 14:26:36 +0200 Subject: Allow default everywhere closes #5681 --- .../test_data/parser/err/0043_default_const.rast | 40 ---- .../test_data/parser/err/0043_default_const.rs | 3 - .../parser/inline/err/0014_default_fn_type.rast | 58 ------ .../parser/inline/err/0014_default_fn_type.rs | 4 - .../parser/inline/ok/0132_default_fn_type.rast | 55 ------ .../parser/inline/ok/0132_default_fn_type.rs | 4 - .../parser/inline/ok/0163_default_unsafe_fn.rast | 40 ---- .../parser/inline/ok/0163_default_unsafe_fn.rs | 3 - .../parser/inline/ok/0163_default_unsafe_impl.rast | 18 -- .../parser/inline/ok/0163_default_unsafe_impl.rs | 1 - .../parser/inline/ok/0163_default_unsafe_item.rast | 44 +++++ .../parser/inline/ok/0163_default_unsafe_item.rs | 3 + .../parser/inline/ok/0164_default_item.rast | 24 +++ .../parser/inline/ok/0164_default_item.rs | 1 + .../test_data/parser/ok/0066_default_const.rast | 44 ----- .../test_data/parser/ok/0066_default_const.rs | 3 - .../test_data/parser/ok/0066_default_modifier.rast | 218 +++++++++++++++++++++ .../test_data/parser/ok/0066_default_modifier.rs | 16 ++ 18 files changed, 306 insertions(+), 273 deletions(-) delete mode 100644 crates/ra_syntax/test_data/parser/err/0043_default_const.rast delete mode 100644 crates/ra_syntax/test_data/parser/err/0043_default_const.rs delete mode 100644 crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rs delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rs delete mode 100644 crates/ra_syntax/test_data/parser/ok/0066_default_const.rast delete mode 100644 crates/ra_syntax/test_data/parser/ok/0066_default_const.rs create mode 100644 crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rast create mode 100644 crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rs (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast b/crates/ra_syntax/test_data/parser/err/0043_default_const.rast deleted file mode 100644 index 51ad2a846..000000000 --- a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast +++ /dev/null @@ -1,40 +0,0 @@ -SOURCE_FILE@0..39 - TRAIT@0..38 - TRAIT_KW@0..5 "trait" - WHITESPACE@5..6 " " - NAME@6..7 - IDENT@6..7 "T" - WHITESPACE@7..8 " " - ASSOC_ITEM_LIST@8..38 - L_CURLY@8..9 "{" - WHITESPACE@9..12 "\n " - MACRO_CALL@12..19 - PATH@12..19 - PATH_SEGMENT@12..19 - NAME_REF@12..19 - IDENT@12..19 "default" - WHITESPACE@19..20 " " - CONST@20..36 - CONST_KW@20..25 "const" - WHITESPACE@25..26 " " - NAME@26..27 - IDENT@26..27 "f" - COLON@27..28 ":" - WHITESPACE@28..29 " " - PATH_TYPE@29..31 - PATH@29..31 - PATH_SEGMENT@29..31 - NAME_REF@29..31 - IDENT@29..31 "u8" - WHITESPACE@31..32 " " - EQ@32..33 "=" - WHITESPACE@33..34 " " - LITERAL@34..35 - INT_NUMBER@34..35 "0" - SEMICOLON@35..36 ";" - WHITESPACE@36..37 "\n" - R_CURLY@37..38 "}" - WHITESPACE@38..39 "\n" -error 19..19: expected BANG -error 19..19: expected `{`, `[`, `(` -error 19..19: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0043_default_const.rs b/crates/ra_syntax/test_data/parser/err/0043_default_const.rs deleted file mode 100644 index 80f15474a..000000000 --- a/crates/ra_syntax/test_data/parser/err/0043_default_const.rs +++ /dev/null @@ -1,3 +0,0 @@ -trait T { - default const f: u8 = 0; -} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast deleted file mode 100644 index acd72094b..000000000 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast +++ /dev/null @@ -1,58 +0,0 @@ -SOURCE_FILE@0..62 - TRAIT@0..61 - TRAIT_KW@0..5 "trait" - WHITESPACE@5..6 " " - NAME@6..7 - IDENT@6..7 "T" - WHITESPACE@7..8 " " - ASSOC_ITEM_LIST@8..61 - L_CURLY@8..9 "{" - WHITESPACE@9..14 "\n " - MACRO_CALL@14..21 - PATH@14..21 - PATH_SEGMENT@14..21 - NAME_REF@14..21 - IDENT@14..21 "default" - WHITESPACE@21..22 " " - TYPE_ALIAS@22..35 - TYPE_KW@22..26 "type" - WHITESPACE@26..27 " " - NAME@27..28 - IDENT@27..28 "T" - WHITESPACE@28..29 " " - EQ@29..30 "=" - WHITESPACE@30..31 " " - PATH_TYPE@31..34 - PATH@31..34 - PATH_SEGMENT@31..34 - NAME_REF@31..34 - IDENT@31..34 "Bar" - SEMICOLON@34..35 ";" - WHITESPACE@35..40 "\n " - MACRO_CALL@40..47 - PATH@40..47 - PATH_SEGMENT@40..47 - NAME_REF@40..47 - IDENT@40..47 "default" - WHITESPACE@47..48 " " - FN@48..59 - FN_KW@48..50 "fn" - WHITESPACE@50..51 " " - NAME@51..54 - IDENT@51..54 "foo" - PARAM_LIST@54..56 - L_PAREN@54..55 "(" - R_PAREN@55..56 ")" - WHITESPACE@56..57 " " - BLOCK_EXPR@57..59 - L_CURLY@57..58 "{" - R_CURLY@58..59 "}" - WHITESPACE@59..60 "\n" - R_CURLY@60..61 "}" - WHITESPACE@61..62 "\n" -error 21..21: expected BANG -error 21..21: expected `{`, `[`, `(` -error 21..21: expected SEMICOLON -error 47..47: expected BANG -error 47..47: expected `{`, `[`, `(` -error 47..47: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs deleted file mode 100644 index 15ba8f4a8..000000000 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs +++ /dev/null @@ -1,4 +0,0 @@ -trait T { - default type T = Bar; - default fn foo() {} -} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast deleted file mode 100644 index b8d26a53a..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast +++ /dev/null @@ -1,55 +0,0 @@ -SOURCE_FILE@0..69 - IMPL@0..68 - IMPL_KW@0..4 "impl" - WHITESPACE@4..5 " " - PATH_TYPE@5..6 - PATH@5..6 - PATH_SEGMENT@5..6 - NAME_REF@5..6 - IDENT@5..6 "T" - WHITESPACE@6..7 " " - FOR_KW@7..10 "for" - WHITESPACE@10..11 " " - PATH_TYPE@11..14 - PATH@11..14 - PATH_SEGMENT@11..14 - NAME_REF@11..14 - IDENT@11..14 "Foo" - WHITESPACE@14..15 " " - ASSOC_ITEM_LIST@15..68 - L_CURLY@15..16 "{" - WHITESPACE@16..21 "\n " - TYPE_ALIAS@21..42 - DEFAULT_KW@21..28 "default" - WHITESPACE@28..29 " " - TYPE_KW@29..33 "type" - WHITESPACE@33..34 " " - NAME@34..35 - IDENT@34..35 "T" - WHITESPACE@35..36 " " - EQ@36..37 "=" - WHITESPACE@37..38 " " - PATH_TYPE@38..41 - PATH@38..41 - PATH_SEGMENT@38..41 - NAME_REF@38..41 - IDENT@38..41 "Bar" - SEMICOLON@41..42 ";" - WHITESPACE@42..47 "\n " - FN@47..66 - DEFAULT_KW@47..54 "default" - WHITESPACE@54..55 " " - FN_KW@55..57 "fn" - WHITESPACE@57..58 " " - NAME@58..61 - IDENT@58..61 "foo" - PARAM_LIST@61..63 - L_PAREN@61..62 "(" - R_PAREN@62..63 ")" - WHITESPACE@63..64 " " - BLOCK_EXPR@64..66 - L_CURLY@64..65 "{" - R_CURLY@65..66 "}" - WHITESPACE@66..67 "\n" - R_CURLY@67..68 "}" - WHITESPACE@68..69 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rs b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rs deleted file mode 100644 index 8f5d61113..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rs +++ /dev/null @@ -1,4 +0,0 @@ -impl T for Foo { - default type T = Bar; - default fn foo() {} -} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast deleted file mode 100644 index 1269621dc..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast +++ /dev/null @@ -1,40 +0,0 @@ -SOURCE_FILE@0..50 - IMPL@0..49 - IMPL_KW@0..4 "impl" - WHITESPACE@4..5 " " - PATH_TYPE@5..6 - PATH@5..6 - PATH_SEGMENT@5..6 - NAME_REF@5..6 - IDENT@5..6 "T" - WHITESPACE@6..7 " " - FOR_KW@7..10 "for" - WHITESPACE@10..11 " " - PATH_TYPE@11..14 - PATH@11..14 - PATH_SEGMENT@11..14 - NAME_REF@11..14 - IDENT@11..14 "Foo" - WHITESPACE@14..15 " " - ASSOC_ITEM_LIST@15..49 - L_CURLY@15..16 "{" - WHITESPACE@16..21 "\n " - FN@21..47 - DEFAULT_KW@21..28 "default" - WHITESPACE@28..29 " " - UNSAFE_KW@29..35 "unsafe" - WHITESPACE@35..36 " " - FN_KW@36..38 "fn" - WHITESPACE@38..39 " " - NAME@39..42 - IDENT@39..42 "foo" - PARAM_LIST@42..44 - L_PAREN@42..43 "(" - R_PAREN@43..44 ")" - WHITESPACE@44..45 " " - BLOCK_EXPR@45..47 - L_CURLY@45..46 "{" - R_CURLY@46..47 "}" - WHITESPACE@47..48 "\n" - R_CURLY@48..49 "}" - WHITESPACE@49..50 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs deleted file mode 100644 index 12926cd8a..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs +++ /dev/null @@ -1,3 +0,0 @@ -impl T for Foo { - default unsafe fn foo() {} -} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast deleted file mode 100644 index 6bfe925af..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast +++ /dev/null @@ -1,18 +0,0 @@ -SOURCE_FILE@0..27 - IMPL@0..26 - DEFAULT_KW@0..7 "default" - WHITESPACE@7..8 " " - UNSAFE_KW@8..14 "unsafe" - WHITESPACE@14..15 " " - IMPL_KW@15..19 "impl" - WHITESPACE@19..20 " " - PATH_TYPE@20..23 - PATH@20..23 - PATH_SEGMENT@20..23 - NAME_REF@20..23 - IDENT@20..23 "Foo" - WHITESPACE@23..24 " " - ASSOC_ITEM_LIST@24..26 - L_CURLY@24..25 "{" - R_CURLY@25..26 "}" - WHITESPACE@26..27 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs deleted file mode 100644 index ba0998ff4..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs +++ /dev/null @@ -1 +0,0 @@ -default unsafe impl Foo {} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast new file mode 100644 index 000000000..f2e201460 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rast @@ -0,0 +1,44 @@ +SOURCE_FILE@0..65 + IMPL@0..64 + DEFAULT_KW@0..7 "default" + WHITESPACE@7..8 " " + UNSAFE_KW@8..14 "unsafe" + WHITESPACE@14..15 " " + IMPL_KW@15..19 "impl" + WHITESPACE@19..20 " " + PATH_TYPE@20..21 + PATH@20..21 + PATH_SEGMENT@20..21 + NAME_REF@20..21 + IDENT@20..21 "T" + WHITESPACE@21..22 " " + FOR_KW@22..25 "for" + WHITESPACE@25..26 " " + PATH_TYPE@26..29 + PATH@26..29 + PATH_SEGMENT@26..29 + NAME_REF@26..29 + IDENT@26..29 "Foo" + WHITESPACE@29..30 " " + ASSOC_ITEM_LIST@30..64 + L_CURLY@30..31 "{" + WHITESPACE@31..36 "\n " + FN@36..62 + DEFAULT_KW@36..43 "default" + WHITESPACE@43..44 " " + UNSAFE_KW@44..50 "unsafe" + WHITESPACE@50..51 " " + FN_KW@51..53 "fn" + WHITESPACE@53..54 " " + NAME@54..57 + IDENT@54..57 "foo" + PARAM_LIST@57..59 + L_PAREN@57..58 "(" + R_PAREN@58..59 ")" + WHITESPACE@59..60 " " + BLOCK_EXPR@60..62 + L_CURLY@60..61 "{" + R_CURLY@61..62 "}" + WHITESPACE@62..63 "\n" + R_CURLY@63..64 "}" + WHITESPACE@64..65 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs new file mode 100644 index 000000000..96340f84a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_item.rs @@ -0,0 +1,3 @@ +default unsafe impl T for Foo { + default unsafe fn foo() {} +} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rast new file mode 100644 index 000000000..9282772f3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rast @@ -0,0 +1,24 @@ +SOURCE_FILE@0..26 + IMPL@0..25 + DEFAULT_KW@0..7 "default" + WHITESPACE@7..8 " " + IMPL_KW@8..12 "impl" + WHITESPACE@12..13 " " + PATH_TYPE@13..14 + PATH@13..14 + PATH_SEGMENT@13..14 + NAME_REF@13..14 + IDENT@13..14 "T" + WHITESPACE@14..15 " " + FOR_KW@15..18 "for" + WHITESPACE@18..19 " " + PATH_TYPE@19..22 + PATH@19..22 + PATH_SEGMENT@19..22 + NAME_REF@19..22 + IDENT@19..22 "Foo" + WHITESPACE@22..23 " " + ASSOC_ITEM_LIST@23..25 + L_CURLY@23..24 "{" + R_CURLY@24..25 "}" + WHITESPACE@25..26 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rs b/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rs new file mode 100644 index 000000000..a6836cbd5 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_default_item.rs @@ -0,0 +1 @@ +default impl T for Foo {} diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast deleted file mode 100644 index 6246a31a6..000000000 --- a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast +++ /dev/null @@ -1,44 +0,0 @@ -SOURCE_FILE@0..46 - IMPL@0..45 - IMPL_KW@0..4 "impl" - WHITESPACE@4..5 " " - PATH_TYPE@5..6 - PATH@5..6 - PATH_SEGMENT@5..6 - NAME_REF@5..6 - IDENT@5..6 "T" - WHITESPACE@6..7 " " - FOR_KW@7..10 "for" - WHITESPACE@10..11 " " - PATH_TYPE@11..14 - PATH@11..14 - PATH_SEGMENT@11..14 - NAME_REF@11..14 - IDENT@11..14 "Foo" - WHITESPACE@14..15 " " - ASSOC_ITEM_LIST@15..45 - L_CURLY@15..16 "{" - WHITESPACE@16..19 "\n " - CONST@19..43 - DEFAULT_KW@19..26 "default" - WHITESPACE@26..27 " " - CONST_KW@27..32 "const" - WHITESPACE@32..33 " " - NAME@33..34 - IDENT@33..34 "f" - COLON@34..35 ":" - WHITESPACE@35..36 " " - PATH_TYPE@36..38 - PATH@36..38 - PATH_SEGMENT@36..38 - NAME_REF@36..38 - IDENT@36..38 "u8" - WHITESPACE@38..39 " " - EQ@39..40 "=" - WHITESPACE@40..41 " " - LITERAL@41..42 - INT_NUMBER@41..42 "0" - SEMICOLON@42..43 ";" - WHITESPACE@43..44 "\n" - R_CURLY@44..45 "}" - WHITESPACE@45..46 "\n" diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rs b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rs deleted file mode 100644 index dfb3b92dc..000000000 --- a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rs +++ /dev/null @@ -1,3 +0,0 @@ -impl T for Foo { - default const f: u8 = 0; -} diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rast b/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rast new file mode 100644 index 000000000..e9b57ec3b --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rast @@ -0,0 +1,218 @@ +SOURCE_FILE@0..294 + TRAIT@0..113 + TRAIT_KW@0..5 "trait" + WHITESPACE@5..6 " " + NAME@6..7 + IDENT@6..7 "T" + WHITESPACE@7..8 " " + ASSOC_ITEM_LIST@8..113 + L_CURLY@8..9 "{" + WHITESPACE@9..12 "\n " + TYPE_ALIAS@12..33 + DEFAULT_KW@12..19 "default" + WHITESPACE@19..20 " " + TYPE_KW@20..24 "type" + WHITESPACE@24..25 " " + NAME@25..26 + IDENT@25..26 "T" + WHITESPACE@26..27 " " + EQ@27..28 "=" + WHITESPACE@28..29 " " + PATH_TYPE@29..32 + PATH@29..32 + PATH_SEGMENT@29..32 + NAME_REF@29..32 + IDENT@29..32 "Bar" + SEMICOLON@32..33 ";" + WHITESPACE@33..36 "\n " + CONST@36..60 + DEFAULT_KW@36..43 "default" + WHITESPACE@43..44 " " + CONST_KW@44..49 "const" + WHITESPACE@49..50 " " + NAME@50..51 + IDENT@50..51 "f" + COLON@51..52 ":" + WHITESPACE@52..53 " " + PATH_TYPE@53..55 + PATH@53..55 + PATH_SEGMENT@53..55 + NAME_REF@53..55 + IDENT@53..55 "u8" + WHITESPACE@55..56 " " + EQ@56..57 "=" + WHITESPACE@57..58 " " + LITERAL@58..59 + INT_NUMBER@58..59 "0" + SEMICOLON@59..60 ";" + WHITESPACE@60..63 "\n " + FN@63..82 + DEFAULT_KW@63..70 "default" + WHITESPACE@70..71 " " + FN_KW@71..73 "fn" + WHITESPACE@73..74 " " + NAME@74..77 + IDENT@74..77 "foo" + PARAM_LIST@77..79 + L_PAREN@77..78 "(" + R_PAREN@78..79 ")" + WHITESPACE@79..80 " " + BLOCK_EXPR@80..82 + L_CURLY@80..81 "{" + R_CURLY@81..82 "}" + WHITESPACE@82..85 "\n " + FN@85..111 + DEFAULT_KW@85..92 "default" + WHITESPACE@92..93 " " + UNSAFE_KW@93..99 "unsafe" + WHITESPACE@99..100 " " + FN_KW@100..102 "fn" + WHITESPACE@102..103 " " + NAME@103..106 + IDENT@103..106 "bar" + PARAM_LIST@106..108 + L_PAREN@106..107 "(" + R_PAREN@107..108 ")" + WHITESPACE@108..109 " " + BLOCK_EXPR@109..111 + L_CURLY@109..110 "{" + R_CURLY@110..111 "}" + WHITESPACE@111..112 "\n" + R_CURLY@112..113 "}" + WHITESPACE@113..115 "\n\n" + IMPL@115..235 + IMPL_KW@115..119 "impl" + WHITESPACE@119..120 " " + PATH_TYPE@120..121 + PATH@120..121 + PATH_SEGMENT@120..121 + NAME_REF@120..121 + IDENT@120..121 "T" + WHITESPACE@121..122 " " + FOR_KW@122..125 "for" + WHITESPACE@125..126 " " + PATH_TYPE@126..129 + PATH@126..129 + PATH_SEGMENT@126..129 + NAME_REF@126..129 + IDENT@126..129 "Foo" + WHITESPACE@129..130 " " + ASSOC_ITEM_LIST@130..235 + L_CURLY@130..131 "{" + WHITESPACE@131..134 "\n " + TYPE_ALIAS@134..155 + DEFAULT_KW@134..141 "default" + WHITESPACE@141..142 " " + TYPE_KW@142..146 "type" + WHITESPACE@146..147 " " + NAME@147..148 + IDENT@147..148 "T" + WHITESPACE@148..149 " " + EQ@149..150 "=" + WHITESPACE@150..151 " " + PATH_TYPE@151..154 + PATH@151..154 + PATH_SEGMENT@151..154 + NAME_REF@151..154 + IDENT@151..154 "Bar" + SEMICOLON@154..155 ";" + WHITESPACE@155..158 "\n " + CONST@158..182 + DEFAULT_KW@158..165 "default" + WHITESPACE@165..166 " " + CONST_KW@166..171 "const" + WHITESPACE@171..172 " " + NAME@172..173 + IDENT@172..173 "f" + COLON@173..174 ":" + WHITESPACE@174..175 " " + PATH_TYPE@175..177 + PATH@175..177 + PATH_SEGMENT@175..177 + NAME_REF@175..177 + IDENT@175..177 "u8" + WHITESPACE@177..178 " " + EQ@178..179 "=" + WHITESPACE@179..180 " " + LITERAL@180..181 + INT_NUMBER@180..181 "0" + SEMICOLON@181..182 ";" + WHITESPACE@182..185 "\n " + FN@185..204 + DEFAULT_KW@185..192 "default" + WHITESPACE@192..193 " " + FN_KW@193..195 "fn" + WHITESPACE@195..196 " " + NAME@196..199 + IDENT@196..199 "foo" + PARAM_LIST@199..201 + L_PAREN@199..200 "(" + R_PAREN@200..201 ")" + WHITESPACE@201..202 " " + BLOCK_EXPR@202..204 + L_CURLY@202..203 "{" + R_CURLY@203..204 "}" + WHITESPACE@204..207 "\n " + FN@207..233 + DEFAULT_KW@207..214 "default" + WHITESPACE@214..215 " " + UNSAFE_KW@215..221 "unsafe" + WHITESPACE@221..222 " " + FN_KW@222..224 "fn" + WHITESPACE@224..225 " " + NAME@225..228 + IDENT@225..228 "bar" + PARAM_LIST@228..230 + L_PAREN@228..229 "(" + R_PAREN@229..230 ")" + WHITESPACE@230..231 " " + BLOCK_EXPR@231..233 + L_CURLY@231..232 "{" + R_CURLY@232..233 "}" + WHITESPACE@233..234 "\n" + R_CURLY@234..235 "}" + WHITESPACE@235..237 "\n\n" + IMPL@237..261 + DEFAULT_KW@237..244 "default" + WHITESPACE@244..245 " " + IMPL_KW@245..249 "impl" + WHITESPACE@249..250 " " + PATH_TYPE@250..251 + PATH@250..251 + PATH_SEGMENT@250..251 + NAME_REF@250..251 + IDENT@250..251 "T" + WHITESPACE@251..252 " " + FOR_KW@252..255 "for" + WHITESPACE@255..256 " " + TUPLE_TYPE@256..258 + L_PAREN@256..257 "(" + R_PAREN@257..258 ")" + WHITESPACE@258..259 " " + ASSOC_ITEM_LIST@259..261 + L_CURLY@259..260 "{" + R_CURLY@260..261 "}" + WHITESPACE@261..262 "\n" + IMPL@262..293 + DEFAULT_KW@262..269 "default" + WHITESPACE@269..270 " " + UNSAFE_KW@270..276 "unsafe" + WHITESPACE@276..277 " " + IMPL_KW@277..281 "impl" + WHITESPACE@281..282 " " + PATH_TYPE@282..283 + PATH@282..283 + PATH_SEGMENT@282..283 + NAME_REF@282..283 + IDENT@282..283 "T" + WHITESPACE@283..284 " " + FOR_KW@284..287 "for" + WHITESPACE@287..288 " " + TUPLE_TYPE@288..290 + L_PAREN@288..289 "(" + R_PAREN@289..290 ")" + WHITESPACE@290..291 " " + ASSOC_ITEM_LIST@291..293 + L_CURLY@291..292 "{" + R_CURLY@292..293 "}" + WHITESPACE@293..294 "\n" diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rs b/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rs new file mode 100644 index 000000000..e443e3495 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/ok/0066_default_modifier.rs @@ -0,0 +1,16 @@ +trait T { + default type T = Bar; + default const f: u8 = 0; + default fn foo() {} + default unsafe fn bar() {} +} + +impl T for Foo { + default type T = Bar; + default const f: u8 = 0; + default fn foo() {} + default unsafe fn bar() {} +} + +default impl T for () {} +default unsafe impl T for () {} -- cgit v1.2.3