@@ -345,6 +345,7 @@ pub struct Config {
345345 jemalloc : bool ,
346346 #[ cfg( test) ]
347347 pub jemalloc : bool ,
348+ pub mimalloc : bool ,
348349 pub control_flow_guard : bool ,
349350 pub ehcont_guard : bool ,
350351
@@ -663,6 +664,7 @@ pub struct Target {
663664 pub codegen_backends : Option < Vec < String > > ,
664665 pub optimized_compiler_builtins : Option < bool > ,
665666 pub jemalloc : Option < bool > ,
667+ pub mimalloc : Option < bool > ,
666668}
667669
668670impl Target {
@@ -1225,6 +1227,7 @@ define_config! {
12251227 thin_lto_import_instr_limit: Option <u32 > = "thin-lto-import-instr-limit" ,
12261228 remap_debuginfo: Option <bool > = "remap-debuginfo" ,
12271229 jemalloc: Option <bool > = "jemalloc" ,
1230+ mimalloc: Option <bool > = "mimalloc" ,
12281231 test_compare_mode: Option <bool > = "test-compare-mode" ,
12291232 llvm_libunwind: Option <String > = "llvm-libunwind" ,
12301233 control_flow_guard: Option <bool > = "control-flow-guard" ,
@@ -1267,6 +1270,7 @@ define_config! {
12671270 runner: Option <String > = "runner" ,
12681271 optimized_compiler_builtins: Option <bool > = "optimized-compiler-builtins" ,
12691272 jemalloc: Option <bool > = "jemalloc" ,
1273+ mimalloc: Option <bool > = "mimalloc" ,
12701274 }
12711275}
12721276
@@ -1891,6 +1895,7 @@ impl Config {
18911895 thin_lto_import_instr_limit,
18921896 remap_debuginfo,
18931897 jemalloc,
1898+ mimalloc,
18941899 test_compare_mode,
18951900 llvm_libunwind,
18961901 control_flow_guard,
@@ -1963,6 +1968,7 @@ impl Config {
19631968 set ( & mut config. rust_frame_pointers , frame_pointers) ;
19641969 config. rust_stack_protector = stack_protector;
19651970 set ( & mut config. jemalloc , jemalloc) ;
1971+ set ( & mut config. mimalloc , mimalloc) ;
19661972 set ( & mut config. test_compare_mode , test_compare_mode) ;
19671973 set ( & mut config. backtrace , backtrace) ;
19681974 if rust_description. is_some ( ) {
@@ -2230,6 +2236,7 @@ impl Config {
22302236 target. rpath = cfg. rpath ;
22312237 target. optimized_compiler_builtins = cfg. optimized_compiler_builtins ;
22322238 target. jemalloc = cfg. jemalloc ;
2239+ target. mimalloc = cfg. mimalloc ;
22332240
22342241 if let Some ( ref backends) = cfg. codegen_backends {
22352242 let available_backends = [ "llvm" , "cranelift" , "gcc" ] ;
@@ -2811,6 +2818,10 @@ impl Config {
28112818 self . target_config . get ( & target) . and_then ( |cfg| cfg. jemalloc ) . unwrap_or ( self . jemalloc )
28122819 }
28132820
2821+ pub fn mimalloc ( & self , target : TargetSelection ) -> bool {
2822+ self . target_config . get ( & target) . and_then ( |cfg| cfg. mimalloc ) . unwrap_or ( self . mimalloc )
2823+ }
2824+
28142825 pub fn default_codegen_backend ( & self , target : TargetSelection ) -> Option < String > {
28152826 self . codegen_backends ( target) . first ( ) . cloned ( )
28162827 }
@@ -3374,6 +3385,7 @@ fn check_incompatible_options_for_ci_rustc(
33743385 strip,
33753386 lld_mode,
33763387 jemalloc,
3388+ mimalloc,
33773389 rpath,
33783390 channel,
33793391 description,
@@ -3437,6 +3449,7 @@ fn check_incompatible_options_for_ci_rustc(
34373449 err ! ( current_rust_config. llvm_tools, llvm_tools, "rust" ) ;
34383450 err ! ( current_rust_config. llvm_bitcode_linker, llvm_bitcode_linker, "rust" ) ;
34393451 err ! ( current_rust_config. jemalloc, jemalloc, "rust" ) ;
3452+ err ! ( current_rust_config. mimalloc, mimalloc, "rust" ) ;
34403453 err ! ( current_rust_config. default_linker, default_linker, "rust" ) ;
34413454 err ! ( current_rust_config. stack_protector, stack_protector, "rust" ) ;
34423455 err ! ( current_rust_config. lto, lto, "rust" ) ;
0 commit comments