diff options
Diffstat (limited to 'compiler/rustc_builtin_macros/src/global_allocator.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/global_allocator.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_builtin_macros/src/global_allocator.rs b/compiler/rustc_builtin_macros/src/global_allocator.rs index 4b1958bce32..f14b1920722 100644 --- a/compiler/rustc_builtin_macros/src/global_allocator.rs +++ b/compiler/rustc_builtin_macros/src/global_allocator.rs @@ -1,7 +1,6 @@ use rustc_ast::expand::allocator::{ ALLOCATOR_METHODS, AllocatorMethod, AllocatorMethodInput, AllocatorTy, global_fn_name, }; -use rustc_ast::ptr::P; use rustc_ast::{ self as ast, AttrVec, Expr, Fn, FnHeader, FnSig, Generics, ItemKind, Mutability, Param, Safety, Stmt, StmtKind, Ty, TyKind, @@ -51,7 +50,7 @@ pub(crate) fn expand( let const_body = ecx.expr_block(ecx.block(span, stmts)); let const_item = ecx.item_const(span, Ident::new(kw::Underscore, span), const_ty, const_body); let const_item = if is_stmt { - Annotatable::Stmt(P(ecx.stmt_item(span, const_item))) + Annotatable::Stmt(Box::new(ecx.stmt_item(span, const_item))) } else { Annotatable::Item(const_item) }; @@ -90,7 +89,7 @@ impl AllocFnFactory<'_, '_> { self.cx.stmt_item(self.ty_span, item) } - fn call_allocator(&self, method: Symbol, mut args: ThinVec<P<Expr>>) -> P<Expr> { + fn call_allocator(&self, method: Symbol, mut args: ThinVec<Box<Expr>>) -> Box<Expr> { let method = self.cx.std_path(&[sym::alloc, sym::GlobalAlloc, method]); let method = self.cx.expr_path(self.cx.path(self.ty_span, method)); let allocator = self.cx.path_ident(self.ty_span, self.global); @@ -105,7 +104,7 @@ impl AllocFnFactory<'_, '_> { thin_vec![self.cx.attr_word(sym::rustc_std_internal_symbol, self.span)] } - fn arg_ty(&self, input: &AllocatorMethodInput, args: &mut ThinVec<Param>) -> P<Expr> { + fn arg_ty(&self, input: &AllocatorMethodInput, args: &mut ThinVec<Param>) -> Box<Expr> { match input.ty { AllocatorTy::Layout => { // If an allocator method is ever introduced having multiple @@ -148,7 +147,7 @@ impl AllocFnFactory<'_, '_> { } } - fn ret_ty(&self, ty: &AllocatorTy) -> P<Ty> { + fn ret_ty(&self, ty: &AllocatorTy) -> Box<Ty> { match *ty { AllocatorTy::ResultPtr => self.ptr_u8(), @@ -160,12 +159,12 @@ impl AllocFnFactory<'_, '_> { } } - fn usize(&self) -> P<Ty> { + fn usize(&self) -> Box<Ty> { let usize = self.cx.path_ident(self.span, Ident::new(sym::usize, self.span)); self.cx.ty_path(usize) } - fn ptr_u8(&self) -> P<Ty> { + fn ptr_u8(&self) -> Box<Ty> { let u8 = self.cx.path_ident(self.span, Ident::new(sym::u8, self.span)); let ty_u8 = self.cx.ty_path(u8); self.cx.ty_ptr(self.span, ty_u8, Mutability::Mut) |
