Skip to content

Commit abc4ea2

Browse files
committed
Stop parsing capture clauses
1 parent 4b9b328 commit abc4ea2

File tree

2 files changed

+20
-53
lines changed

2 files changed

+20
-53
lines changed

src/libsyntax/parse/parser.rs

+20-38
Original file line numberDiff line numberDiff line change
@@ -748,18 +748,6 @@ pub impl Parser {
748748
}
749749
}
750750

751-
fn parse_capture_item_or(parse_arg_fn: fn(Parser) -> arg_or_capture_item)
752-
-> arg_or_capture_item
753-
{
754-
if self.eat_keyword(~"copy") {
755-
// XXX outdated syntax now that moves-based-on-type has gone in
756-
self.parse_ident();
757-
either::Right(())
758-
} else {
759-
parse_arg_fn(self)
760-
}
761-
}
762-
763751
// This version of parse arg doesn't necessarily require
764752
// identifier names.
765753
fn parse_arg_general(require_name: bool) -> arg {
@@ -788,32 +776,26 @@ pub impl Parser {
788776
either::Left(self.parse_arg_general(true))
789777
}
790778
791-
fn parse_arg_or_capture_item() -> arg_or_capture_item {
792-
self.parse_capture_item_or(|p| p.parse_arg())
793-
}
794-
795779
fn parse_fn_block_arg() -> arg_or_capture_item {
796-
do self.parse_capture_item_or |p| {
797-
let m = p.parse_arg_mode();
798-
let is_mutbl = self.eat_keyword(~"mut");
799-
let pat = p.parse_pat(false);
800-
let t = if p.eat(token::COLON) {
801-
p.parse_ty(false)
802-
} else {
803-
@Ty {
804-
id: p.get_id(),
805-
node: ty_infer,
806-
span: mk_sp(p.span.lo, p.span.hi),
807-
}
808-
};
809-
either::Left(ast::arg {
810-
mode: m,
811-
is_mutbl: is_mutbl,
812-
ty: t,
813-
pat: pat,
814-
id: p.get_id()
815-
})
816-
}
780+
let m = self.parse_arg_mode();
781+
let is_mutbl = self.eat_keyword(~"mut");
782+
let pat = self.parse_pat(false);
783+
let t = if self.eat(token::COLON) {
784+
self.parse_ty(false)
785+
} else {
786+
@Ty {
787+
id: self.get_id(),
788+
node: ty_infer,
789+
span: mk_sp(self.span.lo, self.span.hi),
790+
}
791+
};
792+
either::Left(ast::arg {
793+
mode: m,
794+
is_mutbl: is_mutbl,
795+
ty: t,
796+
pat: pat,
797+
id: self.get_id()
798+
})
817799
}
818800

819801
fn maybe_parse_fixed_vstore_with_star() -> Option<uint> {
@@ -1722,7 +1704,7 @@ pub impl Parser {
17221704

17231705
// if we want to allow fn expression argument types to be inferred in
17241706
// the future, just have to change parse_arg to parse_fn_block_arg.
1725-
let decl = self.parse_fn_decl(|p| p.parse_arg_or_capture_item());
1707+
let decl = self.parse_fn_decl(|p| p.parse_arg());
17261708

17271709
let body = self.parse_block();
17281710

src/test/run-pass/cap-clause-not-used.rs

-15
This file was deleted.

0 commit comments

Comments
 (0)