Skip to content

Commit 143b9d8

Browse files
committed
Stop re-exporting the ast::BindingMode variants.
1 parent f963eb2 commit 143b9d8

File tree

9 files changed

+26
-27
lines changed

9 files changed

+26
-27
lines changed

src/librustc_front/lowering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,8 @@ pub fn lower_block_check_mode(lctx: &LoweringContext, b: &BlockCheckMode) -> hir
15631563

15641564
pub fn lower_binding_mode(lctx: &LoweringContext, b: &BindingMode) -> hir::BindingMode {
15651565
match *b {
1566-
BindByRef(m) => hir::BindByRef(lower_mutability(lctx, m)),
1567-
BindByValue(m) => hir::BindByValue(lower_mutability(lctx, m)),
1566+
BindingMode::ByRef(m) => hir::BindByRef(lower_mutability(lctx, m)),
1567+
BindingMode::ByValue(m) => hir::BindByValue(lower_mutability(lctx, m)),
15681568
}
15691569
}
15701570

src/librustc_trans/save/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,8 @@ impl<'v> Visitor<'v> for PathCollector {
697697
// Even if the ref is mut, you can't change the ref, only
698698
// the data pointed at, so showing the initialising expression
699699
// is still worthwhile.
700-
ast::BindByRef(_) => ast::MutImmutable,
701-
ast::BindByValue(mt) => mt,
700+
ast::BindingMode::ByRef(_) => ast::MutImmutable,
701+
ast::BindingMode::ByValue(mt) => mt,
702702
};
703703
// collect path for either visit_local or visit_arm
704704
let path = ast_util::ident_to_path(path1.span, path1.node);

src/libsyntax/ast.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// The Rust abstract syntax tree.
1212

13-
pub use self::BindingMode::*;
1413
pub use self::BinOp_::*;
1514
pub use self::BlockCheckMode::*;
1615
pub use self::CaptureClause::*;
@@ -575,8 +574,8 @@ pub struct FieldPat {
575574

576575
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
577576
pub enum BindingMode {
578-
BindByRef(Mutability),
579-
BindByValue(Mutability),
577+
ByRef(Mutability),
578+
ByValue(Mutability),
580579
}
581580

582581
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
@@ -1655,7 +1654,7 @@ impl Arg {
16551654
}),
16561655
pat: P(Pat {
16571656
id: DUMMY_NODE_ID,
1658-
node: PatIdent(BindByValue(mutability), path, None),
1657+
node: PatIdent(BindingMode::ByValue(mutability), path, None),
16591658
span: span
16601659
}),
16611660
id: DUMMY_NODE_ID

src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn path_to_ident(path: &Path) -> Option<Ident> {
6969
pub fn ident_to_pat(id: NodeId, s: Span, i: Ident) -> P<Pat> {
7070
P(Pat {
7171
id: id,
72-
node: PatIdent(BindByValue(MutImmutable), codemap::Spanned{span:s, node:i}, None),
72+
node: PatIdent(BindingMode::ByValue(MutImmutable), codemap::Spanned{span:s, node:i}, None),
7373
span: s
7474
})
7575
}

src/libsyntax/ext/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
514514
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident,
515515
ex: P<ast::Expr>) -> P<ast::Stmt> {
516516
let pat = if mutbl {
517-
self.pat_ident_binding_mode(sp, ident, ast::BindByValue(ast::MutMutable))
517+
self.pat_ident_binding_mode(sp, ident, ast::BindingMode::ByValue(ast::MutMutable))
518518
} else {
519519
self.pat_ident(sp, ident)
520520
};
@@ -538,7 +538,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
538538
ex: P<ast::Expr>)
539539
-> P<ast::Stmt> {
540540
let pat = if mutbl {
541-
self.pat_ident_binding_mode(sp, ident, ast::BindByValue(ast::MutMutable))
541+
self.pat_ident_binding_mode(sp, ident, ast::BindingMode::ByValue(ast::MutMutable))
542542
} else {
543543
self.pat_ident(sp, ident)
544544
};
@@ -809,7 +809,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
809809
self.pat(span, ast::PatLit(expr))
810810
}
811811
fn pat_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Pat> {
812-
self.pat_ident_binding_mode(span, ident, ast::BindByValue(ast::MutImmutable))
812+
self.pat_ident_binding_mode(span, ident, ast::BindingMode::ByValue(ast::MutImmutable))
813813
}
814814

