]> git.lizzy.rs Git - rust.git/commitdiff
reject impl keyword in impl header
authorcsmoe <35686186+csmoe@users.noreply.github.com>
Mon, 24 Sep 2018 03:42:01 +0000 (11:42 +0800)
committercsmoe <35686186+csmoe@users.noreply.github.com>
Mon, 24 Sep 2018 03:44:43 +0000 (11:44 +0800)
crates/ra_syntax/src/grammar/items/traits.rs

index c21cfb1a9b4ea07c2995ab363f800ea1c232de19..25b6cb66b3d29e550ed43948cf9960b6c6dabebf 100644 (file)
@@ -54,8 +54,16 @@ pub(super) fn impl_item(p: &mut Parser) {
 
     // test impl_item_neg
     // impl !Send for X {}
-    p.eat(EXCL);
-    types::type_(p);
+    if p.at(IMPL_KW) {
+        p.error("expected type");
+    } else {
+        p.eat(EXCL);
+        if p.at(IMPL_KW) {
+            p.error("expected type");
+        } else {
+            types::type_(p);
+        }
+    }
     if p.eat(FOR_KW) {
         types::type_(p);
     }