]> git.lizzy.rs Git - rust.git/commitdiff
Remove specific errors for very old obsolete syntax
authorBenjamin Herr <ben@0x539.de>
Thu, 3 Oct 2013 09:53:46 +0000 (11:53 +0200)
committerBenjamin Herr <ben@0x539.de>
Fri, 4 Oct 2013 05:09:28 +0000 (07:09 +0200)
Replaces existing tests for removed obsolete-syntax errors with tests
for the resulting regular errors, adds a test for each of the removed
parser errors to make sure that obsolete forms don't start working
again, removes some obsolete/superfluous tests that were now failing.

Deletes some amount of dead code in the parser, also includes some small
changes to parser error messages to accomodate new tests.

32 files changed:
src/libsyntax/ast.rs
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs
src/libsyntax/util/interner.rs
src/test/compile-fail/class-implements-int.rs [deleted file]
src/test/compile-fail/empty-record-type.rs [deleted file]
src/test/compile-fail/issue-3296.rs [deleted file]
src/test/compile-fail/obsolete-syntax.rs
src/test/compile-fail/removed-syntax-class-traits.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-closure-lifetime.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-const-item.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-enum-newtype.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-extern-const.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-field-let.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-field-semicolon.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-fixed-vec.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-fn-pure.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-fn-sigil.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-larrow-init.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-larrow-move.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-mode.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-mut-vec-expr.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-mut-vec-ty.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-priv-group.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-ptr-lifetime.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-record.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-static-fn.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-uniq-mut-expr.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-uniq-mut-ty.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-uniq-self.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-with-1.rs [new file with mode: 0644]
src/test/compile-fail/removed-syntax-with-2.rs [new file with mode: 0644]

index 5056bd5a00d9b653da43b8f9ecdbe5202ee50311..6de3b7aa0b099f05af83135250682db1f59d8e2f 100644 (file)
@@ -531,9 +531,7 @@ pub enum Expr_ {
     ExprWhile(@Expr, Block),
     // FIXME #6993: change to Option<Name>
     ExprForLoop(@Pat, @Expr, Block, Option<Ident>),
-    /* Conditionless loop (can be exited with break, cont, or ret)
-       Same semantics as while(true) { body }, but typestate knows that the
-       (implicit) condition is always true. */
+    // Conditionless loop (can be exited with break, cont, or ret)
     // FIXME #6993: change to Option<Name>
     ExprLoop(Block, Option<Ident>),
     ExprMatch(@Expr, ~[Arm]),
index 5a8563f963d331a31cf94f199b2c966ffedeb806..8c26793605c6117686f821ea8e5be8e6813e7931 100644 (file)
 removed.
 */
 
-use ast::{Expr, ExprLit, lit_nil, Attribute};
-use ast;
+use ast::{Expr, ExprLit, lit_nil};
 use codemap::{Span, respan};
 use parse::parser::Parser;
-use parse::token::{keywords, Token};
+use parse::token::Token;
 use parse::token;
 
 use std::str;
 /// The specific types of unsupported syntax
 #[deriving(Eq)]
 pub enum ObsoleteSyntax {
-    ObsoleteLet,
-    ObsoleteFieldTerminator,
-    ObsoleteWith,
-    ObsoleteClassTraits,
-    ObsoletePrivSection,
-    ObsoleteModeInFnType,
-    ObsoleteMoveInit,
-    ObsoleteBinaryMove,
     ObsoleteSwap,
     ObsoleteUnsafeBlock,
-    ObsoleteUnenforcedBound,
-    ObsoleteImplSyntax,
-    ObsoleteMutOwnedPointer,
-    ObsoleteMutVector,
-    ObsoleteRecordType,
-    ObsoleteRecordPattern,
-    ObsoletePostFnTySigil,
     ObsoleteBareFnType,
-    ObsoleteNewtypeEnum,
-    ObsoleteMode,
-    ObsoleteImplicitSelf,
-    ObsoleteLifetimeNotation,
-    ObsoletePurity,
-    ObsoleteStaticMethod,
-    ObsoleteConstItem,
-    ObsoleteFixedLengthVectorType,
     ObsoleteNamedExternModule,
     ObsoleteMultipleLocalDecl,
     ObsoleteMutWithMultipleBindings,
@@ -87,50 +63,12 @@ fn report(&self,
     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_with(&self) -> bool;
-    fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute]) -> bool;
 }
 
 impl ParserObsoleteMethods for Parser {
     /// Reports an obsolete syntax non-fatal error.
     fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) {
         let (kind_str, desc) = match kind {
-            ObsoleteLet => (
-                "`let` in field declaration",
-                "declare fields as `field: Type`"
-            ),
-            ObsoleteFieldTerminator => (
-                "field declaration terminated with semicolon",
-                "fields are now separated by commas"
-            ),
-            ObsoleteWith => (
-                "with",
-                "record update is done with `..`, e.g. \
-                 `MyStruct { foo: bar, .. baz }`"
-            ),
-            ObsoleteClassTraits => (
-                "class traits",
-                "implemented traits are specified on the impl, as in \
-                 `impl foo : bar {`"
-            ),
-            ObsoletePrivSection => (
-                "private section",
-                "the `priv` keyword is applied to individual items, methods, \
-                 and fields"
-            ),
-            ObsoleteModeInFnType => (
-                "mode without identifier in fn type",
-                "to use a (deprecated) mode in a fn type, you should \
-                 give the argument an explicit name (like `&&v: int`)"
-            ),
-            ObsoleteMoveInit => (
-                "initializer-by-move",
-                "Write `let foo = move bar` instead"
-            ),
-            ObsoleteBinaryMove => (
-                "binary move",
-                "Write `foo = move bar` instead"
-            ),
             ObsoleteSwap => (
                 "swap",
                 "Use std::util::{swap, replace} instead"
@@ -139,79 +77,10 @@ fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) {
                 "non-standalone unsafe block",
                 "use an inner `unsafe { ... }` block instead"
             ),
-            ObsoleteUnenforcedBound => (
-                "unenforced type parameter bound",
-                "use trait bounds on the functions that take the type as \
-                 arguments, not on the types themselves"
-            ),
-            ObsoleteImplSyntax => (
-                "colon-separated impl syntax",
-                "write `impl Trait for Type`"
-            ),
-            ObsoleteMutOwnedPointer => (
-                "const or mutable owned pointer",
-                "mutability inherits through `~` pointers; place the `~` box
-                 in a mutable location, like a mutable local variable or an \
-                 `@mut` box"
-            ),
-            ObsoleteMutVector => (
-                "const or mutable vector",
-                "mutability inherits through `~` pointers; place the vector \
-                 in a mutable location, like a mutable local variable or an \
-                 `@mut` box"
-            ),
-            ObsoleteRecordType => (
-                "structural record type",
-                "use a structure instead"
-            ),
-            ObsoleteRecordPattern => (
-                "structural record pattern",
-                "use a structure instead"
-            ),
-            ObsoletePostFnTySigil => (
-                "fn sigil in postfix position",
-                "Rather than `fn@`, `fn~`, or `fn&`, \
-                 write `@fn`, `~fn`, and `&fn` respectively"
-            ),
             ObsoleteBareFnType => (
                 "bare function type",
                 "use `&fn` or `extern fn` instead"
             ),
-            ObsoleteNewtypeEnum => (
-                "newtype enum",
-                "instead of `enum Foo = int`, write `struct Foo(int)`"
-            ),
-            ObsoleteMode => (
-                "obsolete argument mode",
-                "replace `-` or `++` mode with `+`"
-            ),
-            ObsoleteImplicitSelf => (
-                "implicit self",
-                "use an explicit `self` declaration or declare the method as \
-                 static"
-            ),
-            ObsoleteLifetimeNotation => (
-                "`/` lifetime notation",
-                "instead of `&foo/bar`, write `&'foo bar`; instead of \
-                 `bar/&foo`, write `&bar<'foo>"
-            ),
-            ObsoletePurity => (
-                "pure function",
-                "remove `pure`"
-            ),
-            ObsoleteStaticMethod => (
-                "`static` notation",
-                "`static` is superfluous; remove it"
-            ),
-            ObsoleteConstItem => (
-                "`const` item",
-                "`const` items are now `static` items; replace `const` with \
-                 `static`"
-            ),
-            ObsoleteFixedLengthVectorType => (
-                "fixed-length vector notation",
-                "instead of `[T * N]`, write `[T, ..N]`"
-            ),
             ObsoleteNamedExternModule => (
                 "named external module",
                 "instead of `extern mod foo { ... }`, write `mod foo { \
@@ -297,37 +166,4 @@ fn eat_obsolete_ident(&self, ident: &str) -> bool {
             false
         }
     }
-
-    fn try_parse_obsolete_with(&self) -> bool {
-        if *self.token == token::COMMA
-            && self.look_ahead(1,
-                               |t| self.token_is_obsolete_ident("with", t)) {
-            self.bump();
-        }
-        if self.eat_obsolete_ident("with") {
-            self.obsolete(*self.last_span, ObsoleteWith);
-            self.parse_expr();
-            true
-        } else {
-            false
-        }
-    }
-
-    fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute])
-                                           -> bool {
-        if self.is_keyword(keywords::Priv) &&
-                self.look_ahead(1, |t| *t == token::LBRACE) {
-            self.obsolete(*self.span, ObsoletePrivSection);
-            self.eat_keyword(keywords::Priv);
-            self.bump();
-            while *self.token != token::RBRACE {
-                self.parse_single_struct_field(ast::private, attrs.to_owned());
-            }
-            self.bump();
-            true
-        } else {
-            false
-        }
-    }
-
 }