815815
fn pat_ident_binding_mode(&self,

src/libsyntax/parse/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ mod tests {
890890
assert!(panictry!(parser.parse_pat())
891891
== P(ast::Pat{
892892
id: ast::DUMMY_NODE_ID,
893-
node: ast::PatIdent(ast::BindByValue(ast::MutImmutable),
893+
node: ast::PatIdent(ast::BindingMode::ByValue(ast::MutImmutable),
894894
Spanned{ span:sp(0, 1),
895895
node: str_to_ident("b")
896896
},
@@ -926,7 +926,7 @@ mod tests {
926926
pat: P(ast::Pat {
927927
id: ast::DUMMY_NODE_ID,
928928
node: ast::PatIdent(
929-
ast::BindByValue(ast::MutImmutable),
929+
ast::BindingMode::ByValue(ast::MutImmutable),
930930
Spanned{
931931
span: sp(6,7),
932932
node: str_to_ident("b")},

src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use abi;
1414
use ast::BareFnTy;
1515
use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
1616
use ast::{Public, Unsafety};
17-
use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindByRef, BindByValue};
17+
use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindingMode};
1818
use ast::{BiBitAnd, BiBitOr, BiBitXor, BiRem, BiLt, Block};
1919
use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause};
2020
use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
@@ -3274,10 +3274,10 @@ impl<'a> Parser<'a> {
32743274
hi = self.last_span.hi;
32753275

32763276
let bind_type = match (is_ref, is_mut) {
3277-
(true, true) => BindByRef(MutMutable),
3278-
(true, false) => BindByRef(MutImmutable),
3279-
(false, true) => BindByValue(MutMutable),
3280-
(false, false) => BindByValue(MutImmutable),
3277+
(true, true) => BindingMode::ByRef(MutMutable),
3278+
(true, false) => BindingMode::ByRef(MutImmutable),
3279+
(false, true) => BindingMode::ByValue(MutMutable),
3280+
(false, false) => BindingMode::ByValue(MutImmutable),
32813281
};
32823282
let fieldpath = codemap::Spanned{span:self.last_span, node:fieldname};
32833283
let fieldpat = P(ast::Pat{
@@ -3372,11 +3372,11 @@ impl<'a> Parser<'a> {
33723372
// At this point, token != _, &, &&, (, [
33733373
if try!(self.eat_keyword(keywords::Mut)) {
33743374
// Parse mut ident @ pat
3375-
pat = try!(self.parse_pat_ident(BindByValue(MutMutable)));
3375+
pat = try!(self.parse_pat_ident(BindingMode::ByValue(MutMutable)));
33763376
} else if try!(self.eat_keyword(keywords::Ref)) {
33773377
// Parse ref ident @ pat / ref mut ident @ pat
33783378
let mutbl = try!(self.parse_mutability());
3379-
pat = try!(self.parse_pat_ident(BindByRef(mutbl)));
3379+
pat = try!(self.parse_pat_ident(BindingMode::ByRef(mutbl)));
33803380
} else if try!(self.eat_keyword(keywords::Box)) {
33813381
// Parse box pat
33823382
let subpat = try!(self.parse_pat());
@@ -3405,7 +3405,7 @@ impl<'a> Parser<'a> {
34053405
// Parse ident @ pat
34063406
// This can give false positives and parse nullary enums,
34073407
// they are dealt with later in resolve
3408-
pat = try!(self.parse_pat_ident(BindByValue(MutImmutable)));
3408+
pat = try!(self.parse_pat_ident(BindingMode::ByValue(MutImmutable)));
34093409
}
34103410
} else {
34113411
let (qself, path) = if try!(self.eat_lt()) {

src/libsyntax/print/pprust.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,12 +2467,12 @@ impl<'a> State<'a> {
24672467
ast::PatWild => try!(word(&mut self.s, "_")),
24682468
ast::PatIdent(binding_mode, ref path1, ref sub) => {
24692469
match binding_mode {
2470-
ast::BindByRef(mutbl) => {
2470+
ast::BindingMode::ByRef(mutbl) => {
24712471
try!(self.word_nbsp("ref"));
24722472
try!(self.print_mutability(mutbl));
24732473
}
2474-
ast::BindByValue(ast::MutImmutable) => {}
2475-
ast::BindByValue(ast::MutMutable) => {
2474+
ast::BindingMode::ByValue(ast::MutImmutable) => {}
2475+
ast::BindingMode::ByValue(ast::MutMutable) => {
24762476
try!(self.word_nbsp("mut"));
24772477
}
24782478
}
@@ -2678,7 +2678,7 @@ impl<'a> State<'a> {
26782678
let m = match *explicit_self {
26792679
ast::SelfStatic => ast::MutImmutable,
26802680
_ => match decl.inputs[0].pat.node {
2681-
ast::PatIdent(ast::BindByValue(m), _, _) => m,
2681+
ast::PatIdent(ast::BindingMode::ByValue(m), _, _) => m,
26822682
_ => ast::MutImmutable
26832683
}
26842684
};

src/libsyntax_ext/deriving/generic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ impl<'a> TraitDef<'a> {
14711471
-> Vec<P<ast::Pat>> {
14721472
field_paths.iter().map(|path| {
14731473
cx.pat(path.span,
1474-
ast::PatIdent(ast::BindByRef(mutbl), (*path).clone(), None))
1474+
ast::PatIdent(ast::BindingMode::ByRef(mutbl), (*path).clone(), None))
14751475
}).collect()
14761476
}
14771477

0 commit comments

Comments
 (0)