]> git.lizzy.rs Git - rust.git/commit
syntax_ext: Improve and simplify code generated by `#[global_allocator]`
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Thu, 18 Jul 2019 23:51:07 +0000 (02:51 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 24 Jul 2019 09:29:45 +0000 (12:29 +0300)
commitbf8fc8adfc76f31a8fb6a4cb0dee02f262bd766a
treea8da70f217469424dbb22c71cc9bdbb3e1a137ff
parent76b1ffaf6c70abd3fa4da2e694dc709116258098
syntax_ext: Improve and simplify code generated by `#[global_allocator]`

Instead of
```
mod allocator_abi { /* methods */ }
```
we now generate
```
const _: () = { /* methods */ }
```
and use `std_path` for paths referring to standard library entities.

This way we no longer need to generate `use` and `extern crate` imports, and `#[global_allocator]` starts working inside unnamed blocks.
src/libsyntax_ext/global_allocator.rs
src/test/run-pass/allocator/custom-in-block.rs
src/test/run-pass/allocator/custom-in-submodule.rs