diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-25 23:21:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-25 23:21:00 +0200 |
| commit | e1de70b04548b2e899fcf0da09c29600cc05325e (patch) | |
| tree | a74148f96104c5972f121069a0cfcab089d8082e /src/libsyntax_ext/lib.rs | |
| parent | 6f0e57fb1dc3b30126e6ec6c9dd2ad0309da2c0c (diff) | |
| parent | a0c2c640d54fa1622c2fea4accae1025bf109c47 (diff) | |
| download | rust-e1de70b04548b2e899fcf0da09c29600cc05325e.tar.gz rust-e1de70b04548b2e899fcf0da09c29600cc05325e.zip | |
Rollup merge of #62735 - petrochenkov:galloc, r=alexcrichton
Turn `#[global_allocator]` into a regular attribute macro It was a 99% macro with exception of some diagnostic details. As a result of the change, `#[global_allocator]` now works in nested modules and even in nameless blocks. Fixes https://github.com/rust-lang/rust/issues/44113 Fixes https://github.com/rust-lang/rust/issues/58072
Diffstat (limited to 'src/libsyntax_ext/lib.rs')
| -rw-r--r-- | src/libsyntax_ext/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 7de90278ed7..400bfe796bb 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -29,6 +29,7 @@ mod concat_idents; mod env; mod format; mod format_foreign; +mod global_allocator; mod global_asm; mod log_syntax; mod proc_macro_server; @@ -151,6 +152,12 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver, SyntaxExtensionKind::LegacyAttr(Box::new(test::expand_bench)), edition ) }); + register(sym::global_allocator, SyntaxExtension { + allow_internal_unstable: Some([sym::rustc_attrs][..].into()), + ..SyntaxExtension::default( + SyntaxExtensionKind::LegacyAttr(Box::new(global_allocator::expand)), edition + ) + }); let allow_internal_unstable = Some([sym::fmt_internals][..].into()); register(sym::format_args, SyntaxExtension { |
