[breaking-change] don't glob export ast::CaptureClause variants

This commit is contained in:
Oliver Schneider 2016-02-08 15:27:08 +01:00
parent 243a30c931
commit 8516ba367d
5 changed files with 17 additions and 17 deletions

View File

@ -1555,10 +1555,10 @@ pub fn lower_stmt(lctx: &LoweringContext, s: &Stmt) -> hir::Stmt {
}
}
pub fn lower_capture_clause(_lctx: &LoweringContext, c: CaptureClause) -> hir::CaptureClause {
pub fn lower_capture_clause(_lctx: &LoweringContext, c: CaptureBy) -> hir::CaptureClause {
match c {
CaptureByValue => hir::CaptureByValue,
CaptureByRef => hir::CaptureByRef,
CaptureBy::Value => hir::CaptureByValue,
CaptureBy::Ref => hir::CaptureByRef,
}
}

View File

@ -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

View File

@ -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)

View File

@ -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>>
{

View File

@ -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(()),
}
}