about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-17 10:06:23 +0100
committerGitHub <noreply@github.com>2020-11-17 10:06:23 +0100
commit70a4e433b1de88bd520582c7cfd035d6dd658925 (patch)
tree84ad96456943475c36dfe5da28fe3f80feb12eaf /library/alloc/src
parent336dc18aa3bfe073894f7f467706f90a456d65fc (diff)
parentaf869c2f8dea8efb2a2d10a44d200cb769b4956c (diff)
downloadrust-70a4e433b1de88bd520582c7cfd035d6dd658925.tar.gz
rust-70a4e433b1de88bd520582c7cfd035d6dd658925.zip
Rollup merge of #79077 - RalfJung:llvm-magic, r=Mark-Simulacrum
document that __rust_alloc is also magic to our LLVM fork

Based on [comments](https://github.com/rust-lang/rust/pull/79045#discussion_r523442198) by ````@tmiasko```` and ````@bjorn3.````
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/alloc.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs
index 0a4f88dedbb..3427c83a18f 100644
--- a/library/alloc/src/alloc.rs
+++ b/library/alloc/src/alloc.rs
@@ -23,6 +23,8 @@ extern "Rust" {
     // (the code expanding that attribute macro generates those functions), or to call
     // the default implementations in libstd (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
     // otherwise.
+    // The rustc fork of LLVM also special-cases these function names to be able to optimize them
+    // like `malloc`, `realloc`, and `free`, respectively.
     #[rustc_allocator]
     #[rustc_allocator_nounwind]
     fn __rust_alloc(size: usize, align: usize) -> *mut u8;