Skip to content

Commit 4e877ad

Browse files
Remove proc keyword
1 parent d30609f commit 4e877ad

File tree

4 files changed

+10
-37
lines changed

4 files changed

+10
-37
lines changed

src/libsyntax/parse/obsolete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
5959
),
6060
ObsoleteSyntax::ProcType => (
6161
"the `proc` type",
62-
"use unboxed closures instead",
62+
"is not used for moment, use unboxed closures instead",
6363
true,
6464
),
6565
ObsoleteSyntax::ProcExpr => (
6666
"`proc` expression",
67-
"use a `move ||` expression instead",
67+
"is not used for the moment, use a `move ||` expression instead",
6868
true,
6969
),
7070
ObsoleteSyntax::ClosureType => (

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,7 @@ impl<'a> Parser<'a> {
10511051
let lifetime_defs = self.parse_late_bound_lifetime_defs();
10521052

10531053
// examine next token to decide to do
1054-
if self.eat_keyword_noexpect(keywords::Proc) {
1055-
self.parse_proc_type(lifetime_defs)
1056-
} else if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
1054+
if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
10571055
self.parse_ty_bare_fn_or_ty_closure(lifetime_defs)
10581056
} else if self.check(&token::ModSep) ||
10591057
self.token.is_ident() ||
@@ -1522,8 +1520,6 @@ impl<'a> Parser<'a> {
15221520
let e = self.parse_expr();
15231521
self.expect(&token::CloseDelim(token::Paren));
15241522
TyTypeof(e)
1525-
} else if self.eat_keyword_noexpect(keywords::Proc) {
1526-
self.parse_proc_type(Vec::new())
15271523
} else if self.eat_lt() {
15281524
// QUALIFIED PATH `<TYPE as TRAIT_REF>::item`
15291525
let self_type = self.parse_ty_sum();
@@ -2285,12 +2281,6 @@ impl<'a> Parser<'a> {
22852281
if self.eat_keyword(keywords::Move) {
22862282
return self.parse_lambda_expr(CaptureByValue);
22872283
}
2288-
if self.eat_keyword_noexpect(keywords::Proc) {
2289-
let span = self.last_span;
2290-
let _ = self.parse_proc_decl();
2291-
let _ = self.parse_expr();
2292-
return self.obsolete_expr(span, ObsoleteSyntax::ProcExpr);
2293-
}
22942284
if self.eat_keyword(keywords::If) {
22952285
return self.parse_if_expr();
22962286
}
@@ -4645,23 +4635,6 @@ impl<'a> Parser<'a> {
46454635
})
46464636
}
46474637

4648-
/// Parses the `(arg, arg) -> return_type` header on a procedure.
4649-
fn parse_proc_decl(&mut self) -> P<FnDecl> {
4650-
let inputs =
4651-
self.parse_unspanned_seq(&token::OpenDelim(token::Paren),
4652-
&token::CloseDelim(token::Paren),
4653-
seq_sep_trailing_allowed(token::Comma),
4654-
|p| p.parse_fn_block_arg());
4655-
4656-
let output = self.parse_ret_ty();
4657-
4658-
P(FnDecl {
4659-
inputs: inputs,
4660-
output: output,
4661-
variadic: false
4662-
})
4663-
}
4664-
46654638
/// Parse the name and optional generic types of a function header.
46664639
fn parse_fn_header(&mut self) -> (Ident, ast::Generics) {
46674640
let id = self.parse_ident();

src/libsyntax/parse/token.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,11 @@ declare_special_idents_and_keywords! {
561561
(39, Virtual, "virtual");
562562
(40, While, "while");
563563
(41, Continue, "continue");
564-
(42, Proc, "proc");
565-
(43, Box, "box");
566-
(44, Const, "const");
567-
(45, Where, "where");
564+
(42, Box, "box");
565+
(43, Const, "const");
566+
(44, Where, "where");
568567
'reserved:
568+
(45, Proc, "proc");
569569
(46, Alignof, "alignof");
570570
(47, Become, "become");
571571
(48, Offsetof, "offsetof");

src/test/parse-fail/obsolete-proc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
// Test that we generate obsolete syntax errors around usages of `proc`.
1212

13-
fn foo(p: proc()) { } //~ ERROR obsolete syntax: the `proc` type
13+
fn foo(p: proc()) { } //~ ERROR: the `proc` type isn't used for the moment
1414

15-
fn bar() { proc() 1; } //~ ERROR obsolete syntax: `proc` expression
15+
fn bar() { proc() 1; } //~ ERROR: `proc` expression isn't used for the moment
1616

17-
fn main() { }
17+
fn main() { }

0 commit comments

Comments
 (0)