[breaking-change] don't pub export ast::IntLitType variants
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
pub use self::ForeignItem_::*;
|
||||
pub use self::Item_::*;
|
||||
pub use self::KleeneOp::*;
|
||||
pub use self::LitIntType::*;
|
||||
pub use self::MacStmtStyle::*;
|
||||
pub use self::MetaItem_::*;
|
||||
pub use self::Mutability::*;
|
||||
@@ -1267,9 +1266,9 @@ pub type Lit = Spanned<LitKind>;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||
pub enum LitIntType {
|
||||
SignedIntLit(IntTy),
|
||||
UnsignedIntLit(UintTy),
|
||||
UnsuffixedIntLit,
|
||||
Signed(IntTy),
|
||||
Unsigned(UintTy),
|
||||
Unsuffixed,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
|
||||
@@ -680,7 +680,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
self.expr(sp, ast::ExprKind::Lit(P(respan(sp, lit))))
|
||||
}
|
||||
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
|
||||
self.expr_lit(span, ast::LitKind::Int(i as u64, ast::UnsignedIntLit(ast::UintTy::Us)))
|
||||
self.expr_lit(span, ast::LitKind::Int(i as u64, ast::LitIntType::Unsigned(ast::UintTy::Us)))
|
||||
}
|
||||
fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
|
||||
if i < 0 {
|
||||
@@ -689,14 +689,14 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
let lit = self.expr_lit(sp, ast::LitKind::Int(i, lit_ty));
|
||||
self.expr_unary(sp, ast::UnOp::Neg, lit)
|
||||
} else {
|
||||
self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::SignedIntLit(ast::IntTy::Is)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::LitIntType::Signed(ast::IntTy::Is)))
|
||||
}
|
||||
}
|
||||
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U32)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::LitIntType::Unsigned(ast::UintTy::U32)))
|
||||
}
|
||||
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U8)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::LitIntType::Unsigned(ast::UintTy::U8)))
|
||||
}
|
||||
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitKind::Bool(value))
|
||||
|
||||
@@ -268,7 +268,7 @@ pub mod rt {
|
||||
} else {
|
||||
*self
|
||||
};
|
||||
let lit = ast::LitKind::Int(val as u64, ast::SignedIntLit($tag));
|
||||
let lit = ast::LitKind::Int(val as u64, ast::LitIntType::Signed($tag));
|
||||
let lit = P(ast::Expr {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: ast::ExprKind::Lit(P(dummy_spanned(lit))),
|
||||
@@ -290,7 +290,7 @@ pub mod rt {
|
||||
(unsigned, $t:ty, $tag:expr) => (
|
||||
impl ToTokens for $t {
|
||||
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||
let lit = ast::LitKind::Int(*self as u64, ast::UnsignedIntLit($tag));
|
||||
let lit = ast::LitKind::Int(*self as u64, ast::LitIntType::Unsigned($tag));
|
||||
dummy_spanned(lit).to_tokens(cx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ pub fn integer_lit(s: &str,
|
||||
|
||||
let mut base = 10;
|
||||
let orig = s;
|
||||
let mut ty = ast::UnsuffixedIntLit;
|
||||
let mut ty = ast::LitIntType::Unsuffixed;
|
||||
|
||||
if char_at(s, 0) == '0' && s.len() > 1 {
|
||||
match char_at(s, 1) {
|
||||
@@ -618,16 +618,16 @@ pub fn integer_lit(s: &str,
|
||||
if let Some(ref suf) = suffix {
|
||||
if suf.is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")}
|
||||
ty = match &**suf {
|
||||
"isize" => ast::SignedIntLit(ast::IntTy::Is),
|
||||
"i8" => ast::SignedIntLit(ast::IntTy::I8),
|
||||
"i16" => ast::SignedIntLit(ast::IntTy::I16),
|
||||
"i32" => ast::SignedIntLit(ast::IntTy::I32),
|
||||
"i64" => ast::SignedIntLit(ast::IntTy::I64),
|
||||
"usize" => ast::UnsignedIntLit(ast::UintTy::Us),
|
||||
"u8" => ast::UnsignedIntLit(ast::UintTy::U8),
|
||||
"u16" => ast::UnsignedIntLit(ast::UintTy::U16),
|
||||
"u32" => ast::UnsignedIntLit(ast::UintTy::U32),
|
||||
"u64" => ast::UnsignedIntLit(ast::UintTy::U64),
|
||||
"isize" => ast::LitIntType::Signed(ast::IntTy::Is),
|
||||
"i8" => ast::LitIntType::Signed(ast::IntTy::I8),
|
||||
"i16" => ast::LitIntType::Signed(ast::IntTy::I16),
|
||||
"i32" => ast::LitIntType::Signed(ast::IntTy::I32),
|
||||
"i64" => ast::LitIntType::Signed(ast::IntTy::I64),
|
||||
"usize" => ast::LitIntType::Unsigned(ast::UintTy::Us),
|
||||
"u8" => ast::LitIntType::Unsigned(ast::UintTy::U8),
|
||||
"u16" => ast::LitIntType::Unsigned(ast::UintTy::U16),
|
||||
"u32" => ast::LitIntType::Unsigned(ast::UintTy::U32),
|
||||
"u64" => ast::LitIntType::Unsigned(ast::UintTy::U64),
|
||||
_ => {
|
||||
// i<digits> and u<digits> look like widths, so lets
|
||||
// give an error message along those lines
|
||||
|
||||
@@ -2014,7 +2014,7 @@ impl<'a> Parser<'a> {
|
||||
pub fn mk_lit_u32(&mut self, i: u32, attrs: ThinAttributes) -> P<Expr> {
|
||||
let span = &self.span;
|
||||
let lv_lit = P(codemap::Spanned {
|
||||
node: LitKind::Int(i as u64, ast::UnsignedIntLit(UintTy::U32)),
|
||||
node: LitKind::Int(i as u64, ast::LitIntType::Unsigned(UintTy::U32)),
|
||||
span: *span
|
||||
});
|
||||
|
||||
|
||||
@@ -645,14 +645,14 @@ pub trait PrintState<'a> {
|
||||
}
|
||||
ast::LitKind::Int(i, t) => {
|
||||
match t {
|
||||
ast::SignedIntLit(st) => {
|
||||
ast::LitIntType::Signed(st) => {
|
||||
word(self.writer(),
|
||||
&st.val_to_string(i as i64))
|
||||
}
|
||||
ast::UnsignedIntLit(ut) => {
|
||||
ast::LitIntType::Unsigned(ut) => {
|
||||
word(self.writer(), &ut.val_to_string(i))
|
||||
}
|
||||
ast::UnsuffixedIntLit => {
|
||||
ast::LitIntType::Unsuffixed => {
|
||||
word(self.writer(), &format!("{}", i))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user