1
Fork 0

Provide better names for builtin deriving-generated attributes

This commit is contained in:
James Sanderson 2018-04-15 20:51:10 +01:00
parent 21dae950be
commit 4ae9488ce8
10 changed files with 19 additions and 15 deletions

View file

@ -252,7 +252,7 @@ pub struct MethodDef<'a> {
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>,
@ -915,9 +915,9 @@ impl<'a> MethodDef<'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);