index 4598bc043691c806bceb65f8b5c368311293bf7b..cad19543608ba1ab19d387c6ee3381e2cb3f3c5a 100644 (file)
@@ -402,7 +402,7 @@ fn tokens_to_str(p:&Parser, tokens: &[token::Token]) -> ~str {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on Iterator.
             let b = i.next().map_default(~"", |t| p.token_to_str(*t));
-            i.fold(b, |b,a| b + " " + p.token_to_str(a))
+            i.fold(b, |b,a| b + "`, `" + p.token_to_str(a))
         }
         if edible.contains(self.token) {
             self.bump();
@@ -548,7 +548,7 @@ pub fn expect_keyword(&self, kw: keywords::Keyword) {
     // signal an error if the given string is a strict keyword
     pub fn check_strict_keywords(&self) {
         if token::is_strict_keyword(self.token) {
-            self.span_err(*self.last_span,
+            self.span_err(*self.span,
                           format!("found `{}` in ident position", self.this_token_to_str()));
         }
     }
@@ -762,8 +762,7 @@ pub fn id_to_str(&self, id: Ident) -> @str {
 
     // is this one of the keywords that signals a closure type?
     pub fn token_is_closure_keyword(&self, tok: &token::Token) -> bool {
-        token::is_keyword(keywords::Pure, tok) ||
-            token::is_keyword(keywords::Unsafe, tok) ||
+        token::is_keyword(keywords::Unsafe, tok) ||
             token::is_keyword(keywords::Once, tok) ||
             token::is_keyword(keywords::Fn, tok)
     }
@@ -786,12 +785,12 @@ pub fn get_lifetime(&self, tok: &token::Token) -> ast::Ident {
     pub fn parse_ty_bare_fn(&self) -> ty_ {
         /*
 
-        extern "ABI" [pure|unsafe] fn <'lt> (S) -> T
-               ^~~~^ ^~~~~~~~~~~~^    ^~~~^ ^~^    ^
-                 |     |                |    |     |
-                 |     |                |    |   Return type
-                 |     |                |  Argument types
-                 |     |            Lifetimes
+        extern "ABI" [unsafe] fn <'lt> (S) -> T
+               ^~~~^ ^~~~~~~^    ^~~~^ ^~^    ^
+                 |     |           |    |     |
+                 |     |           |    |   Return type
+                 |     |           |  Argument types
+                 |     |       Lifetimes
                  |     |
                  |   Purity
                 ABI
@@ -818,14 +817,14 @@ pub fn parse_ty_closure(&self,
                             -> ty_ {
         /*
 
-        (&|~|@) ['r] [pure|unsafe] [once] fn [:Bounds] <'lt> (S) -> T
-        ^~~~~~^ ^~~^ ^~~~~~~~~~~~^ ^~~~~^    ^~~~~~~~^ ^~~~^ ^~^    ^
-           |     |     |             |           |       |    |     |
-           |     |     |             |           |       |    |   Return type
-           |     |     |             |           |       |  Argument types
-           |     |     |             |           |   Lifetimes
-           |     |     |             |       Closure bounds
-           |     |     |          Once-ness (a.k.a., affine)
+        (&|~|@) ['r] [unsafe] [once] fn [:Bounds] <'lt> (S) -> T
+        ^~~~~~^ ^~~^ ^~~~~~~^ ^~~~~^    ^~~~~~~~^ ^~~~^ ^~^    ^
+           |     |     |        |           |       |    |     |
+           |     |     |        |           |       |    |   Return type
+           |     |     |        |           |       |  Argument types
+           |     |     |        |           |   Lifetimes
+           |     |     |        |       Closure bounds
+           |     |     |     Once-ness (a.k.a., affine)
            |     |   Purity
            | Lifetime bound
         Allocation type
@@ -840,10 +839,6 @@ pub fn parse_ty_closure(&self,
         self.expect_keyword(keywords::Fn);
         let bounds = self.parse_optional_ty_param_bounds();
 
-        if self.parse_fn_ty_sigil().is_some() {
-            self.obsolete(*self.span, ObsoletePostFnTySigil);
-        }
-
         let (decl, lifetimes) = self.parse_ty_fn_decl();
 
         return ty_closure(@TyClosure {
@@ -865,12 +860,8 @@ fn parse_onceness(this: &Parser) -> Onceness {
         }
     }
 
-    // looks like this should be called parse_unsafety
     pub fn parse_unsafety(&self) -> purity {
-        if self.eat_keyword(keywords::Pure) {
-            self.obsolete(*self.last_span, ObsoletePurity);
-            return impure_fn;
-        } else if self.eat_keyword(keywords::Unsafe) {
+        if self.eat_keyword(keywords::Unsafe) {
             return unsafe_fn;
         } else {
             return impure_fn;
@@ -1096,26 +1087,10 @@ pub fn parse_ty(&self, _: bool) -> Ty {
             // STAR POINTER (bare pointer?)
             self.bump();
             ty_ptr(self.parse_mt())
-        } else if *self.token == token::LBRACE {
-            // STRUCTURAL RECORD (remove?)
-            let elems = self.parse_unspanned_seq(
-                &token::LBRACE,
-                &token::RBRACE,
-                seq_sep_trailing_allowed(token::COMMA),
-                |p| p.parse_ty_field()
-            );
-            if elems.len() == 0 {
-                self.unexpected_last(&token::RBRACE);
-            }
-            self.obsolete(*self.last_span, ObsoleteRecordType);
-            ty_nil
         } else if *self.token == token::LBRACKET {
             // VECTOR
             self.expect(&token::LBRACKET);
-            let mt = self.parse_mt();
-            if mt.mutbl == MutMutable {    // `m_const` too after snapshot
-                self.obsolete(*self.last_span, ObsoleteMutVector);
-            }
+            let mt = mt { ty: ~self.parse_ty(false), mutbl: MutImmutable };
 
             // Parse the `, ..e` in `[ int, ..e ]`
             // where `e` is a const expression
@@ -1164,7 +1139,7 @@ pub fn parse_ty(&self, _: bool) -> Ty {
     pub fn parse_box_or_uniq_pointee(&self,
                                      sigil: ast::Sigil,
                                      ctor: &fn(v: mt) -> ty_) -> ty_ {
-        // @'foo fn() or @foo/fn() or @fn() are parsed directly as fn types:
+        // ~'foo fn() or ~fn() are parsed directly as fn types:
         match *self.token {
             token::LIFETIME(*) => {
                 let lifetime = self.parse_lifetime();
@@ -1172,30 +1147,22 @@ pub fn parse_box_or_uniq_pointee(&self,
             }
 
             token::IDENT(*) => {
-                if self.look_ahead(1, |t| *t == token::BINOP(token::SLASH)) &&
-                        self.look_ahead(2, |t|
-                                        self.token_is_closure_keyword(t)) {
-                    let lifetime = self.parse_lifetime();
-                    self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
-                    return self.parse_ty_closure(sigil, Some(lifetime));
-                } else if self.token_is_closure_keyword(self.token) {
+                if self.token_is_closure_keyword(self.token) {
                     return self.parse_ty_closure(sigil, None);
                 }
             }
             _ => {}
         }
 
-        // other things are parsed as @ + a type.  Note that constructs like
+        // other things are parsed as @/~ + a type.  Note that constructs like
         // @[] and @str will be resolved during typeck to slices and so forth,
         // rather than boxed ptrs.  But the special casing of str/vec is not
         // reflected in the AST type.
-        let mt = self.parse_mt();
-
-        if mt.mutbl != MutImmutable && sigil == OwnedSigil {
-            self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
+        if sigil == OwnedSigil {
+            ctor(mt { ty: ~self.parse_ty(false), mutbl: MutImmutable })
+        } else {
+            ctor(self.parse_mt())
         }
-
-        ctor(mt)
     }
 
     pub fn parse_borrowed_pointee(&self) -> ty_ {
@@ -1210,25 +1177,6 @@ pub fn parse_borrowed_pointee(&self) -> ty_ {
         return ty_rptr(opt_lifetime, mt);
     }
 
-    // parse an optional, obsolete argument mode.
-    pub fn parse_arg_mode(&self) {
-        if self.eat(&token::BINOP(token::MINUS)) {
-            self.obsolete(*self.last_span, ObsoleteMode);
-        } else if self.eat(&token::ANDAND) {
-            self.obsolete(*self.last_span, ObsoleteMode);
-        } else if self.eat(&token::BINOP(token::PLUS)) {
-            let lo = self.last_span.lo;
-            if self.eat(&token::BINOP(token::PLUS)) {
-                let hi = self.last_span.hi;
-                self.obsolete(mk_sp(lo, hi), ObsoleteMode);
-            } else {
-                self.obsolete(*self.last_span, ObsoleteMode);
-            }
-        } else {
-            // Ignore.
-        }
-    }
-
     pub fn is_named_argument(&self) -> bool {
         let offset = match *self.token {
             token::BINOP(token::AND) => 1,
@@ -1262,7 +1210,6 @@ pub fn parse_arg_general(&self, require_name: bool) -> arg {
         let pat = if require_name || self.is_named_argument() {
             debug2!("parse_arg_general parse_pat (require_name:{:?})",
                    require_name);
-            self.parse_arg_mode();
             let pat = self.parse_pat();
 
             if is_mutbl && !ast_util::pat_is_ident(pat) {
@@ -1295,7 +1242,6 @@ pub fn parse_arg(&self) -> arg {
 
     // parse an argument in a lambda header e.g. |arg, arg|
     pub fn parse_fn_block_arg(&self) -> arg {
-        self.parse_arg_mode();
         let is_mutbl = self.eat_keyword(keywords::Mut);
         let pat = self.parse_pat();
         let t = if self.eat(&token::COLON) {
@@ -1316,10 +1262,7 @@ pub fn parse_fn_block_arg(&self) -> arg {
     }
 
     pub fn maybe_parse_fixed_vstore(&self) -> Option<@ast::Expr> {
-        if self.eat(&token::BINOP(token::STAR)) {
-            self.obsolete(*self.last_span, ObsoleteFixedLengthVectorType);
-            Some(self.parse_expr())
-        } else if *self.token == token::COMMA &&
+        if *self.token == token::COMMA &&
                 self.look_ahead(1, |t| *t == token::DOTDOT) {
             self.bump();
             self.bump();
@@ -1535,17 +1478,6 @@ pub fn parse_opt_lifetime(&self) -> Option<ast::Lifetime> {
             token::LIFETIME(*) => {
                 Some(self.parse_lifetime())
             }
-
-            // Also accept the (obsolete) syntax `foo/`
-            token::IDENT(*) => {
-                if self.look_ahead(1, |t| *t == token::BINOP(token::SLASH)) {
-                    self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
-                    Some(self.parse_lifetime())
-                } else {
-                    None
-                }
-            }
-
             _ => {
                 None
             }
@@ -1553,7 +1485,7 @@ pub fn parse_opt_lifetime(&self) -> Option<ast::Lifetime> {
     }
 
     /// Parses a single lifetime
-    // matches lifetime = ( LIFETIME ) | ( IDENT / )
+    // matches lifetime = LIFETIME
     pub fn parse_lifetime(&self) -> ast::Lifetime {
         match *self.token {
             token::LIFETIME(i) => {
@@ -1565,20 +1497,6 @@ pub fn parse_lifetime(&self) -> ast::Lifetime {
                     ident: i
                 };
             }
-
-            // Also accept the (obsolete) syntax `foo/`
-            token::IDENT(i, _) => {
-                let span = self.span;
-                self.bump();
-                self.expect(&token::BINOP(token::SLASH));
-                self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
-                return ast::Lifetime {
-                    id: ast::DUMMY_NODE_ID,
-                    span: *span,
-                    ident: i
-                };
-            }
-
             _ => {
                 self.fatal(format!("Expected a lifetime name"));
             }
@@ -1805,10 +1723,7 @@ pub fn parse_bottom_expr(&self) -> @Expr {
             return self.parse_block_expr(lo, UnsafeBlock(ast::UserProvided));
         } else if *self.token == token::LBRACKET {
             self.bump();
-            let mutbl = self.parse_mutability();
-            if mutbl == MutMutable {
-                self.obsolete(*self.last_span, ObsoleteMutVector);
-            }
+            let mutbl = MutImmutable;
 
             if *self.token == token::RBRACKET {
                 // Empty vector.
@@ -1897,10 +1812,6 @@ pub fn parse_bottom_expr(&self) -> @Expr {
 
                     fields.push(self.parse_field());
                     while *self.token != token::RBRACE {
-                        if self.try_parse_obsolete_with() {
-                            break;
-                        }
-
                         self.commit_expr(fields.last().expr, &[token::COMMA], &[token::RBRACE]);
 
                         if self.eat(&token::DOTDOT) {
@@ -2277,10 +2188,6 @@ pub fn parse_prefix_expr(&self) -> @Expr {
           }
           token::TILDE => {
             self.bump();
-            let m = self.parse_mutability();
-            if m != MutImmutable {
-                self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
-            }
 
             let e = self.parse_prefix_expr();
             hi = e.span.hi;
@@ -2379,15 +2286,6 @@ pub fn parse_assign_expr(&self) -> @Expr {
               self.mk_expr(lo, rhs.span.hi,
                            self.mk_assign_op(aop, lhs, rhs))
           }
-          token::LARROW => {
-              self.obsolete(*self.span, ObsoleteBinaryMove);
-              // Bogus value (but it's an error)
-              self.bump(); // <-
-              self.bump(); // rhs
-              self.bump(); // ;
-              self.mk_expr(lo, self.span.hi,
-                           ExprBreak(None))
-          }
           token::DARROW => {
             self.obsolete(*self.span, ObsoleteSwap);
             self.bump();
@@ -2590,8 +2488,7 @@ pub fn parse_loop_expr(&self, opt_ident: Option<ast::Ident>) -> @Expr {
             let hi = body.span.hi;
             return self.mk_expr(lo, hi, ExprLoop(body, opt_ident));
         } else {
-            // This is a 'continue' expression
-            // FIXME #9467 rm support for 'loop' here after snapshot
+            // This is an obsolete 'continue' expression
             if opt_ident.is_some() {
                 self.span_err(*self.last_span,
                               "a label may not be used with a `loop` expression");
@@ -2675,20 +2572,11 @@ fn parse_expr_res(&self, r: restriction) -> @Expr {
 
     // parse the RHS of a local variable declaration (e.g. '= 14;')
     fn parse_initializer(&self) -> Option<@Expr> {
-        match *self.token {
-          token::EQ => {
+        if *self.token == token::EQ {
             self.bump();
-            return Some(self.parse_expr());
-          }
-          token::LARROW => {
-              self.obsolete(*self.span, ObsoleteMoveInit);
-              self.bump();
-              self.bump();
-              return None;
-          }
-          _ => {
-            return None;
-          }
+            Some(self.parse_expr())
+        } else {
+            None
         }
     }
 
@@ -2893,19 +2781,6 @@ pub fn parse_pat(&self) -> @Pat {
                 span: mk_sp(lo, hi)
             }
           }
-          token::LBRACE => {
-            self.bump();
-            let (_, _) = self.parse_pat_fields();
-            self.bump();
-            self.obsolete(*self.span, ObsoleteRecordPattern);
-            pat = PatWild;
-            hi = self.last_span.hi;
-            return @ast::Pat {
-                id: ast::DUMMY_NODE_ID,
-                node: pat,
-                span: mk_sp(lo, hi)
-            }
-          }
           token::LPAREN => {
             // parse (pat,pat,pat,...) as tuple
             self.bump();
@@ -3420,10 +3295,7 @@ fn parse_block_tail_(&self, lo: BytePos, s: BlockCheckMode,
     }
 
     fn parse_optional_purity(&self) -> ast::purity {
-        if self.eat_keyword(keywords::Pure) {
-            self.obsolete(*self.last_span, ObsoletePurity);
-            ast::impure_fn
-        } else if self.eat_keyword(keywords::Unsafe) {
+        if self.eat_keyword(keywords::Unsafe) {
             ast::unsafe_fn
         } else {
             ast::impure_fn
@@ -3563,7 +3435,7 @@ fn maybe_parse_explicit_self(
             cnstr: &fn(v: Mutability) -> ast::explicit_self_,
             p: &Parser
         ) -> ast::explicit_self_ {
-            // We need to make sure it isn't a mode or a type
+            // We need to make sure it isn't a type
             if p.look_ahead(1, |t| token::is_keyword(keywords::Self, t)) ||
                 ((p.look_ahead(1, |t| token::is_keyword(keywords::Const, t)) ||
                   p.look_ahead(1, |t| token::is_keyword(keywords::Mut, t))) &&
@@ -3637,7 +3509,8 @@ fn maybe_parse_borrowed_explicit_self(this: &Parser) -> ast::explicit_self_ {
           token::TILDE => {
             maybe_parse_explicit_self(|mutability| {
                 if mutability != MutImmutable {
-                    self.obsolete(*self.last_span, ObsoleteMutOwnedPointer);
+                    self.span_err(*self.last_span,
+                                  "mutability declaration not allowed here");
                 }
                 sty_uniq
             }, self)
@@ -3802,7 +3675,6 @@ fn parse_method(&self) -> @method {
     // parse trait Foo { ... }
     fn parse_item_trait(&self) -> item_info {
         let ident = self.parse_ident();
-        self.parse_region_param();
         let tps = self.parse_generics();
 
         // Parse traits, if necessary.
@@ -3859,9 +3731,6 @@ fn parse_item_impl(&self) -> item_info {
 
             ty = self.parse_ty(false);
             opt_trait_ref
-        } else if self.eat(&token::COLON) {
-            self.obsolete(*self.span, ObsoleteImplSyntax);
-            Some(self.parse_trait_ref())
         } else {
             None
         };
@@ -3899,12 +3768,7 @@ fn parse_trait_ref_list(&self, ket: &token::Token) -> ~[trait_ref] {
     // parse struct Foo { ... }
     fn parse_item_struct(&self) -> item_info {
         let class_name = self.parse_ident();
-        self.parse_region_param();
         let generics = self.parse_generics();
-        if self.eat(&token::COLON) {
-            self.obsolete(*self.span, ObsoleteClassTraits);
-            let _ = self.parse_trait_ref_list(&token::LBRACE);
-        }
 
         let mut fields: ~[@struct_field];
         let is_tuple_like;
@@ -3914,10 +3778,7 @@ fn parse_item_struct(&self) -> item_info {
             is_tuple_like = false;
             fields = ~[];
             while *self.token != token::RBRACE {
-                let r = self.parse_struct_decl_field();
-                for struct_field in r.iter() {
-                    fields.push(*struct_field)
-                }
+                fields.push(self.parse_struct_decl_field());
             }
             if fields.len() == 0 {
                 self.fatal(format!("Unit-like struct definition should be written as `struct {};`",
@@ -3979,23 +3840,15 @@ pub fn parse_single_struct_field(&self,
                                      vis: visibility,
                                      attrs: ~[Attribute])
                                      -> @struct_field {
-        if self.eat_obsolete_ident("let") {
-            self.obsolete(*self.last_span, ObsoleteLet);
-        }
-
         let a_var = self.parse_name_and_ty(vis, attrs);
         match *self.token {
-            token::SEMI => {
-                self.obsolete(*self.span, ObsoleteFieldTerminator);
-                self.bump();
-            }
             token::COMMA => {
                 self.bump();
             }
             token::RBRACE => {}
             _ => {
                 self.span_fatal(*self.span,
-                                format!("expected `,`, or '\\}' but found `{}`",
+                                format!("expected `,`, or `\\}` but found `{}`",
                                      self.this_token_to_str()));
             }
         }
@@ -4003,23 +3856,19 @@ pub fn parse_single_struct_field(&self,
     }
 
     // parse an element of a struct definition
-    fn parse_struct_decl_field(&self) -> ~[@struct_field] {
+    fn parse_struct_decl_field(&self) -> @struct_field {
 
         let attrs = self.parse_outer_attributes();
 
-        if self.try_parse_obsolete_priv_section(attrs) {
-            return ~[];
-        }
-
         if self.eat_keyword(keywords::Priv) {
-            return ~[self.parse_single_struct_field(private, attrs)]
+            return self.parse_single_struct_field(private, attrs);
         }
 
         if self.eat_keyword(keywords::Pub) {
-           return ~[self.parse_single_struct_field(public, attrs)];
+           return self.parse_single_struct_field(public, attrs);
         }
 
-        return ~[self.parse_single_struct_field(inherited, attrs)];
+        return self.parse_single_struct_field(inherited, attrs);
     }
 
     // parse visiility: PUB, PRIV, or nothing
@@ -4029,15 +3878,6 @@ fn parse_visibility(&self) -> visibility {
         else { inherited }
     }
 
-    fn parse_staticness(&self) -> bool {
-        if self.eat_keyword(keywords::Static) {
-            self.obsolete(*self.last_span, ObsoleteStaticMethod);
-            true
-        } else {
-            false
-        }
-    }
-
     // given a termination token and a vector of already-parsed
     // attributes (of length 0 or 1), parse all of the items in a module
     fn parse_mod_items(&self,
@@ -4241,17 +4081,12 @@ fn parse_item_foreign_fn(&self, vis: ast::visibility,
                              vis: vis }
     }
 
-    // parse a const definition from a foreign module
-    fn parse_item_foreign_const(&self, vis: ast::visibility,
-                                attrs: ~[Attribute]) -> @foreign_item {
+    // parse a static item from a foreign module
+    fn parse_item_foreign_static(&self, vis: ast::visibility,
+                                 attrs: ~[Attribute]) -> @foreign_item {
         let lo = self.span.lo;
 
-        // XXX: Obsolete; remove after snap.
-        if self.eat_keyword(keywords::Const) {
-            self.obsolete(*self.last_span, ObsoleteConstItem);
-        } else {
-            self.expect_keyword(keywords::Static);
-        }
+        self.expect_keyword(keywords::Static);
         let mutbl = self.eat_keyword(keywords::Mut);
 
         let ident = self.parse_ident();
@@ -4270,12 +4105,7 @@ fn parse_item_foreign_const(&self, vis: ast::visibility,
     // parse safe/unsafe and fn
     fn parse_fn_purity(&self) -> purity {
         if self.eat_keyword(keywords::Fn) { impure_fn }
-        else if self.eat_keyword(keywords::Pure) {
-            self.obsolete(*self.last_span, ObsoletePurity);
-            self.expect_keyword(keywords::Fn);
-            // NB: We parse this as impure for bootstrapping purposes.
-            impure_fn
-        } else if self.eat_keyword(keywords::Unsafe) {
+        else if self.eat_keyword(keywords::Unsafe) {
             self.expect_keyword(keywords::Fn);
             unsafe_fn
         }
@@ -4389,7 +4219,6 @@ fn parse_item_foreign_mod(&self,
     // parse type Foo = Bar;
     fn parse_item_type(&self) -> item_info {
         let ident = self.parse_ident();
-        self.parse_region_param();
         let tps = self.parse_generics();
         self.expect(&token::EQ);
         let ty = self.parse_ty(false);
@@ -4397,23 +4226,12 @@ fn parse_item_type(&self) -> item_info {
         (ident, item_ty(ty, tps), None)
     }
 
-    // parse obsolete region parameter
-    fn parse_region_param(&self) {
-        if self.eat(&token::BINOP(token::SLASH)) {
-            self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
-            self.expect(&token::BINOP(token::AND));
-        }
-    }
-
     // parse a structure-like enum variant definition
     // this should probably be renamed or refactored...
     fn parse_struct_def(&self) -> @struct_def {
         let mut fields: ~[@struct_field] = ~[];
         while *self.token != token::RBRACE {
-            let r = self.parse_struct_decl_field();
-            for struct_field in r.iter() {
-                fields.push(*struct_field);
-            }
+            fields.push(self.parse_struct_decl_field());
         }
         self.bump();
 
@@ -4490,36 +4308,7 @@ fn parse_enum_def(&self, _generics: &ast::Generics) -> enum_def {
     // parse an "enum" declaration
     fn parse_item_enum(&self) -> item_info {
         let id = self.parse_ident();
-        self.parse_region_param();
         let generics = self.parse_generics();
-        // Newtype syntax
-        if *self.token == token::EQ {
-            // enum x = ty;
-            self.bump();
-            let ty = self.parse_ty(false);
-            self.expect(&token::SEMI);
-            let variant = spanned(ty.span.lo, ty.span.hi, ast::variant_ {
-                name: id,
-                attrs: ~[],
-                kind: tuple_variant_kind(
-                    ~[ast::variant_arg {ty: ty, id: ast::DUMMY_NODE_ID}]
-                ),
-                id: ast::DUMMY_NODE_ID,
-                disr_expr: None,
-                vis: public,
-            });
-
-            self.obsolete(*self.last_span, ObsoleteNewtypeEnum);
-
-            return (
-                id,
-                item_enum(
-                    ast::enum_def { variants: ~[variant] },
-                    generics),
-                None
-            );
-        }
-        // enum X { ... }
         self.expect(&token::LBRACE);
 
         let enum_definition = self.parse_enum_def(&generics);
@@ -4648,13 +4437,8 @@ fn parse_item_or_view_item(&self,
             }
         }
         // the rest are all guaranteed to be items:
-        if (self.is_keyword(keywords::Const) ||
-            (self.is_keyword(keywords::Static) &&
-             self.look_ahead(1, |t| !token::is_keyword(keywords::Fn, t)))) {
-            // CONST / STATIC ITEM
-            if self.is_keyword(keywords::Const) {
-                self.obsolete(*self.span, ObsoleteConstItem);
-            }
+        if self.is_keyword(keywords::Static) {
+            // STATIC ITEM
             self.bump();
             let (ident, item_, extra_attrs) = self.parse_item_const();
             return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_,
@@ -4671,16 +4455,6 @@ fn parse_item_or_view_item(&self,
                                           visibility,
                                           maybe_append(attrs, extra_attrs)));
         }
-        if self.eat_keyword(keywords::Pure) {
-            // PURE FUNCTION ITEM (obsolete)
-            self.obsolete(*self.last_span, ObsoletePurity);
-            self.expect_keyword(keywords::Fn);
-            let (ident, item_, extra_attrs) =
-                self.parse_item_fn(impure_fn, AbiSet::Rust());
-            return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_,
-                                          visibility,
-                                          maybe_append(attrs, extra_attrs)));
-        }
         if self.is_keyword(keywords::Unsafe)
             && self.look_ahead(1u, |t| *t != token::LBRACE) {
             // UNSAFE FUNCTION ITEM
@@ -4747,13 +4521,12 @@ fn parse_foreign_item(&self,
 
         let visibility = self.parse_visibility();
 
-        if (self.is_keyword(keywords::Const) || self.is_keyword(keywords::Static)) {
-            // FOREIGN CONST ITEM
-            let item = self.parse_item_foreign_const(visibility, attrs);
+        if self.is_keyword(keywords::Static) {
+            // FOREIGN STATIC ITEM
+            let item = self.parse_item_foreign_static(visibility, attrs);
             return iovi_foreign_item(item);
         }
-        if (self.is_keyword(keywords::Fn) || self.is_keyword(keywords::Pure) ||
-                self.is_keyword(keywords::Unsafe)) {
+        if self.is_keyword(keywords::Fn) || self.is_keyword(keywords::Unsafe) {
             // FOREIGN FUNCTION ITEM
             let item = self.parse_item_foreign_fn(visibility, attrs);
             return iovi_foreign_item(item);
index 2b1e7eaa9b26d592a0fd6dd98e449f8a07d7817d..82249453ac24df2773e6bac49c870c2167b52d80 100644 (file)
@@ -134,9 +134,6 @@ pub fn gensym_copy(&self, idx : uint) -> uint {
         new_idx
     }
 
-    // this isn't "pure" in the traditional sense, because it can go from
-    // failing to returning a value as items are interned. But for typestate,
-    // where we first check a pred and then rely on it, ceasing to fail is ok.
     pub fn get(&self, idx: uint) -> @str { self.vect[idx] }
 
     pub fn len(&self) -> uint { let vect = &*self.vect; vect.len() }
diff --git a/src/test/compile-fail/class-implements-int.rs b/src/test/compile-fail/class-implements-int.rs
deleted file mode 100644 (file)
index f834a95..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct cat : int { //~ ERROR trait
-  meows: uint,
-}
-
-fn cat(in_x : uint) -> cat {
-    cat {
-        meows: in_x
-    }
-}
-
-fn main() {
-  let nyan = cat(0u);
-}
diff --git a/src/test/compile-fail/empty-record-type.rs b/src/test/compile-fail/empty-record-type.rs
deleted file mode 100644 (file)
index 74ac36f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern:unexpected token: `}`
-// Issue #1200
-
-type t = {};
-
-fn main() {
-}
diff --git a/src/test/compile-fail/issue-3296.rs b/src/test/compile-fail/issue-3296.rs
deleted file mode 100644 (file)
index ba0ad02..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use extra;
-
-struct Deserializer : extra::serialization::deserializer{ //~ ERROR obsolete syntax: class traits
-    x: ()
-}
-
-struct Foo {
-    a: ()
-}
-
-fn deserialize_foo<__D: extra::serialization::deserializer>(__d: __D) {
-}
-
-fn main() { let des = Deserializer(); let foo = deserialize_foo(des); }
index 872f3b1010e2af2673e69b7c4b6e393e7058b1e3..07fa5077d9b264ac6754833e2b360298d957888d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,47 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-struct s {
-    let foo: (),
-    //~^ ERROR obsolete syntax: `let` in field declaration
-    bar: ();
-    //~^ ERROR obsolete syntax: field declaration terminated with semicolon
-}
-
-struct q : r {
-    //~^ ERROR obsolete syntax: class traits
-    foo: int
-}
-
-struct sss {
-    bar: int,
-    priv {
-    //~^ ERROR obsolete syntax: private section
-        foo: ()
-    }
-}
-
-fn obsolete_with() {
-    struct S {
-        foo: (),
-        bar: (),
-    }
-
-    let a = S { foo: (), bar: () };
-    let b = S { foo: () with a };
-    //~^ ERROR obsolete syntax: with
-    let c = S { foo: (), with a };
-    //~^ ERROR obsolete syntax: with
-}
-
-fn obsolete_moves() {
-    let mut x = 0;
-    let y <- x;
-    //~^ ERROR obsolete syntax: initializer-by-move
-    y <- x;
-    //~^ ERROR obsolete syntax: binary move
-}
-
 extern mod obsolete_name {
     //~^ ERROR obsolete syntax: named external module
     fn bar();
diff --git a/src/test/compile-fail/removed-syntax-class-traits.rs b/src/test/compile-fail/removed-syntax-class-traits.rs
new file mode 100644 (file)
index 0000000..45b6485
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct q : r {
+    //~^ ERROR expected `{`, `(`, or `;` after struct name
+    foo: int
+}
diff --git a/src/test/compile-fail/removed-syntax-closure-lifetime.rs b/src/test/compile-fail/removed-syntax-closure-lifetime.rs
new file mode 100644 (file)
index 0000000..e2ab70b
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type closure = ~lt/fn(); //~ ERROR expected `;` but found `/`
diff --git a/src/test/compile-fail/removed-syntax-const-item.rs b/src/test/compile-fail/removed-syntax-const-item.rs
new file mode 100644 (file)
index 0000000..a87f621
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+const i: int = 42; //~ ERROR expected item but found `const`
diff --git a/src/test/compile-fail/removed-syntax-enum-newtype.rs b/src/test/compile-fail/removed-syntax-enum-newtype.rs
new file mode 100644 (file)
index 0000000..e40ed28
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+enum e = int; //~ ERROR expected `{` but found `=`
diff --git a/src/test/compile-fail/removed-syntax-extern-const.rs b/src/test/compile-fail/removed-syntax-extern-const.rs
new file mode 100644 (file)
index 0000000..2f98552
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern {
+    const i: int; //~ ERROR unexpected token: `const`
+}
diff --git a/src/test/compile-fail/removed-syntax-field-let.rs b/src/test/compile-fail/removed-syntax-field-let.rs
new file mode 100644 (file)
index 0000000..48b0f00
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct s {
+    let foo: (),
+    //~^  ERROR found `let` in ident position
+    //~^^ ERROR expected `:` but found `foo`
+}
diff --git a/src/test/compile-fail/removed-syntax-field-semicolon.rs b/src/test/compile-fail/removed-syntax-field-semicolon.rs
new file mode 100644 (file)
index 0000000..3efcf99
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct s {
+    bar: ();
+    //~^ ERROR expected `,`, or `}` but found `;`
+}
diff --git a/src/test/compile-fail/removed-syntax-fixed-vec.rs b/src/test/compile-fail/removed-syntax-fixed-vec.rs
new file mode 100644 (file)
index 0000000..b85880f
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type v = [int * 3]; //~ ERROR expected `]` but found `*`
diff --git a/src/test/compile-fail/removed-syntax-fn-pure.rs b/src/test/compile-fail/removed-syntax-fn-pure.rs
new file mode 100644 (file)
index 0000000..865b5f7
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pure fn f() {} //~ ERROR expected item but found `pure`
diff --git a/src/test/compile-fail/removed-syntax-fn-sigil.rs b/src/test/compile-fail/removed-syntax-fn-sigil.rs
new file mode 100644 (file)
index 0000000..4f21769
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() {
+    let x: fn~() = || (); //~ ERROR expected `(` but found `~`
+}
diff --git a/src/test/compile-fail/removed-syntax-larrow-init.rs b/src/test/compile-fail/removed-syntax-larrow-init.rs
new file mode 100644 (file)
index 0000000..4f615af
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn removed_moves() {
+    let mut x = 0;
+    let y <- x;
+    //~^ ERROR expected `;` but found `<-`
+}
diff --git a/src/test/compile-fail/removed-syntax-larrow-move.rs b/src/test/compile-fail/removed-syntax-larrow-move.rs
new file mode 100644 (file)
index 0000000..af49f20
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn removed_moves() {
+    let mut x = 0;
+    let y = 0;
+    y <- x;
+    //~^ ERROR expected one of `;`, `}` but found `<-`
+}
diff --git a/src/test/compile-fail/removed-syntax-mode.rs b/src/test/compile-fail/removed-syntax-mode.rs
new file mode 100644 (file)
index 0000000..d2ab188
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f(+x: int) {} //~ ERROR unexpected token: `+`
diff --git a/src/test/compile-fail/removed-syntax-mut-vec-expr.rs b/src/test/compile-fail/removed-syntax-mut-vec-expr.rs
new file mode 100644 (file)
index 0000000..171cf03
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() {
+    let v = [mut 1, 2, 3, 4];
+    //~^  ERROR found `mut` in ident position
+    //~^^ ERROR expected `]` but found `1`
+}
diff --git a/src/test/compile-fail/removed-syntax-mut-vec-ty.rs b/src/test/compile-fail/removed-syntax-mut-vec-ty.rs
new file mode 100644 (file)
index 0000000..4c0be56
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type v = [mut int];
+    //~^  ERROR found `mut` in ident position
+    //~^^ ERROR expected `]` but found `int`
diff --git a/src/test/compile-fail/removed-syntax-priv-group.rs b/src/test/compile-fail/removed-syntax-priv-group.rs
new file mode 100644 (file)
index 0000000..8fbad2d
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct sss {
+    bar: int,
+    priv {
+    //~^ ERROR expected ident
+        foo: ()
+    }
+}
diff --git a/src/test/compile-fail/removed-syntax-ptr-lifetime.rs b/src/test/compile-fail/removed-syntax-ptr-lifetime.rs
new file mode 100644 (file)
index 0000000..5b969da
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type bptr = &lifetime/int; //~ ERROR expected `;` but found `/`
diff --git a/src/test/compile-fail/removed-syntax-record.rs b/src/test/compile-fail/removed-syntax-record.rs
new file mode 100644 (file)
index 0000000..38c5122
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type t = { f: () }; //~ ERROR expected type, found token LBRACE
diff --git a/src/test/compile-fail/removed-syntax-static-fn.rs b/src/test/compile-fail/removed-syntax-static-fn.rs
new file mode 100644 (file)
index 0000000..f645560
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+impl S {
+    static fn f() {} //~ ERROR unexpected token: `static`
+}
diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs b/src/test/compile-fail/removed-syntax-uniq-mut-expr.rs
new file mode 100644 (file)
index 0000000..eeeb0c3
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() {
+    let box = ~mut 42;
+    //~^  ERROR found `mut` in ident position
+    //~^^ ERROR expected `;` but found `42`
+}
diff --git a/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs b/src/test/compile-fail/removed-syntax-uniq-mut-ty.rs
new file mode 100644 (file)
index 0000000..98ab752
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+type mut_box = ~mut int;
+    //~^  ERROR found `mut` in ident position
+    //~^^ ERROR expected `;` but found `int`
diff --git a/src/test/compile-fail/removed-syntax-uniq-self.rs b/src/test/compile-fail/removed-syntax-uniq-self.rs
new file mode 100644 (file)
index 0000000..19e5230
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct S;
+
+impl S {
+    fn f(~mut self) {} //~ ERROR mutability declaration not allowed here
+}
diff --git a/src/test/compile-fail/removed-syntax-with-1.rs b/src/test/compile-fail/removed-syntax-with-1.rs
new file mode 100644 (file)
index 0000000..a0a332a
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn removed_with() {
+    struct S {
+        foo: (),
+        bar: (),
+    }
+
+    let a = S { foo: (), bar: () };
+    let b = S { foo: () with a };
+    //~^ ERROR expected one of `,`, `}` but found `with`
+}
diff --git a/src/test/compile-fail/removed-syntax-with-2.rs b/src/test/compile-fail/removed-syntax-with-2.rs
new file mode 100644 (file)
index 0000000..3068c58
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn removed_with() {
+    struct S {
+        foo: (),
+        bar: (),
+    }
+
+    let a = S { foo: (), bar: () };
+    let b = S { foo: (), with a };
+    //~^ ERROR expected `:` but found `a`
+}