@@ -13,6 +13,11 @@ extern crate rustc_interface;
13
13
extern crate rustc_session;
14
14
extern crate rustc_span;
15
15
16
+ // See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
17
+ // about jemalloc.
18
+ #[ cfg( feature = "jemalloc" ) ]
19
+ extern crate tikv_jemalloc_sys as jemalloc_sys;
20
+
16
21
use clippy_utils:: sym;
17
22
use rustc_interface:: interface;
18
23
use rustc_session:: EarlyDiagCtxt ;
@@ -181,6 +186,36 @@ const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/ne
181
186
#[ allow( clippy:: too_many_lines) ]
182
187
#[ allow( clippy:: ignored_unit_patterns) ]
183
188
pub fn main ( ) {
189
+ // See docs in https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs
190
+ // about jemalloc.
191
+ #[ cfg( feature = "jemalloc" ) ]
192
+ {
193
+ use std:: os:: raw:: { c_int, c_void} ;
194
+
195
+ #[ used]
196
+ static _F1: unsafe extern "C" fn ( usize , usize ) -> * mut c_void = jemalloc_sys:: calloc;
197
+ #[ used]
198
+ static _F2: unsafe extern "C" fn ( * mut * mut c_void , usize , usize ) -> c_int = jemalloc_sys:: posix_memalign;
199
+ #[ used]
200
+ static _F3: unsafe extern "C" fn ( usize , usize ) -> * mut c_void = jemalloc_sys:: aligned_alloc;
201
+ #[ used]
202
+ static _F4: unsafe extern "C" fn ( usize ) -> * mut c_void = jemalloc_sys:: malloc;
203
+ #[ used]
204
+ static _F5: unsafe extern "C" fn ( * mut c_void , usize ) -> * mut c_void = jemalloc_sys:: realloc;
205
+ #[ used]
206
+ static _F6: unsafe extern "C" fn ( * mut c_void ) = jemalloc_sys:: free;
207
+
208
+ #[ cfg( target_os = "macos" ) ]
209
+ {
210
+ unsafe extern "C" {
211
+ fn _rjem_je_zone_register ( ) ;
212
+ }
213
+
214
+ #[ used]
215
+ static _F7: unsafe extern "C" fn ( ) = _rjem_je_zone_register;
216
+ }
217
+ }
218
+
184
219
let early_dcx = EarlyDiagCtxt :: new ( ErrorOutputType :: default ( ) ) ;
185
220
186
221
rustc_driver:: init_rustc_env_logger ( & early_dcx) ;
0 commit comments