about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorDo Nhat Minh <mrordinaire@gmail.com>2013-08-17 14:43:13 +0800
committerDo Nhat Minh <mrordinaire@gmail.com>2013-08-18 00:07:14 +0800
commit4457d2b379c40415ac95d7cb7d98508bb919ff36 (patch)
treedad2ae4c54973b210d64da8dd10292b7566d9b89 /src/libsyntax/parse
parenta1674b6150b20616c954e37206012b356ff81b1c (diff)
downloadrust-4457d2b379c40415ac95d7cb7d98508bb919ff36.tar.gz
rust-4457d2b379c40415ac95d7cb7d98508bb919ff36.zip
fix for #8088 (Cannot name a struct field `new` due to ancient syntax)
remove code for parsing ancient syntax
added a run-pass test
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/obsolete.rs19
-rw-r--r--src/libsyntax/parse/parser.rs4
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 a2664dcf890..af54dea3c33 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)];
     }