Skip to content

Commit 5892b40

Browse files
committed
Rename AstBuilder::expr_int -> AstBuilder::expr_isize
1 parent 4957ecc commit 5892b40

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/libsyntax/ext/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub trait AstBuilder {
146146
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
147147

148148
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
149-
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr>;
149+
fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr>;
150150
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
151151
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr>;
152152
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
@@ -698,7 +698,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
698698
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
699699
self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
700700
}
701-
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr> {
701+
fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
702702
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs,
703703
ast::Sign::new(i))))
704704
}

src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl<'a> TraitDef<'a> {
380380
pub fn expand(&self,
381381
cx: &mut ExtCtxt,
382382
mitem: &ast::MetaItem,
383-
item: &'a ast::Item,
383+
item: &'a ast::Item,
384384
push: &mut FnMut(P<ast::Item>))
385385
{
386386
let newitem = match item.node {
@@ -1407,7 +1407,9 @@ impl<'a> TraitDef<'a> {
14071407
struct_def: &'a StructDef,
14081408
prefix: &str,
14091409
mutbl: ast::Mutability)
1410-
-> (P<ast::Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [ast::Attribute])>) {
1410+
-> (P<ast::Pat>, Vec<(Span, Option<Ident>,
1411+
P<Expr>,
1412+
&'a [ast::Attribute])>) {
14111413
if struct_def.fields.is_empty() {
14121414
return (cx.pat_enum(self.span, struct_path, vec![]), vec![]);
14131415
}
@@ -1445,7 +1447,8 @@ impl<'a> TraitDef<'a> {
14451447
// struct_type is definitely not Unknown, since struct_def.fields
14461448
// must be nonempty to reach here
14471449
let pattern = if struct_type == Record {
1448-
let field_pats = subpats.into_iter().zip(ident_expr.iter()).map(|(pat, &(_, id, _, _))| {
1450+
let field_pats = subpats.into_iter().zip(ident_expr.iter())
1451+
.map(|(pat, &(_, id, _, _))| {
14491452
// id is guaranteed to be Some
14501453
codemap::Spanned {
14511454
span: pat.span,

src/test/auxiliary/custom_derive_plugin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn expand(cx: &mut ExtCtxt,
5555
ret_ty: Literal(Path::new_local("isize")),
5656
attributes: vec![],
5757
combine_substructure: combine_substructure(box |cx, span, substr| {
58-
let zero = cx.expr_int(span, 0);
58+
let zero = cx.expr_isize(span, 0);
5959
cs_fold(false,
6060
|cx, span, subexpr, field, _| {
6161
cx.expr_binary(span, ast::BiAdd, subexpr,

src/test/auxiliary/custom_derive_plugin_attr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ fn expand(cx: &mut ExtCtxt,
6666

6767
// Mostly copied from syntax::ext::deriving::hash
6868
/// Defines how the implementation for `trace()` is to be generated
69-
fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<ast::Expr> {
69+
fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span,
70+
substr: &Substructure) -> P<ast::Expr> {
7071
let fields = match *substr.fields {
7172
Struct(ref fs) | EnumMatching(_, _, ref fs) => fs,
7273
_ => cx.span_bug(trait_span, "impossible substructure")
7374
};
7475

75-
fields.iter().fold(cx.expr_int(trait_span, 0), |acc, ref item| {
76+
fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| {
7677
if item.attrs.iter().find(|a| a.check_name("ignore")).is_some() {
7778
acc
7879
} else {

0 commit comments

Comments
 (0)