Add opt-in mimalloc feature

This commit is contained in:
Ivan Kozik 2020-07-14 00:12:49 +00:00
parent 46d4487b89
commit 6710856c10
6 changed files with 60 additions and 6 deletions

View file

@ -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!(