[breaking-change] don't pub export ast::Lit_ variants
This commit is contained in:
parent
05d4cefd63
commit
69072c4f5d
26 changed files with 142 additions and 142 deletions
|
|
@ -349,7 +349,7 @@ impl DummyResult {
|
|||
pub fn raw_expr(sp: Span) -> P<ast::Expr> {
|
||||
P(ast::Expr {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitBool(false)))),
|
||||
node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitKind::Bool(false)))),
|
||||
span: sp,
|
||||
attrs: None,
|
||||
})
|
||||
|
|
@ -774,7 +774,7 @@ pub fn expr_to_string(cx: &mut ExtCtxt, expr: P<ast::Expr>, err_msg: &str)
|
|||
let expr = cx.expander().fold_expr(expr);
|
||||
match expr.node {
|
||||
ast::ExprKind::Lit(ref l) => match l.node {
|
||||
ast::LitStr(ref s, style) => return Some(((*s).clone(), style)),
|
||||
ast::LitKind::Str(ref s, style) => return Some(((*s).clone(), style)),
|
||||
_ => cx.span_err(l.span, err_msg)
|
||||
},
|
||||
_ => cx.span_err(expr.span, err_msg)
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ pub trait AstBuilder {
|
|||
fn expr_struct_ident(&self, span: Span, id: ast::Ident,
|
||||
fields: Vec<ast::Field>) -> P<ast::Expr>;
|
||||
|
||||
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
|
||||
fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P<ast::Expr>;
|
||||
|
||||
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
|
||||
fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr>;
|
||||
|
|
@ -285,7 +285,7 @@ pub trait AstBuilder {
|
|||
fn meta_name_value(&self,
|
||||
sp: Span,
|
||||
name: InternedString,
|
||||
value: ast::Lit_)
|
||||
value: ast::LitKind)
|
||||
-> P<ast::MetaItem>;
|
||||
|
||||
fn item_use(&self, sp: Span,
|
||||
|
|
@ -676,29 +676,30 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
self.expr_struct(span, self.path_ident(span, id), fields)
|
||||
}
|
||||
|
||||
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr> {
|
||||
fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P<ast::Expr> {
|
||||
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::LitInt(i as u64, ast::UnsignedIntLit(ast::UintTy::Us)))
|
||||
self.expr_lit(span, ast::LitKind::Int(i as u64, ast::UnsignedIntLit(ast::UintTy::Us)))
|
||||
}
|
||||
fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
|
||||
if i < 0 {
|
||||
let i = (-i) as u64;
|
||||
let lit = self.expr_lit(sp, ast::LitInt(i, ast::SignedIntLit(ast::IntTy::Is)));
|
||||
let lit_ty = ast::LitIntType::Signed(ast::IntTy::Is);
|
||||
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::LitInt(i as u64, ast::SignedIntLit(ast::IntTy::Is)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::SignedIntLit(ast::IntTy::Is)))
|
||||
}
|
||||
}
|
||||
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::UintTy::U32)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U32)))
|
||||
}
|
||||
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::UintTy::U8)))
|
||||
self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U8)))
|
||||
}
|
||||
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitBool(value))
|
||||
self.expr_lit(sp, ast::LitKind::Bool(value))
|
||||
}
|
||||
|
||||
fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> {
|
||||
|
|
@ -712,7 +713,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
self.expr_addr_of(sp, self.expr_vec(sp, exprs))
|
||||
}
|
||||
fn expr_str(&self, sp: Span, s: InternedString) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitStr(s, ast::CookedStr))
|
||||
self.expr_lit(sp, ast::LitKind::Str(s, ast::CookedStr))
|
||||
}
|
||||
|
||||
fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr> {
|
||||
|
|
@ -1113,7 +1114,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
fn meta_name_value(&self,
|
||||
sp: Span,
|
||||
name: InternedString,
|
||||
value: ast::Lit_)
|
||||
value: ast::LitKind)
|
||||
-> P<ast::MetaItem> {
|
||||
P(respan(sp, ast::MetaNameValue(name, respan(sp, value))))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ pub mod rt {
|
|||
|
||||
impl ToTokens for str {
|
||||
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||
let lit = ast::LitStr(
|
||||
let lit = ast::LitKind::Str(
|
||||
token::intern_and_get_ident(self), ast::CookedStr);
|
||||
dummy_spanned(lit).to_tokens(cx)
|
||||
}
|
||||
|
|
@ -249,13 +249,13 @@ pub mod rt {
|
|||
|
||||
impl ToTokens for bool {
|
||||
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||
dummy_spanned(ast::LitBool(*self)).to_tokens(cx)
|
||||
dummy_spanned(ast::LitKind::Bool(*self)).to_tokens(cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToTokens for char {
|
||||
fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
|
||||
dummy_spanned(ast::LitChar(*self)).to_tokens(cx)
|
||||
dummy_spanned(ast::LitKind::Char(*self)).to_tokens(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ pub mod rt {
|
|||
} else {
|
||||
*self
|
||||
};
|
||||
let lit = ast::LitInt(val as u64, ast::SignedIntLit($tag));
|
||||
let lit = ast::LitKind::Int(val as u64, ast::SignedIntLit($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::LitInt(*self as u64, ast::UnsignedIntLit($tag));
|
||||
let lit = ast::LitKind::Int(*self as u64, ast::UnsignedIntLit($tag));
|
||||
dummy_spanned(lit).to_tokens(cx)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||
let filename = format!("{}", file.display());
|
||||
cx.codemap().new_filemap_and_lines(&filename, "");
|
||||
|
||||
base::MacEager::expr(cx.expr_lit(sp, ast::LitByteStr(Rc::new(bytes))))
|
||||
base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Rc::new(bytes))))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue