about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-24 15:45:57 -0700
committerbors <bors@rust-lang.org>2013-09-24 15:45:57 -0700
commita7d68adbdd75300a4a10b2dcc59e1048f613db48 (patch)
tree848fdb582c80f1e1fa4d62373bb139fa3799b722 /src/libsyntax/parse
parente3624ed968905b789b35c2301eb3c8057c05b3b3 (diff)
parent4b266f1c0df9732bbdea44b0df3d459d4cf2756d (diff)
downloadrust-a7d68adbdd75300a4a10b2dcc59e1048f613db48.tar.gz
rust-a7d68adbdd75300a4a10b2dcc59e1048f613db48.zip
auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphism
Progress on #7981

This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index b056b39eb6e..c2c08ce9360 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -65,6 +65,7 @@ pub enum ObsoleteSyntax {
     ObsoletePrivVisibility,
     ObsoleteTraitFuncVisibility,
     ObsoleteConstPointer,
+    ObsoleteEmptyImpl,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -256,6 +257,10 @@ impl ParserObsoleteMethods for Parser {
                 "instead of `&const Foo` or `@const Foo`, write `&Foo` or \
                  `@Foo`"
             ),
+            ObsoleteEmptyImpl => (
+                "empty implementation",
+                "instead of `impl A;`, write `impl A {}`"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 4aad5c24d0f..5a0ccac2cdb 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3852,7 +3852,9 @@ impl Parser {
         }
 
         let mut meths = ~[];
-        if !self.eat(&token::SEMI) {
+        if self.eat(&token::SEMI) {
+            self.obsolete(*self.span, ObsoleteEmptyImpl);
+        } else {
             self.expect(&token::LBRACE);
             while !self.eat(&token::RBRACE) {
                 meths.push(self.parse_method());