about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-11-13 13:03:22 +0800
committerkennytm <kennytm@gmail.com>2018-11-13 19:20:57 +0800
commit99986a5a057a02fb37e41c3e4fe20db1f75aa6cc (patch)
treedcbf06fee8f815bd3a1bae86b246ec0b98e9daa4 /src/liballoc
parentc246a2981383e47ab667e788d8f0a0c65bae4c91 (diff)
parent075983c70ba20f31fc1279dacae6d6fcb8bc9cad (diff)
downloadrust-99986a5a057a02fb37e41c3e4fe20db1f75aa6cc.tar.gz
rust-99986a5a057a02fb37e41c3e4fe20db1f75aa6cc.zip
Rollup merge of #55889 - RalfJung:global-alloc, r=alexcrichton
global allocators: add a few comments

These comments answer some questions that came up when I tried to understand how the control flow works for the global allocator, `Global` and `System`.

r? @alexcrichton
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/alloc.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs
index 3bd0c243b39..1a8a081e16f 100644
--- a/src/liballoc/alloc.rs
+++ b/src/liballoc/alloc.rs
@@ -21,6 +21,10 @@ use core::usize;
 pub use core::alloc::*;
 
 extern "Rust" {
+    // These are the magic symbols to call the global allocator.  rustc generates
+    // them from the `#[global_allocator]` attribute if there is one, or uses the
+    // default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`)
+    // otherwise.
     #[allocator]
     #[rustc_allocator_nounwind]
     fn __rust_alloc(size: usize, align: usize) -> *mut u8;