Cleanup: Consistently use Param instead of Arg #62426

This commit is contained in:
Kevin Per
2019-08-27 13:24:32 +02:00
parent 0444b9f66a
commit e0ce9f8c0a
53 changed files with 379 additions and 376 deletions

View File

@@ -929,10 +929,10 @@ impl<'a> MethodDef<'a> {
let args = {
let self_args = explicit_self.map(|explicit_self| {
let ident = Ident::with_dummy_span(kw::SelfLower).with_span_pos(trait_.span);
ast::Arg::from_self(ThinVec::default(), explicit_self, ident)
ast::Param::from_self(ThinVec::default(), explicit_self, ident)
});
let nonself_args = arg_types.into_iter()
.map(|(name, ty)| cx.arg(trait_.span, name, ty));
.map(|(name, ty)| cx.param(trait_.span, name, ty));
self_args.into_iter().chain(nonself_args).collect()
};

View File

@@ -1,5 +1,5 @@
use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety};
use syntax::ast::{self, Arg, Attribute, Expr, FnHeader, Generics, Ident};
use syntax::ast::{self, Param, Attribute, Expr, FnHeader, Generics, Ident};
use syntax::attr::check_builtin_macro_attribute;
use syntax::ext::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
use syntax::ext::base::{Annotatable, ExtCtxt};
@@ -114,7 +114,7 @@ impl AllocFnFactory<'_, '_> {
fn arg_ty(
&self,
ty: &AllocatorTy,
args: &mut Vec<Arg>,
args: &mut Vec<Param>,
ident: &mut dyn FnMut() -> Ident,
) -> P<Expr> {
match *ty {
@@ -123,8 +123,8 @@ impl AllocFnFactory<'_, '_> {
let ty_usize = self.cx.ty_path(usize);
let size = ident();
let align = ident();
args.push(self.cx.arg(self.span, size, ty_usize.clone()));
args.push(self.cx.arg(self.span, align, ty_usize));
args.push(self.cx.param(self.span, size, ty_usize.clone()));
args.push(self.cx.param(self.span, align, ty_usize));
let layout_new = self.cx.std_path(&[
Symbol::intern("alloc"),
@@ -140,14 +140,14 @@ impl AllocFnFactory<'_, '_> {
AllocatorTy::Ptr => {
let ident = ident();
args.push(self.cx.arg(self.span, ident, self.ptr_u8()));
args.push(self.cx.param(self.span, ident, self.ptr_u8()));
let arg = self.cx.expr_ident(self.span, ident);
self.cx.expr_cast(self.span, arg, self.ptr_u8())
}
AllocatorTy::Usize => {
let ident = ident();
args.push(self.cx.arg(self.span, ident, self.usize()));
args.push(self.cx.param(self.span, ident, self.usize()));
self.cx.expr_ident(self.span, ident)
}