diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-10-22 17:57:10 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-10-23 10:45:23 -0700 |
| commit | 3bf0a9b0945f297d1aea330b6afcf98052e6de1e (patch) | |
| tree | 0908f3cc9095dbbc6b8aa508d3dac2c9b4a40afa /src/libsyntax/parse/parser.rs | |
| parent | 575950d12c38d79dcb2cac906f6664325d10ec9d (diff) | |
| download | rust-3bf0a9b0945f297d1aea330b6afcf98052e6de1e.tar.gz rust-3bf0a9b0945f297d1aea330b6afcf98052e6de1e.zip | |
rustc: Implement typechecking for simple monomorphic derivable traits on monomorphic types. r=brson
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 925da063ca6..672f86b7a10 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2603,13 +2603,20 @@ impl Parser { None }; - let mut meths = ~[]; - self.expect(token::LBRACE); - while !self.eat(token::RBRACE) { - let vis = self.parse_visibility(); - meths.push(self.parse_method(vis)); + let meths_opt; + if self.eat(token::SEMI) { + meths_opt = None; + } else { + let mut meths = ~[]; + self.expect(token::LBRACE); + while !self.eat(token::RBRACE) { + let vis = self.parse_visibility(); + meths.push(self.parse_method(vis)); + } + meths_opt = Some(move meths); } - (ident, item_impl(tps, opt_trait, ty, meths), None) + + (ident, item_impl(tps, opt_trait, ty, meths_opt), None) } // Instantiates ident <i> with references to <typarams> as arguments. |
