Add jemalloc feature to Clippy
This commit is contained in:
parent
507183d438
commit
dd0fa3d356
2 changed files with 36 additions and 0 deletions
|
|
@ -58,6 +58,7 @@ rustc_tools_util = { path = "rustc_tools_util", version = "0.4.2" }
|
|||
[features]
|
||||
integration = ["dep:tempfile"]
|
||||
internal = ["dep:clippy_lints_internal", "dep:tempfile"]
|
||||
jemalloc = []
|
||||
|
||||
[package.metadata.rust-analyzer]
|
||||
# This package uses #[feature(rustc_private)]
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ extern crate rustc_interface;
|
|||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
|
||||
// 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 as jemalloc_sys;
|
||||
|
||||
use clippy_utils::sym;
|
||||
use rustc_interface::interface;
|
||||
use rustc_session::EarlyDiagCtxt;
|
||||
|
|
@ -181,6 +186,36 @@ const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/ne
|
|||
#[allow(clippy::too_many_lines)]
|
||||
#[allow(clippy::ignored_unit_patterns)]
|
||||
pub fn main() {
|
||||
// See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
|
||||
// about jemalloc.
|
||||
#[cfg(feature = "jemalloc")]
|
||||
{
|
||||
use std::os::raw::{c_int, c_void};
|
||||
|
||||
#[used]
|
||||
static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc;
|
||||
#[used]
|
||||
static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int = jemalloc_sys::posix_memalign;
|
||||
#[used]
|
||||
static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc;
|
||||
#[used]
|
||||
static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc;
|
||||
#[used]
|
||||
static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc;
|
||||
#[used]
|
||||
static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
unsafe extern "C" {
|
||||
fn _rjem_je_zone_register();
|
||||
}
|
||||
|
||||
#[used]
|
||||
static _F7: unsafe extern "C" fn() = _rjem_je_zone_register;
|
||||
}
|
||||
}
|
||||
|
||||
let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());
|
||||
|
||||
rustc_driver::init_rustc_env_logger(&early_dcx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue