@@ -2231,14 +2231,6 @@ impl<'a> Parser<'a> {
2231
2231
& [ token:: CloseDelim ( token:: Brace ) ] ) ) ;
2232
2232
}
2233
2233
2234
- if fields. is_empty ( ) && base. is_none ( ) {
2235
- let last_span = self . last_span ;
2236
- self . span_err ( last_span,
2237
- "structure literal must either \
2238
- have at least one field or use \
2239
- structure update syntax") ;
2240
- }
2241
-
2242
2234
hi = self . span . hi ;
2243
2235
try!( self . expect ( & token:: CloseDelim ( token:: Brace ) ) ) ;
2244
2236
ex = ExprStruct ( pth, fields, base) ;
@@ -4713,14 +4705,14 @@ impl<'a> Parser<'a> {
4713
4705
( Vec :: new ( ) , Some ( ast:: DUMMY_NODE_ID ) )
4714
4706
} else {
4715
4707
// If we see: `struct Foo<T> where T: Copy { ... }`
4716
- ( try!( self . parse_record_struct_body ( & class_name ) ) , None )
4708
+ ( try!( self . parse_record_struct_body ( ) ) , None )
4717
4709
}
4718
4710
// No `where` so: `struct Foo<T>;`
4719
4711
} else if try!( self . eat ( & token:: Semi ) ) {
4720
4712
( Vec :: new ( ) , Some ( ast:: DUMMY_NODE_ID ) )
4721
4713
// Record-style struct definition
4722
4714
} else if self . token == token:: OpenDelim ( token:: Brace ) {
4723
- let fields = try!( self . parse_record_struct_body ( & class_name ) ) ;
4715
+ let fields = try!( self . parse_record_struct_body ( ) ) ;
4724
4716
( fields, None )
4725
4717
// Tuple-style struct definition with optional where-clause.
4726
4718
} else if self . token == token:: OpenDelim ( token:: Paren ) {
@@ -4740,20 +4732,13 @@ impl<'a> Parser<'a> {
4740
4732
None ) )
4741
4733
}
4742
4734
4743
- pub fn parse_record_struct_body ( & mut self ,
4744
- class_name : & ast:: Ident ) -> PResult < Vec < StructField > > {
4735
+ pub fn parse_record_struct_body ( & mut self ) -> PResult < Vec < StructField > > {
4745
4736
let mut fields = Vec :: new ( ) ;
4746
4737
if try!( self . eat ( & token:: OpenDelim ( token:: Brace ) ) ) {
4747
4738
while self . token != token:: CloseDelim ( token:: Brace ) {
4748
4739
fields. push ( try!( self . parse_struct_decl_field ( true ) ) ) ;
4749
4740
}
4750
4741
4751
- if fields. is_empty ( ) {
4752
- return Err ( self . fatal ( & format ! ( "unit-like struct definition should be \
4753
- written as `struct {};`",
4754
- class_name) ) ) ;
4755
- }
4756
-
4757
4742
try!( self . bump ( ) ) ;
4758
4743
} else {
4759
4744
let token_str = self . this_token_to_string ( ) ;
0 commit comments