diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-10-02 22:41:24 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2015-10-13 15:19:20 +0300 |
| commit | 8a12c19171887ea6d7ff708db2e2581ceaf16c14 (patch) | |
| tree | 2ff02dad84730da28dc96d487d96a442350ee320 /src/libsyntax/parse/parser.rs | |
| parent | beda1f88a7d87cf994fe8e3a5b2fe126e31fcae9 (diff) | |
| download | rust-8a12c19171887ea6d7ff708db2e2581ceaf16c14.tar.gz rust-8a12c19171887ea6d7ff708db2e2581ceaf16c14.zip | |
Test and gate empty structures and variants better
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 09ca20653ed..47632781956 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4658,7 +4658,7 @@ impl<'a> Parser<'a> { (fields, VariantKind::Dict) // Tuple-style struct definition with optional where-clause. } else if self.token == token::OpenDelim(token::Paren) { - let fields = try!(self.parse_tuple_struct_body(class_name, &mut generics)); + let fields = try!(self.parse_tuple_struct_body(&mut generics)); (fields, VariantKind::Tuple) } else { let token_str = self.this_token_to_string(); @@ -4694,7 +4694,6 @@ impl<'a> Parser<'a> { } pub fn parse_tuple_struct_body(&mut self, - class_name: ast::Ident, generics: &mut ast::Generics) -> PResult<Vec<StructField>> { // This is the case where we find `struct Foo<T>(T) where T: Copy;` @@ -4715,12 +4714,6 @@ impl<'a> Parser<'a> { Ok(spanned(lo, p.span.hi, struct_field_)) })); - if fields.is_empty() { - return Err(self.fatal(&format!("unit-like struct definition should be \ - written as `struct {};`", - class_name))); - } - generics.where_clause = try!(self.parse_where_clause()); try!(self.expect(&token::Semi)); Ok(fields) |
