diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-08 15:27:08 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | 8516ba367d1f51318ce373fe9b60650c82ded1e9 (patch) | |
| tree | d3feaa20d76319d79526412296665d504c062345 /src/libsyntax | |
| parent | 243a30c9319b56e1be2b9ff2f9ed9e0d7583e2d1 (diff) | |
| download | rust-8516ba367d1f51318ce373fe9b60650c82ded1e9.tar.gz rust-8516ba367d1f51318ce373fe9b60650c82ded1e9.zip | |
[breaking-change] don't glob export ast::CaptureClause variants
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 994b85a4458..209ed014ea2 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -10,7 +10,6 @@ // The Rust abstract syntax tree. -pub use self::CaptureClause::*; pub use self::Decl_::*; pub use self::ExplicitSelf_::*; pub use self::Expr_::*; @@ -973,7 +972,7 @@ pub enum Expr_ { /// A `match` block. ExprMatch(P<Expr>, Vec<Arm>), /// A closure (for example, `move |a, b, c| {a + b + c}`) - ExprClosure(CaptureClause, P<FnDecl>, P<Block>), + ExprClosure(CaptureBy, P<FnDecl>, P<Block>), /// A block (`{ ... }`) ExprBlock(P<Block>), @@ -1052,10 +1051,11 @@ pub struct QSelf { pub position: usize } +/// A capture clause #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] -pub enum CaptureClause { - CaptureByValue, - CaptureByRef, +pub enum CaptureBy { + Value, + Ref, } /// A delimited sequence of token trees diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 6da9a208f37..5980cf3abcc 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -883,14 +883,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn lambda_fn_decl(&self, span: Span, fn_decl: P<ast::FnDecl>, blk: P<ast::Block>) -> P<ast::Expr> { - self.expr(span, ast::ExprClosure(ast::CaptureByRef, fn_decl, blk)) + self.expr(span, ast::ExprClosure(ast::CaptureBy::Ref, fn_decl, blk)) } fn lambda(&self, span: Span, ids: Vec<ast::Ident>, blk: P<ast::Block>) -> P<ast::Expr> { let fn_decl = self.fn_decl( ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(), self.ty_infer(span)); - self.expr(span, ast::ExprClosure(ast::CaptureByRef, fn_decl, blk)) + self.expr(span, ast::ExprClosure(ast::CaptureBy::Ref, fn_decl, blk)) } fn lambda0(&self, span: Span, blk: P<ast::Block>) -> P<ast::Expr> { self.lambda(span, Vec::new(), blk) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b10c42c4b0e..c149f1f62b0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -16,7 +16,7 @@ use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; use ast::{Public, Unsafety}; use ast::{Mod, Arg, Arm, Attribute, BindingMode}; use ast::Block; -use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause}; +use ast::{BlockCheckMode, CaptureBy}; use ast::{Constness, ConstTraitItem, Crate, CrateConfig}; use ast::{Decl, DeclItem, DeclLocal}; use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf}; @@ -2108,7 +2108,7 @@ impl<'a> Parser<'a> { }, token::BinOp(token::Or) | token::OrOr => { let lo = self.span.lo; - return self.parse_lambda_expr(lo, CaptureByRef, attrs); + return self.parse_lambda_expr(lo, CaptureBy::Ref, attrs); }, token::Ident(id @ ast::Ident { name: token::SELF_KEYWORD_NAME, @@ -2167,7 +2167,7 @@ impl<'a> Parser<'a> { } if self.eat_keyword(keywords::Move) { let lo = self.last_span.lo; - return self.parse_lambda_expr(lo, CaptureByValue, attrs); + return self.parse_lambda_expr(lo, CaptureBy::Value, attrs); } if self.eat_keyword(keywords::If) { return self.parse_if_expr(attrs); @@ -3047,7 +3047,7 @@ impl<'a> Parser<'a> { // `|args| expr` pub fn parse_lambda_expr(&mut self, lo: BytePos, - capture_clause: CaptureClause, + capture_clause: CaptureBy, attrs: ThinAttributes) -> PResult<'a, P<Expr>> { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9d5bd798ec7..9b8e16bbd38 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2741,11 +2741,11 @@ impl<'a> State<'a> { } } - pub fn print_capture_clause(&mut self, capture_clause: ast::CaptureClause) + pub fn print_capture_clause(&mut self, capture_clause: ast::CaptureBy) -> io::Result<()> { match capture_clause { - ast::CaptureByValue => self.word_space("move"), - ast::CaptureByRef => Ok(()), + ast::CaptureBy::Value => self.word_space("move"), + ast::CaptureBy::Ref => Ok(()), } } |
