*local_id_counter += 1;
hir::HirId {
owner: def_index,
- local_id: hir::ItemLocalId(local_id),
+ local_id: hir::ItemLocalId::from_u32(local_id),
}
})
}
hir::HirId {
owner: def_index,
- local_id: hir::ItemLocalId(local_id),
+ local_id: hir::ItemLocalId::from_u32(local_id),
}
})
}
attrs
.iter()
.map(|a| self.lower_attr(a))
- .collect::<Vec<_>>()
- .into()
+ .collect()
}
fn lower_attr(&mut self, attr: &Attribute) -> Attribute {
//! The `i32`s in `B` and `C0` don't have an identifier, so the
//! `Option<ident>`s would be `None` for them.
//!
-//! In the static cases, the structure is summarised, either into the just
+//! In the static cases, the structure is summarized, either into the just
//! spans of the fields or a list of spans and the field idents (for tuple
//! structs and record structs, respectively), or a list of these, for
//! enums (one for each variant). For empty struct and empty enum
let sp = trait_.span;
let variants = &enum_def.variants;
- let self_arg_names = self_args.iter()
- .enumerate()
- .map(|(arg_count, _self_arg)| {
- if arg_count == 0 {
- "__self".to_string()
- } else {
+ let self_arg_names = iter::once("__self".to_string()).chain(
+ self_args.iter()
+ .enumerate()
+ .skip(1)
+ .map(|(arg_count, _self_arg)|
format!("__arg_{}", arg_count)
- }
- })
- .collect::<Vec<String>>();
+ )
+ ).collect::<Vec<String>>();
let self_arg_idents = self_arg_names.iter()
.map(|name| cx.ident_of(&name[..]))
// The `vi_idents` will be bound, solely in the catch-all, to
// a series of let statements mapping each self_arg to an int
// value corresponding to its discriminant.
- let vi_idents: Vec<ast::Ident> = self_arg_names.iter()
+ let vi_idents = self_arg_names.iter()
.map(|name| {
let vi_suffix = format!("{}_vi", &name[..]);
cx.ident_of(&vi_suffix[..]).gensym()