]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_builtin_macros/src/global_allocator.rs
Rollup merge of #90683 - jyn514:compiler-docs, r=Mark-Simulacrum
[rust.git] / compiler / rustc_builtin_macros / src / global_allocator.rs
index a97cac7e514c98082c8591acaa441840ac9edacc..a433876147f8d903edbc8568485649f5eef0cf92 100644 (file)
@@ -5,7 +5,7 @@
 };
 use rustc_ast::ptr::P;
 use rustc_ast::{self as ast, Attribute, Expr, FnHeader, FnSig, Generics, Param, StmtKind};
-use rustc_ast::{FnKind, ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe};
+use rustc_ast::{Fn, ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe};
 use rustc_expand::base::{Annotatable, ExtCtxt};
 use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::Span;
@@ -84,9 +84,13 @@ fn allocator_fn(&self, method: &AllocatorMethod) -> Stmt {
         let decl = self.cx.fn_decl(abi_args, ast::FnRetTy::Ty(output_ty));
         let header = FnHeader { unsafety: Unsafe::Yes(self.span), ..FnHeader::default() };
         let sig = FnSig { decl, header, span: self.span };
-        let block = Some(self.cx.block_expr(output_expr));
-        let kind =
-            ItemKind::Fn(box FnKind(ast::Defaultness::Final, sig, Generics::default(), block));
+        let body = Some(self.cx.block_expr(output_expr));
+        let kind = ItemKind::Fn(Box::new(Fn {
+            defaultness: ast::Defaultness::Final,
+            sig,
+            generics: Generics::default(),
+            body,
+        }));
         let item = self.cx.item(
             self.span,
             Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span),