diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-09-10 10:55:02 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-05-11 14:23:31 +0000 |
| commit | 79fa6ce7a140efb47c67567f80e59a4f19b452a6 (patch) | |
| tree | 50e68d84f0b9291be2895bc8a1e9e5ee0c41fe98 | |
| parent | f8d8ffa2eba53928662dc57bc3a6c5608beb26f1 (diff) | |
| download | rust-79fa6ce7a140efb47c67567f80e59a4f19b452a6.tar.gz rust-79fa6ce7a140efb47c67567f80e59a4f19b452a6.zip | |
Inline AllocFnFactory kind field
| -rw-r--r-- | compiler/rustc_builtin_macros/src/global_allocator.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_builtin_macros/src/global_allocator.rs b/compiler/rustc_builtin_macros/src/global_allocator.rs index 866cc5adbf3..1dd6a700e65 100644 --- a/compiler/rustc_builtin_macros/src/global_allocator.rs +++ b/compiler/rustc_builtin_macros/src/global_allocator.rs @@ -40,8 +40,7 @@ pub fn expand( // Generate a bunch of new items using the AllocFnFactory let span = ecx.with_def_site_ctxt(item.span); - let f = - AllocFnFactory { span, ty_span, kind: AllocatorKind::Global, global: item.ident, cx: ecx }; + let f = AllocFnFactory { span, ty_span, global: item.ident, cx: ecx }; // Generate item statements for the allocator methods. let stmts = ALLOCATOR_METHODS.iter().map(|method| f.allocator_fn(method)).collect(); @@ -63,7 +62,6 @@ pub fn expand( struct AllocFnFactory<'a, 'b> { span: Span, ty_span: Span, - kind: AllocatorKind, global: Ident, cx: &'b ExtCtxt<'a>, } @@ -92,7 +90,7 @@ impl AllocFnFactory<'_, '_> { })); let item = self.cx.item( self.span, - Ident::from_str_and_span(&self.kind.fn_name(method.name), self.span), + Ident::from_str_and_span(&AllocatorKind::Global.fn_name(method.name), self.span), self.attrs(), kind, ); |
