about summary refs log tree commit diff
path: root/src/liballoc_jemalloc
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <vorner@vorner.cz>2017-09-10 19:59:42 +0200
committerMichal 'vorner' Vaner <vorner@vorner.cz>2017-09-10 19:59:42 +0200
commit94297c67465c3bd124063de717f7574491f5cc7d (patch)
treef61293a30e402108589cfd9f8c2e71bfacb3caa0 /src/liballoc_jemalloc
parentd290dec97f8bace2a2585505518b109b1e368f4c (diff)
downloadrust-94297c67465c3bd124063de717f7574491f5cc7d.tar.gz
rust-94297c67465c3bd124063de717f7574491f5cc7d.zip
Autodetect the type of allocator crate used
Annotate the allocator crates (allocator_system, allocator_jemalloc) by
the type of allocator they are. If one is requested as an exe allocator,
detect its type by the flags.

This has the effect that using this (de jure wrong) configuration in the
target spec works instead of producing a really unhelpful and arcane
linker error:

"exe-allocation-crate": "alloc_system"

Fixes #43524.
Diffstat (limited to 'src/liballoc_jemalloc')
-rw-r--r--src/liballoc_jemalloc/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index efefabc974c..d153f19c462 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![no_std]
+#![allow(unused_attributes)]
 #![unstable(feature = "alloc_jemalloc",
             reason = "this library is unlikely to be stabilized in its current \
                       form or name",
@@ -19,8 +20,10 @@
 #![feature(libc)]
 #![feature(linkage)]
 #![feature(staged_api)]
+#![feature(rustc_attrs)]
 #![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))]
 #![cfg_attr(not(dummy_jemalloc), feature(allocator_api))]
+#![rustc_alloc_kind = "exe"]
 
 extern crate alloc;
 extern crate alloc_system;