diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-09-19 12:09:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-24 14:12:02 -0700 |
| commit | 4b266f1c0df9732bbdea44b0df3d459d4cf2756d (patch) | |
| tree | 001f53c217538001b4dcc2b5388da2aafe7403b6 /src/libsyntax/parse | |
| parent | 4dacd736510b2ae28a54489fe88571f1a6de019f (diff) | |
| download | rust-4b266f1c0df9732bbdea44b0df3d459d4cf2756d.tar.gz rust-4b266f1c0df9732bbdea44b0df3d459d4cf2756d.zip | |
Stop accepting 'impl ...;', require {} instead
Progress on #7981
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
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()); |
