diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-08 13:21:29 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | f875f4c4c24e8a14c04bbe4eedd230c4aa3c1431 (patch) | |
| tree | 49aa5846267f8660ddf5c1a69e87348a1ea30081 /src/libsyntax | |
| parent | 060848c31534284ed06cd63c5dbb41e2e839d2b0 (diff) | |
| download | rust-f875f4c4c24e8a14c04bbe4eedd230c4aa3c1431.tar.gz rust-f875f4c4c24e8a14c04bbe4eedd230c4aa3c1431.zip | |
[breaking-change] don't glob export ast::UnOp variants
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 15 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 088f911ed8c..2b3ca63c26f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -38,7 +38,6 @@ pub use self::TraitItem_::*; pub use self::Ty_::*; pub use self::TyParamBound::*; pub use self::UintTy::*; -pub use self::UnOp::*; pub use self::UnsafeSource::*; pub use self::ViewPath_::*; pub use self::Visibility::*; @@ -723,27 +722,27 @@ pub type BinOp = Spanned<BinOp_>; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum UnOp { /// The `*` operator for dereferencing - UnDeref, + Deref, /// The `!` operator for logical inversion - UnNot, + Not, /// The `-` operator for negation - UnNeg + Neg, } impl UnOp { /// Returns `true` if the unary operator takes its argument by value pub fn is_by_value(u: UnOp) -> bool { match u { - UnNeg | UnNot => true, + UnOp::Neg | UnOp::Not => true, _ => false, } } pub fn to_string(op: UnOp) -> &'static str { match op { - UnDeref => "*", - UnNot => "!", - UnNeg => "-", + UnOp::Deref => "*", + UnOp::Not => "!", + UnOp::Neg => "-", } } } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index a74c2340cec..2ce2e7f71f3 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -10,6 +10,7 @@ use abi; use ast::{Ident, Generics, Expr}; +use ast::UnOp; use ast; use attr; use codemap::{Span, respan, Spanned, DUMMY_SP, Pos}; @@ -610,7 +611,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn expr_deref(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> { - self.expr_unary(sp, ast::UnDeref, e) + self.expr_unary(sp, UnOp::Deref, e) } fn expr_unary(&self, sp: Span, op: ast::UnOp, e: P<ast::Expr>) -> P<ast::Expr> { self.expr(sp, ast::ExprUnary(op, e)) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 82bfc26ee34..c174e35d93b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -13,13 +13,13 @@ pub use self::PathParsingMode::*; use abi; use ast::BareFnTy; use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier}; -use ast::{Public, Unsafety}; +use ast::{Public, Unsafety, UnOp}; use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindingMode}; use ast::{BiBitAnd, BiBitOr, BiBitXor, BiRem, BiLt, Block}; use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause}; use ast::{Constness, ConstTraitItem, Crate, CrateConfig}; use ast::{Decl, DeclItem, DeclLocal, DefaultBlock, DefaultReturn}; -use ast::{UnDeref, BiDiv, EMPTY_CTXT, EnumDef, ExplicitSelf}; +use ast::{BiDiv, EMPTY_CTXT, EnumDef, ExplicitSelf}; use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain}; use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox}; use ast::{ExprBreak, ExprCall, ExprCast, ExprInPlace}; @@ -39,7 +39,7 @@ use ast::{LitStr, LitInt, Local}; use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces}; use ast::{MutImmutable, MutMutable, Mac_}; use ast::{MutTy, BiMul, Mutability}; -use ast::{NamedField, UnNeg, NoReturn, UnNot}; +use ast::{NamedField, NoReturn}; use ast::{Pat, PatBox, PatEnum, PatIdent, PatLit, PatQPath, PatMac, PatRange}; use ast::{PatRegion, PatStruct, PatTup, PatVec, PatWild}; use ast::{PolyTraitRef, QSelf}; @@ -1608,7 +1608,7 @@ impl<'a> Parser<'a> { if minus_present { let minus_hi = self.last_span.hi; - let unary = self.mk_unary(UnNeg, expr); + let unary = self.mk_unary(UnOp::Neg, expr); Ok(self.mk_expr(minus_lo, minus_hi, unary, None)) } else { Ok(expr) @@ -2740,21 +2740,21 @@ impl<'a> Parser<'a> { let e = self.parse_prefix_expr(None); let (span, e) = try!(self.interpolated_or_expr_span(e)); hi = span.hi; - self.mk_unary(UnNot, e) + self.mk_unary(UnOp::Not, e) } token::BinOp(token::Minus) => { self.bump(); let e = self.parse_prefix_expr(None); let (span, e) = try!(self.interpolated_or_expr_span(e)); hi = span.hi; - self.mk_unary(UnNeg, e) + self.mk_unary(UnOp::Neg, e) } token::BinOp(token::Star) => { self.bump(); let e = self.parse_prefix_expr(None); let (span, e) = try!(self.interpolated_or_expr_span(e)); hi = span.hi; - self.mk_unary(UnDeref, e) + self.mk_unary(UnOp::Deref, e) } token::BinOp(token::And) | token::AndAnd => { try!(self.expect_and()); |
