diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 9bac163dab6..853b1408050 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -748,18 +748,6 @@ pub impl Parser { } } - fn parse_capture_item_or(parse_arg_fn: fn(Parser) -> arg_or_capture_item) - -> arg_or_capture_item - { - if self.eat_keyword(~"copy") { - // XXX outdated syntax now that moves-based-on-type has gone in - self.parse_ident(); - either::Right(()) - } else { - parse_arg_fn(self) - } - } - // This version of parse arg doesn't necessarily require // identifier names. fn parse_arg_general(require_name: bool) -> arg { @@ -788,32 +776,26 @@ pub impl Parser { either::Left(self.parse_arg_general(true)) } - fn parse_arg_or_capture_item() -> arg_or_capture_item { - self.parse_capture_item_or(|p| p.parse_arg()) - } - fn parse_fn_block_arg() -> arg_or_capture_item { - do self.parse_capture_item_or |p| { - let m = p.parse_arg_mode(); - let is_mutbl = self.eat_keyword(~"mut"); - let pat = p.parse_pat(false); - let t = if p.eat(token::COLON) { - p.parse_ty(false) - } else { - @Ty { - id: p.get_id(), - node: ty_infer, - span: mk_sp(p.span.lo, p.span.hi), - } - }; - either::Left(ast::arg { - mode: m, - is_mutbl: is_mutbl, - ty: t, - pat: pat, - id: p.get_id() - }) - } + let m = self.parse_arg_mode(); + let is_mutbl = self.eat_keyword(~"mut"); + let pat = self.parse_pat(false); + let t = if self.eat(token::COLON) { + self.parse_ty(false) + } else { + @Ty { + id: self.get_id(), + node: ty_infer, + span: mk_sp(self.span.lo, self.span.hi), + } + }; + either::Left(ast::arg { + mode: m, + is_mutbl: is_mutbl, + ty: t, + pat: pat, + id: self.get_id() + }) } fn maybe_parse_fixed_vstore_with_star() -> Option { @@ -1722,7 +1704,7 @@ pub impl Parser { // if we want to allow fn expression argument types to be inferred in // the future, just have to change parse_arg to parse_fn_block_arg. - let decl = self.parse_fn_decl(|p| p.parse_arg_or_capture_item()); + let decl = self.parse_fn_decl(|p| p.parse_arg()); let body = self.parse_block(); diff --git a/src/test/run-pass/cap-clause-not-used.rs b/src/test/run-pass/cap-clause-not-used.rs deleted file mode 100644 index e26a8ae11fd..00000000000 --- a/src/test/run-pass/cap-clause-not-used.rs +++ /dev/null @@ -1,15 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: warning: Captured variable 'y' not used in closure -pub fn main() { - let x = 5; - let _y = fn~(copy x) { }; -}