diff options
| author | bors <bors@rust-lang.org> | 2013-08-20 21:41:50 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-20 21:41:50 -0700 |
| commit | 00dd9e9cc57d1925df8362d02c6504b01d8105e3 (patch) | |
| tree | 2a25f32074b8924afdb37c079b9e813822dde79b /src/libsyntax | |
| parent | d56b9b102b307b473487402b0e494975206237b6 (diff) | |
| parent | 4457d2b379c40415ac95d7cb7d98508bb919ff36 (diff) | |
| download | rust-00dd9e9cc57d1925df8362d02c6504b01d8105e3.tar.gz rust-00dd9e9cc57d1925df8362d02c6504b01d8105e3.zip | |
auto merge of #8573 : mrordinaire/rust/struct-new-as-field-name, r=alexcrichton
fix for #8088, along with a test.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 19 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
2 files changed, 0 insertions, 23 deletions
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 01c1af7464d..989a796cbc9 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -32,7 +32,6 @@ use std::to_bytes; pub enum ObsoleteSyntax { ObsoleteLet, ObsoleteFieldTerminator, - ObsoleteStructCtor, ObsoleteWith, ObsoleteClassTraits, ObsoletePrivSection, @@ -89,7 +88,6 @@ pub trait ParserObsoleteMethods { fn token_is_obsolete_ident(&self, ident: &str, token: &Token) -> bool; fn is_obsolete_ident(&self, ident: &str) -> bool; fn eat_obsolete_ident(&self, ident: &str) -> bool; - fn try_parse_obsolete_struct_ctor(&self) -> bool; fn try_parse_obsolete_with(&self) -> bool; fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute]) -> bool; } @@ -106,12 +104,6 @@ impl ParserObsoleteMethods for Parser { "field declaration terminated with semicolon", "fields are now separated by commas" ), - ObsoleteStructCtor => ( - "struct constructor", - "structs are now constructed with `MyStruct { foo: val }` \ - syntax. Structs with private fields cannot be created \ - outside of their defining module" - ), ObsoleteWith => ( "with", "record update is done with `..`, e.g. \ @@ -311,17 +303,6 @@ impl ParserObsoleteMethods for Parser { } } - fn try_parse_obsolete_struct_ctor(&self) -> bool { - if self.eat_obsolete_ident("new") { - self.obsolete(*self.last_span, ObsoleteStructCtor); - self.parse_fn_decl(); - self.parse_block(); - true - } else { - false - } - } - fn try_parse_obsolete_with(&self) -> bool { if *self.token == token::COMMA && self.look_ahead(1, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index de7abb8d1f4..2b977153b03 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3929,10 +3929,6 @@ impl Parser { return ~[self.parse_single_struct_field(public, attrs)]; } - if self.try_parse_obsolete_struct_ctor() { - return ~[]; - } - return ~[self.parse_single_struct_field(inherited, attrs)]; } |
