]> git.lizzy.rs Git - rust.git/commitdiff
Remove proc keyword
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 7 Mar 2015 23:58:45 +0000 (00:58 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 10 Mar 2015 21:02:47 +0000 (22:02 +0100)
src/libsyntax/parse/obsolete.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/test/parse-fail/obsolete-proc.rs

index e6bcb8ac745675b0c4a8ec2320db2311805f6dfb..d853fbba8d4bd06ab309f0d5a3fe55ae35aeeaeb 100644 (file)
@@ -59,12 +59,12 @@ fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax) {
             ),
             ObsoleteSyntax::ProcType => (
                 "the `proc` type",
-                "use unboxed closures instead",
+                "is not used for moment, use unboxed closures instead",
                 true,
             ),
             ObsoleteSyntax::ProcExpr => (
                 "`proc` expression",
-                "use a `move ||` expression instead",
+                "is not used for the moment, use a `move ||` expression instead",
                 true,
             ),
             ObsoleteSyntax::ClosureType => (
index 28d757e9be96397b2cd7d85771dc941fd0dd1e58..7535e060c55e6b87f446171f4dbc73334d6464f5 100644 (file)
@@ -1051,9 +1051,7 @@ pub fn parse_for_in_type(&mut self) -> Ty_ {
         let lifetime_defs = self.parse_late_bound_lifetime_defs();
 
         // examine next token to decide to do
-        if self.eat_keyword_noexpect(keywords::Proc) {
-            self.parse_proc_type(lifetime_defs)
-        } else if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
+        if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
             self.parse_ty_bare_fn_or_ty_closure(lifetime_defs)
         } else if self.check(&token::ModSep) ||
                   self.token.is_ident() ||
@@ -1522,8 +1520,6 @@ pub fn parse_ty(&mut self) -> P<Ty> {
             let e = self.parse_expr();
             self.expect(&token::CloseDelim(token::Paren));
             TyTypeof(e)
-        } else if self.eat_keyword_noexpect(keywords::Proc) {
-            self.parse_proc_type(Vec::new())
         } else if self.eat_lt() {
             // QUALIFIED PATH `<TYPE as TRAIT_REF>::item`
             let self_type = self.parse_ty_sum();
@@ -2285,12 +2281,6 @@ pub fn parse_bottom_expr(&mut self) -> P<Expr> {
                 if self.eat_keyword(keywords::Move) {
                     return self.parse_lambda_expr(CaptureByValue);
                 }
-                if self.eat_keyword_noexpect(keywords::Proc) {
-                    let span = self.last_span;
-                    let _ = self.parse_proc_decl();
-                    let _ = self.parse_expr();
-                    return self.obsolete_expr(span, ObsoleteSyntax::ProcExpr);
-                }
                 if self.eat_keyword(keywords::If) {
                     return self.parse_if_expr();
                 }
@@ -4645,23 +4635,6 @@ fn parse_fn_block_decl(&mut self) -> P<FnDecl> {
         })
     }
 
-    /// Parses the `(arg, arg) -> return_type` header on a procedure.
-    fn parse_proc_decl(&mut self) -> P<FnDecl> {
-        let inputs =
-            self.parse_unspanned_seq(&token::OpenDelim(token::Paren),
-                                     &token::CloseDelim(token::Paren),
-                                     seq_sep_trailing_allowed(token::Comma),
-                                     |p| p.parse_fn_block_arg());
-
-        let output = self.parse_ret_ty();
-
-        P(FnDecl {
-            inputs: inputs,
-            output: output,
-            variadic: false
-        })
-    }
-
     /// Parse the name and optional generic types of a function header.
     fn parse_fn_header(&mut self) -> (Ident, ast::Generics) {
         let id = self.parse_ident();
index 61a3a5ca82a326e34bd32721a1c36019115fb374..4a3ea971c7a36e5a09368830dc500764329b3919 100644 (file)
@@ -561,11 +561,11 @@ pub mod keywords {
         (39,                         Virtual,    "virtual");
         (40,                         While,      "while");
         (41,                         Continue,   "continue");
-        (42,                         Proc,       "proc");
-        (43,                         Box,        "box");
-        (44,                         Const,      "const");
-        (45,                         Where,      "where");
+        (42,                         Box,        "box");
+        (43,                         Const,      "const");
+        (44,                         Where,      "where");
         'reserved:
+        (45,                         Proc,       "proc");
         (46,                         Alignof,    "alignof");
         (47,                         Become,     "become");
         (48,                         Offsetof,   "offsetof");
index 5208cdb6ad23191f5577b9cad0203f7a078d974f..e440280d7e4b22859c7479d0f56e635607d4ee3f 100644 (file)
@@ -10,8 +10,8 @@
 
 // Test that we generate obsolete syntax errors around usages of `proc`.
 
-fn foo(p: proc()) { } //~ ERROR obsolete syntax: the `proc` type
+fn foo(p: proc()) { } //~ ERROR: the `proc` type isn't used for the moment
 
-fn bar() { proc() 1; } //~ ERROR obsolete syntax: `proc` expression
+fn bar() { proc() 1; } //~ ERROR: `proc` expression isn't used for the moment
 
-fn main() { }
+fn main() { }
\ No newline at end of file