fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
- fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr>;
+ fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr>;
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr>;
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
}
- fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr> {
+ fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs,
ast::Sign::new(i))))
}
pub fn expand(&self,
cx: &mut ExtCtxt,
mitem: &ast::MetaItem,
- item: &'a ast::Item,
+ item: &'a ast::Item,
push: &mut FnMut(P<ast::Item>))
{
let newitem = match item.node {
struct_def: &'a StructDef,
prefix: &str,
mutbl: ast::Mutability)
- -> (P<ast::Pat>, Vec<(Span, Option<Ident>, P<Expr>, &'a [ast::Attribute])>) {
+ -> (P<ast::Pat>, Vec<(Span, Option<Ident>,
+ P<Expr>,
+ &'a [ast::Attribute])>) {
if struct_def.fields.is_empty() {
return (cx.pat_enum(self.span, struct_path, vec![]), vec![]);
}
// struct_type is definitely not Unknown, since struct_def.fields
// must be nonempty to reach here
let pattern = if struct_type == Record {
- let field_pats = subpats.into_iter().zip(ident_expr.iter()).map(|(pat, &(_, id, _, _))| {
+ let field_pats = subpats.into_iter().zip(ident_expr.iter())
+ .map(|(pat, &(_, id, _, _))| {
// id is guaranteed to be Some
codemap::Spanned {
span: pat.span,
ret_ty: Literal(Path::new_local("isize")),
attributes: vec![],
combine_substructure: combine_substructure(box |cx, span, substr| {
- let zero = cx.expr_int(span, 0);
+ let zero = cx.expr_isize(span, 0);
cs_fold(false,
|cx, span, subexpr, field, _| {
cx.expr_binary(span, ast::BiAdd, subexpr,
// Mostly copied from syntax::ext::deriving::hash
/// Defines how the implementation for `trace()` is to be generated
-fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<ast::Expr> {
+fn totalsum_substructure(cx: &mut ExtCtxt, trait_span: Span,
+ substr: &Substructure) -> P<ast::Expr> {
let fields = match *substr.fields {
Struct(ref fs) | EnumMatching(_, _, ref fs) => fs,
_ => cx.span_bug(trait_span, "impossible substructure")
};
- fields.iter().fold(cx.expr_int(trait_span, 0), |acc, ref item| {
+ fields.iter().fold(cx.expr_isize(trait_span, 0), |acc, ref item| {
if item.attrs.iter().find(|a| a.check_name("ignore")).is_some() {
acc
} else {