From bb23bfc2cde4b56372ac7324d0bdec2232a162e5 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 23 Dec 2021 15:47:32 +1100 Subject: 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. --- src/librustdoc/lib.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src') 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" { -- cgit 1.4.1-3-g733a5