]> git.lizzy.rs Git - rust.git/commitdiff
Remove the obsolete handler for `impl A;`.
authorHuon Wilson <dbau.pp+github@gmail.com>
Fri, 31 Jan 2014 14:46:30 +0000 (01:46 +1100)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 1 Feb 2014 05:43:09 +0000 (21:43 -0800)
This is has been obsolete for quite a while now (including a release),
so removing the special handling seems fine. (The error message is quite
good still anyway.)

Fixes #9580.

src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs
src/test/compile-fail/empty-impl-semicolon.rs [new file with mode: 0644]

index 6aa1afee206ebe42f65eaffc1f5a89568205d818..c4887d55e2a29cf7b915c4b519d3f29c963e66c7 100644 (file)
@@ -36,7 +36,6 @@ pub enum ObsoleteSyntax {
     ObsoleteUnsafeExternFn,
     ObsoleteTraitFuncVisibility,
     ObsoleteConstPointer,
-    ObsoleteEmptyImpl,
     ObsoleteLoopAsContinue,
     ObsoleteEnumWildcard,
     ObsoleteStructWildcard,
@@ -110,10 +109,6 @@ fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
                 "instead of `&const Foo` or `@const Foo`, write `&Foo` or \
                  `@Foo`"
             ),
-            ObsoleteEmptyImpl => (
-                "empty implementation",
-                "instead of `impl A;`, write `impl A {}`"
-            ),
             ObsoleteLoopAsContinue => (
                 "`loop` instead of `continue`",
                 "`loop` is now only used for loops and `continue` is used for \
index 04a984ba95d92b7dc2fe9b102b3f5cc5490fc603..642624adfb2b5d1aaec8483515b3cfa90f102322 100644 (file)
@@ -3926,21 +3926,15 @@ fn parse_item_impl(&mut self) -> ItemInfo {
         };
 
         let mut meths = ~[];
-        let inner_attrs = if self.eat(&token::SEMI) {
-            self.obsolete(self.last_span, ObsoleteEmptyImpl);
-            None
-        } else {
-            self.expect(&token::LBRACE);
-            let (inner_attrs, next) = self.parse_inner_attrs_and_next();
-            let mut method_attrs = Some(next);
-            while !self.eat(&token::RBRACE) {
-                meths.push(self.parse_method(method_attrs));
-                method_attrs = None;
-            }
-            Some(inner_attrs)
-        };
+        self.expect(&token::LBRACE);
+        let (inner_attrs, next) = self.parse_inner_attrs_and_next();
+        let mut method_attrs = Some(next);
+        while !self.eat(&token::RBRACE) {
+            meths.push(self.parse_method(method_attrs));
+            method_attrs = None;
+        }
 
-        (ident, ItemImpl(generics, opt_trait, ty, meths), inner_attrs)
+        (ident, ItemImpl(generics, opt_trait, ty, meths), Some(inner_attrs))
     }
 
     // parse a::B<~str,int>
diff --git a/src/test/compile-fail/empty-impl-semicolon.rs b/src/test/compile-fail/empty-impl-semicolon.rs
new file mode 100644 (file)
index 0000000..1a8751c
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+impl Foo; //~ ERROR expected `{` but found `;`