@@ -325,6 +325,9 @@ pub struct Config {
325
325
pub hosts : Vec < TargetSelection > ,
326
326
pub targets : Vec < TargetSelection > ,
327
327
pub local_rebuild : bool ,
328
+ #[ cfg( not( test) ) ]
329
+ jemalloc : bool ,
330
+ #[ cfg( test) ]
328
331
pub jemalloc : bool ,
329
332
pub control_flow_guard : bool ,
330
333
pub ehcont_guard : bool ,
@@ -643,6 +646,7 @@ pub struct Target {
643
646
pub no_std : bool ,
644
647
pub codegen_backends : Option < Vec < String > > ,
645
648
pub optimized_compiler_builtins : Option < bool > ,
649
+ pub jemalloc : Option < bool > ,
646
650
}
647
651
648
652
impl Target {
@@ -1234,6 +1238,7 @@ define_config! {
1234
1238
codegen_backends: Option <Vec <String >> = "codegen-backends" ,
1235
1239
runner: Option <String > = "runner" ,
1236
1240
optimized_compiler_builtins: Option <bool > = "optimized-compiler-builtins" ,
1241
+ jemalloc: Option <bool > = "jemalloc" ,
1237
1242
}
1238
1243
}
1239
1244
@@ -2161,6 +2166,7 @@ impl Config {
2161
2166
target. profiler = cfg. profiler ;
2162
2167
target. rpath = cfg. rpath ;
2163
2168
target. optimized_compiler_builtins = cfg. optimized_compiler_builtins ;
2169
+ target. jemalloc = cfg. jemalloc ;
2164
2170
2165
2171
if let Some ( ref backends) = cfg. codegen_backends {
2166
2172
let available_backends = [ "llvm" , "cranelift" , "gcc" ] ;
@@ -2726,6 +2732,10 @@ impl Config {
2726
2732
. unwrap_or ( & self . rust_codegen_backends )
2727
2733
}
2728
2734
2735
+ pub fn jemalloc ( & self , target : TargetSelection ) -> bool {
2736
+ self . target_config . get ( & target) . and_then ( |cfg| cfg. jemalloc ) . unwrap_or ( self . jemalloc )
2737
+ }
2738
+
2729
2739
pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < String > {
2730
2740
self . codegen_backends ( target) . first ( ) . cloned ( )
2731
2741
}
0 commit comments