diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-24 22:00:03 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-26 04:15:09 +0200 |
| commit | 11ef6f1349d0917c099d7c88d630b0e5f6ee4393 (patch) | |
| tree | 279a0216e7ca16bff046801f4889b77846296786 /src/libsyntax | |
| parent | 458a6a2f6e9dfb6ed3d76f14418ff1f2f5e97f86 (diff) | |
| download | rust-11ef6f1349d0917c099d7c88d630b0e5f6ee4393.tar.gz rust-11ef6f1349d0917c099d7c88d630b0e5f6ee4393.zip | |
Remove "unboxed" attribute in code referring to new closures.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 33 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 16 |
3 files changed, 29 insertions, 32 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 25a30b5e8e2..909a719c691 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -49,7 +49,7 @@ pub use self::TraitItem::*; pub use self::Ty_::*; pub use self::TyParamBound::*; pub use self::UintTy::*; -pub use self::UnboxedClosureKind::*; +pub use self::ClosureKind::*; pub use self::UnOp::*; pub use self::UnsafeSource::*; pub use self::VariantKind::*; @@ -734,7 +734,7 @@ pub enum Expr_ { // FIXME #6993: change to Option<Name> ... or not, if these are hygienic. ExprLoop(P<Block>, Option<Ident>), ExprMatch(P<Expr>, Vec<Arm>, MatchSource), - ExprClosure(CaptureClause, Option<UnboxedClosureKind>, P<FnDecl>, P<Block>), + ExprClosure(CaptureClause, Option<ClosureKind>, P<FnDecl>, P<Block>), ExprBlock(P<Block>), ExprAssign(P<Expr>, P<Expr>), @@ -1710,10 +1710,10 @@ impl ForeignItem_ { } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)] -pub enum UnboxedClosureKind { - FnUnboxedClosureKind, - FnMutUnboxedClosureKind, - FnOnceUnboxedClosureKind, +pub enum ClosureKind { + FnClosureKind, + FnMutClosureKind, + FnOnceClosureKind, } /// The data we save and restore about an inlined item or method. This is not diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 759e5e8229a..37f95bffe27 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -28,8 +28,8 @@ use ast::{ExprLit, ExprLoop, ExprMac, ExprRange}; use ast::{ExprMethodCall, ExprParen, ExprPath, ExprQPath}; use ast::{ExprRepeat, ExprRet, ExprStruct, ExprTup, ExprUnary}; use ast::{ExprVec, ExprWhile, ExprWhileLet, ExprForLoop, Field, FnDecl}; -use ast::{FnUnboxedClosureKind, FnMutUnboxedClosureKind}; -use ast::{FnOnceUnboxedClosureKind}; +use ast::{FnClosureKind, FnMutClosureKind}; +use ast::{FnOnceClosureKind}; use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod, FunctionRetTy}; use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic}; use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst}; @@ -57,7 +57,7 @@ use ast::{TyFixedLengthVec, TyBareFn}; use ast::{TyTypeof, TyInfer, TypeMethod}; use ast::{TyParam, TyParamBound, TyParen, TyPath, TyPolyTraitRef, TyPtr, TyQPath}; use ast::{TyRptr, TyTup, TyU32, TyVec, UnUniq}; -use ast::{TypeImplItem, TypeTraitItem, Typedef, UnboxedClosureKind}; +use ast::{TypeImplItem, TypeTraitItem, Typedef, ClosureKind}; use ast::{UnnamedField, UnsafeBlock}; use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple}; use ast::{Visibility, WhereClause}; @@ -1134,26 +1134,25 @@ impl<'a> Parser<'a> { } /// Parses an optional unboxed closure kind (`&:`, `&mut:`, or `:`). - pub fn parse_optional_unboxed_closure_kind(&mut self) - -> Option<UnboxedClosureKind> { + pub fn parse_optional_closure_kind(&mut self) -> Option<ClosureKind> { if self.check(&token::BinOp(token::And)) && self.look_ahead(1, |t| t.is_keyword(keywords::Mut)) && self.look_ahead(2, |t| *t == token::Colon) { self.bump(); self.bump(); self.bump(); - return Some(FnMutUnboxedClosureKind) + return Some(FnMutClosureKind) } if self.token == token::BinOp(token::And) && self.look_ahead(1, |t| *t == token::Colon) { self.bump(); self.bump(); - return Some(FnUnboxedClosureKind) + return Some(FnClosureKind) } if self.eat(&token::Colon) { - return Some(FnOnceUnboxedClosureKind) + return Some(FnOnceClosureKind) } return None @@ -3023,8 +3022,7 @@ impl<'a> Parser<'a> { -> P<Expr> { let lo = self.span.lo; - let (decl, optional_unboxed_closure_kind) = - self.parse_fn_block_decl(); + let (decl, optional_closure_kind) = self.parse_fn_block_decl(); let body = self.parse_expr(); let fakeblock = P(ast::Block { id: ast::DUMMY_NODE_ID, @@ -3037,7 +3035,7 @@ impl<'a> Parser<'a> { self.mk_expr( lo, fakeblock.span.hi, - ExprClosure(capture_clause, optional_unboxed_closure_kind, decl, fakeblock)) + ExprClosure(capture_clause, optional_closure_kind, decl, fakeblock)) } pub fn parse_else_expr(&mut self) -> P<Expr> { @@ -4506,22 +4504,21 @@ impl<'a> Parser<'a> { } // parse the |arg, arg| header on a lambda - fn parse_fn_block_decl(&mut self) - -> (P<FnDecl>, Option<UnboxedClosureKind>) { - let (optional_unboxed_closure_kind, inputs_captures) = { + fn parse_fn_block_decl(&mut self) -> (P<FnDecl>, Option<ClosureKind>) { + let (optional_closure_kind, inputs_captures) = { if self.eat(&token::OrOr) { (None, Vec::new()) } else { self.expect(&token::BinOp(token::Or)); - let optional_unboxed_closure_kind = - self.parse_optional_unboxed_closure_kind(); + let optional_closure_kind = + self.parse_optional_closure_kind(); let args = self.parse_seq_to_before_end( &token::BinOp(token::Or), seq_sep_trailing_allowed(token::Comma), |p| p.parse_fn_block_arg() ); self.bump(); - (optional_unboxed_closure_kind, args) + (optional_closure_kind, args) } }; let output = self.parse_ret_ty(); @@ -4530,7 +4527,7 @@ impl<'a> Parser<'a> { inputs: inputs_captures, output: output, variadic: false - }), optional_unboxed_closure_kind) + }), optional_closure_kind) } /// Parses the `(arg, arg) -> return_type` header on a procedure. diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 699b4f43b14..7cbc701995e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -11,11 +11,11 @@ pub use self::AnnNode::*; use abi; -use ast::{self, FnUnboxedClosureKind, FnMutUnboxedClosureKind}; -use ast::{FnOnceUnboxedClosureKind}; +use ast::{self, FnClosureKind, FnMutClosureKind}; +use ast::{FnOnceClosureKind}; use ast::{MethodImplItem, RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; use ast::{RequiredMethod, ProvidedMethod, TypeImplItem, TypeTraitItem}; -use ast::{UnboxedClosureKind}; +use ast::{ClosureKind}; use ast_util; use owned_slice::OwnedSlice; use attr::{AttrMetaMethods, AttributeMethods}; @@ -2357,14 +2357,14 @@ impl<'a> State<'a> { pub fn print_fn_block_args( &mut self, decl: &ast::FnDecl, - unboxed_closure_kind: Option<UnboxedClosureKind>) + closure_kind: Option<ClosureKind>) -> IoResult<()> { try!(word(&mut self.s, "|")); - match unboxed_closure_kind { + match closure_kind { None => {} - Some(FnUnboxedClosureKind) => try!(self.word_space("&:")), - Some(FnMutUnboxedClosureKind) => try!(self.word_space("&mut:")), - Some(FnOnceUnboxedClosureKind) => try!(self.word_space(":")), + Some(FnClosureKind) => try!(self.word_space("&:")), + Some(FnMutClosureKind) => try!(self.word_space("&mut:")), + Some(FnOnceClosureKind) => try!(self.word_space(":")), } try!(self.print_fn_args(decl, None)); try!(word(&mut self.s, "|")); |
