@@ -325,6 +325,9 @@ pub struct Config {
325325 pub hosts : Vec < TargetSelection > ,
326326 pub targets : Vec < TargetSelection > ,
327327 pub local_rebuild : bool ,
328+ #[ cfg( not( test) ) ]
329+ jemalloc : bool ,
330+ #[ cfg( test) ]
328331 pub jemalloc : bool ,
329332 pub control_flow_guard : bool ,
330333 pub ehcont_guard : bool ,
@@ -643,6 +646,7 @@ pub struct Target {
643646 pub no_std : bool ,
644647 pub codegen_backends : Option < Vec < String > > ,
645648 pub optimized_compiler_builtins : Option < bool > ,
649+ pub jemalloc : Option < bool > ,
646650}
647651
648652impl Target {
@@ -1234,6 +1238,7 @@ define_config! {
12341238 codegen_backends: Option <Vec <String >> = "codegen-backends" ,
12351239 runner: Option <String > = "runner" ,
12361240 optimized_compiler_builtins: Option <bool > = "optimized-compiler-builtins" ,
1241+ jemalloc: Option <bool > = "jemalloc" ,
12371242 }
12381243}
12391244
@@ -2161,6 +2166,7 @@ impl Config {
21612166 target. profiler = cfg. profiler ;
21622167 target. rpath = cfg. rpath ;
21632168 target. optimized_compiler_builtins = cfg. optimized_compiler_builtins ;
2169+ target. jemalloc = cfg. jemalloc ;
21642170
21652171 if let Some ( ref backends) = cfg. codegen_backends {
21662172 let available_backends = [ "llvm" , "cranelift" , "gcc" ] ;
@@ -2726,6 +2732,10 @@ impl Config {
27262732 . unwrap_or ( & self . rust_codegen_backends )
27272733 }
27282734
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+
27292739 pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < String > {
27302740 self . codegen_backends ( target) . first ( ) . cloned ( )
27312741 }
0 commit comments