name: "cmp",
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![borrowed_self()],
+ args: vec![(borrowed_self(), "other")],
ret_ty: Literal(path_std!(cx, cmp::Ordering)),
attributes: attrs,
is_unsafe: false,
name: $name,
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![borrowed_self()],
+ args: vec![(borrowed_self(), "_other")],
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
is_unsafe: false,
name: $name,
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![borrowed_self()],
+ args: vec![(borrowed_self(), "other")],
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
is_unsafe: false,
name: "partial_cmp",
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![borrowed_self()],
+ args: vec![(borrowed_self(), "other")],
ret_ty,
attributes: attrs,
is_unsafe: false,
name: "fmt",
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![fmtr],
+ args: vec![(fmtr, "_f")],
ret_ty: Literal(path_std!(cx, fmt::Result)),
attributes: Vec::new(),
is_unsafe: false,
PathKind::Global)])],
},
explicit_self: None,
- args: vec![Ptr(Box::new(Literal(Path::new_local(typaram))),
- Borrowed(None, Mutability::Mutable))],
+ args: vec![(Ptr(Box::new(Literal(Path::new_local(typaram))),
+ Borrowed(None, Mutability::Mutable)), "d")],
ret_ty:
Literal(Path::new_(pathvec_std!(cx, result::Result),
None,
],
},
explicit_self: borrowed_explicit_self(),
- args: vec![Ptr(Box::new(Literal(Path::new_local(typaram))),
- Borrowed(None, Mutability::Mutable))],
+ args: vec![(Ptr(Box::new(Literal(Path::new_local(typaram))),
+ Borrowed(None, Mutability::Mutable)), "s")],
ret_ty: Literal(Path::new_(
pathvec_std!(cx, result::Result),
None,
pub explicit_self: Option<Option<PtrTy<'a>>>,
/// Arguments other than the self argument
- pub args: Vec<Ty<'a>>,
+ pub args: Vec<(Ty<'a>, &'a str)>,
/// Return type
pub ret_ty: Ty<'a>,
explicit_self
});
- for (i, ty) in self.args.iter().enumerate() {
+ for (ty, name) in self.args.iter() {
let ast_ty = ty.to_ty(cx, trait_.span, type_ident, generics);
- let ident = cx.ident_of(&format!("__arg_{}", i));
+ let ident = cx.ident_of(name).gensym();
arg_tys.push((ident, ast_ty));
let arg_expr = cx.expr_ident(trait_.span, ident);
bounds: vec![(typaram, vec![path_std!(cx, hash::Hasher)])],
},
explicit_self: borrowed_explicit_self(),
- args: vec![Ptr(Box::new(Literal(arg)),
- Borrowed(None, Mutability::Mutable))],
+ args: vec![(Ptr(Box::new(Literal(arg)),
+ Borrowed(None, Mutability::Mutable)), "_state")],
ret_ty: nil_ty(),
attributes: vec![],
is_unsafe: false,
pub fn modern(self) -> Ident {
Ident::new(self.name, self.span.modern())
}
+
+ pub fn gensym(self) -> Ident {
+ Ident::new(self.name.gensymed(), self.span)
+ }
}
impl PartialEq for Ident {
name: "eq",
generics: LifetimeBounds::empty(),
explicit_self: borrowed_explicit_self(),
- args: vec![borrowed_self()],
+ args: vec![(borrowed_self(), "other")],
ret_ty: Literal(deriving::generic::ty::Path::new_local("bool")),
attributes: attrs,
is_unsafe: false,