diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-11-07 16:43:49 +0800 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-11-07 21:38:17 +0800 |
| commit | 2834f57c4584e33471f8bdc3cc57617fc0863fde (patch) | |
| tree | 5738ca3f53407100f180c11a985b1d906aa08202 /compiler/rustc_builtin_macros/src/global_allocator.rs | |
| parent | 90a273b785b3bc482b82c4896ba1bdea68745e46 (diff) | |
| download | rust-2834f57c4584e33471f8bdc3cc57617fc0863fde.tar.gz rust-2834f57c4584e33471f8bdc3cc57617fc0863fde.zip | |
ast: Fix naming conventions in AST structures
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
Diffstat (limited to 'compiler/rustc_builtin_macros/src/global_allocator.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/global_allocator.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_builtin_macros/src/global_allocator.rs b/compiler/rustc_builtin_macros/src/global_allocator.rs index 3f71ee6f489..a433876147f 100644 --- a/compiler/rustc_builtin_macros/src/global_allocator.rs +++ b/compiler/rustc_builtin_macros/src/global_allocator.rs @@ -5,7 +5,7 @@ use rustc_ast::expand::allocator::{ }; 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,13 +84,13 @@ impl AllocFnFactory<'_, '_> { 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::new(FnKind( - ast::Defaultness::Final, + let body = Some(self.cx.block_expr(output_expr)); + let kind = ItemKind::Fn(Box::new(Fn { + defaultness: ast::Defaultness::Final, sig, - Generics::default(), - block, - ))); + generics: Generics::default(), + body, + })); let item = self.cx.item( self.span, Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span), |
