@@ -346,6 +346,7 @@ pub struct Config {
346346 jemalloc : bool ,
347347 #[ cfg( test) ]
348348 pub jemalloc : bool ,
349+ pub mimalloc : bool ,
349350 pub control_flow_guard : bool ,
350351 pub ehcont_guard : bool ,
351352
@@ -666,6 +667,7 @@ pub struct Target {
666667 pub codegen_backends : Option < Vec < String > > ,
667668 pub optimized_compiler_builtins : Option < bool > ,
668669 pub jemalloc : Option < bool > ,
670+ pub mimalloc : Option < bool > ,
669671}
670672
671673impl Target {
@@ -1228,6 +1230,7 @@ define_config! {
12281230 thin_lto_import_instr_limit: Option <u32 > = "thin-lto-import-instr-limit" ,
12291231 remap_debuginfo: Option <bool > = "remap-debuginfo" ,
12301232 jemalloc: Option <bool > = "jemalloc" ,
1233+ mimalloc: Option <bool > = "mimalloc" ,
12311234 test_compare_mode: Option <bool > = "test-compare-mode" ,
12321235 llvm_libunwind: Option <String > = "llvm-libunwind" ,
12331236 control_flow_guard: Option <bool > = "control-flow-guard" ,
@@ -1270,6 +1273,7 @@ define_config! {
12701273 runner: Option <String > = "runner" ,
12711274 optimized_compiler_builtins: Option <bool > = "optimized-compiler-builtins" ,
12721275 jemalloc: Option <bool > = "jemalloc" ,
1276+ mimalloc: Option <bool > = "mimalloc" ,
12731277 }
12741278}
12751279
@@ -1895,6 +1899,7 @@ impl Config {
18951899 thin_lto_import_instr_limit,
18961900 remap_debuginfo,
18971901 jemalloc,
1902+ mimalloc,
18981903 test_compare_mode,
18991904 llvm_libunwind,
19001905 control_flow_guard,
@@ -1967,6 +1972,7 @@ impl Config {
19671972 set ( & mut config. rust_frame_pointers , frame_pointers) ;
19681973 config. rust_stack_protector = stack_protector;
19691974 set ( & mut config. jemalloc , jemalloc) ;
1975+ set ( & mut config. mimalloc , mimalloc) ;
19701976 set ( & mut config. test_compare_mode , test_compare_mode) ;
19711977 set ( & mut config. backtrace , backtrace) ;
19721978 if rust_description. is_some ( ) {
@@ -2234,6 +2240,7 @@ impl Config {
22342240 target. rpath = cfg. rpath ;
22352241 target. optimized_compiler_builtins = cfg. optimized_compiler_builtins ;
22362242 target. jemalloc = cfg. jemalloc ;
2243+ target. mimalloc = cfg. mimalloc ;
22372244
22382245 if let Some ( ref backends) = cfg. codegen_backends {
22392246 let available_backends = [ "llvm" , "cranelift" , "gcc" ] ;
@@ -2815,6 +2822,10 @@ impl Config {
28152822 self . target_config . get ( & target) . and_then ( |cfg| cfg. jemalloc ) . unwrap_or ( self . jemalloc )
28162823 }
28172824
2825+ pub fn mimalloc ( & self , target : TargetSelection ) -> bool {
2826+ self . target_config . get ( & target) . and_then ( |cfg| cfg. mimalloc ) . unwrap_or ( self . mimalloc )
2827+ }
2828+
28182829 pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < String > {
28192830 self . codegen_backends ( target) . first ( ) . cloned ( )
28202831 }
@@ -3392,6 +3403,7 @@ fn check_incompatible_options_for_ci_rustc(
33923403 strip,
33933404 lld_mode,
33943405 jemalloc,
3406+ mimalloc,
33953407 rpath,
33963408 channel,
33973409 description,
@@ -3455,6 +3467,7 @@ fn check_incompatible_options_for_ci_rustc(
34553467 err ! ( current_rust_config. llvm_tools, llvm_tools, "rust" ) ;
34563468 err ! ( current_rust_config. llvm_bitcode_linker, llvm_bitcode_linker, "rust" ) ;
34573469 err ! ( current_rust_config. jemalloc, jemalloc, "rust" ) ;
3470+ err ! ( current_rust_config. mimalloc, mimalloc, "rust" ) ;
34583471 err ! ( current_rust_config. default_linker, default_linker, "rust" ) ;
34593472 err ! ( current_rust_config. stack_protector, stack_protector, "rust" ) ;
34603473 err ! ( current_rust_config. lto, lto, "rust" ) ;
0 commit comments