about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2021-12-23 15:47:32 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2021-12-23 17:23:21 +1100
commitbb23bfc2cde4b56372ac7324d0bdec2232a162e5 (patch)
tree999a6059e11bb8e19596ea73696de2a27c41be03 /src
parente95e084a14870a718c712936ab5a8f8cd0159485 (diff)
downloadrust-bb23bfc2cde4b56372ac7324d0bdec2232a162e5.tar.gz
rust-bb23bfc2cde4b56372ac7324d0bdec2232a162e5.zip
Remove useless `#[global_allocator]` from rustc and rustdoc.
This was added in #83152, which has several errors in its comments.

This commit also fix up the comments, which are quite wrong and
misleading.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lib.rs18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 8699ab20b19..4197c7012f4 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -63,14 +63,12 @@ extern crate rustc_trait_selection;
 extern crate rustc_typeck;
 extern crate test;
 
+// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
+// about jemalloc.
 #[cfg(feature = "jemalloc")]
 extern crate tikv_jemalloc_sys;
 #[cfg(feature = "jemalloc")]
 use tikv_jemalloc_sys as jemalloc_sys;
-#[cfg(feature = "jemalloc")]
-extern crate tikv_jemallocator;
-#[cfg(feature = "jemalloc")]
-use tikv_jemallocator as jemallocator;
 
 use std::default::Default;
 use std::env;
@@ -125,15 +123,9 @@ mod visit;
 mod visit_ast;
 mod visit_lib;
 
-// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
-// about jemallocator
-#[cfg(feature = "jemalloc")]
-#[global_allocator]
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
-
 pub fn main() {
     // See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
-    // about jemalloc-sys
+    // about jemalloc.
     #[cfg(feature = "jemalloc")]
     {
         use std::os::raw::{c_int, c_void};
@@ -152,10 +144,6 @@ pub fn main() {
         #[used]
         static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
 
-        // On OSX, jemalloc doesn't directly override malloc/free, but instead
-        // registers itself with the allocator's zone APIs in a ctor. However,
-        // the linker doesn't seem to consider ctors as "used" when statically
-        // linking, so we need to explicitly depend on the function.
         #[cfg(target_os = "macos")]
         {
             extern "C" {