diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/grammar/items/traits.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/grammar/items/traits.rs index 25b6cb66b..62ab877fc 100644 --- a/crates/ra_syntax/src/grammar/items/traits.rs +++ b/crates/ra_syntax/src/grammar/items/traits.rs | |||
@@ -54,16 +54,8 @@ pub(super) fn impl_item(p: &mut Parser) { | |||
54 | 54 | ||
55 | // test impl_item_neg | 55 | // test impl_item_neg |
56 | // impl !Send for X {} | 56 | // impl !Send for X {} |
57 | if p.at(IMPL_KW) { | 57 | p.eat(EXCL); |
58 | p.error("expected type"); | 58 | impl_type(p); |
59 | } else { | ||
60 | p.eat(EXCL); | ||
61 | if p.at(IMPL_KW) { | ||
62 | p.error("expected type"); | ||
63 | } else { | ||
64 | types::type_(p); | ||
65 | } | ||
66 | } | ||
67 | if p.eat(FOR_KW) { | 59 | if p.eat(FOR_KW) { |
68 | types::type_(p); | 60 | types::type_(p); |
69 | } | 61 | } |
@@ -123,3 +115,17 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool { | |||
123 | (p.nth(1) == LIFETIME || p.nth(1) == IDENT) | 115 | (p.nth(1) == LIFETIME || p.nth(1) == IDENT) |
124 | && (p.nth(2) == R_ANGLE || p.nth(2) == COMMA || p.nth(2) == COLON || p.nth(2) == EQ) | 116 | && (p.nth(2) == R_ANGLE || p.nth(2) == COMMA || p.nth(2) == COLON || p.nth(2) == EQ) |
125 | } | 117 | } |
118 | |||
119 | // impl Type {} | ||
120 | // ^^^^ | ||
121 | // impl Trait for T {} | ||
122 | // ^^^^^ | ||
123 | pub(crate) fn impl_type(p: &mut Parser) { | ||
124 | if p.at(IMPL_KW) { | ||
125 | p.error("expected trait or type"); | ||
126 | return; | ||
127 | } | ||
128 | types::type_(p); | ||
129 | } | ||
130 | |||
131 | |||