From 6710856c1098f71168c47451af53bac9a33b49dd Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Tue, 14 Jul 2020 00:12:49 +0000 Subject: Add opt-in mimalloc feature --- xtask/src/install.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'xtask/src/install.rs') diff --git a/xtask/src/install.rs b/xtask/src/install.rs index 9ba77a3aa..a0dc0c9c2 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -19,7 +19,13 @@ pub enum ClientOpt { } pub struct ServerOpt { - pub jemalloc: bool, + pub malloc: Malloc, +} + +pub enum Malloc { + System, + Jemalloc, + Mimalloc, } impl InstallCmd { @@ -130,8 +136,12 @@ fn install_server(opts: ServerOpt) -> Result<()> { ) } - let jemalloc = if opts.jemalloc { "--features jemalloc" } else { "" }; - let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", jemalloc); + let malloc_feature = match opts.malloc { + Malloc::System => "", + Malloc::Jemalloc => "--features jemalloc", + Malloc::Mimalloc => "--features mimalloc", + }; + let res = run!("cargo install --path crates/rust-analyzer --locked --force {}", malloc_feature); if res.is_err() && old_rust { eprintln!( -- cgit v1.2.3