mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add opt-in mimalloc feature
This commit is contained in:
parent
46d4487b89
commit
6710856c10
6 changed files with 60 additions and 6 deletions
|
@ -14,7 +14,7 @@ use pico_args::Arguments;
|
|||
use xtask::{
|
||||
codegen::{self, Mode},
|
||||
dist::run_dist,
|
||||
install::{ClientOpt, InstallCmd, ServerOpt},
|
||||
install::{ClientOpt, InstallCmd, Malloc, ServerOpt},
|
||||
not_bash::pushd,
|
||||
pre_commit, project_root,
|
||||
release::{PromoteCmd, ReleaseCmd},
|
||||
|
@ -46,6 +46,7 @@ FLAGS:
|
|||
--client-code Install only VS Code plugin
|
||||
--server Install only the language server
|
||||
--jemalloc Use jemalloc for server
|
||||
--mimalloc Use mimalloc for server
|
||||
-h, --help Prints help information
|
||||
"
|
||||
);
|
||||
|
@ -61,13 +62,21 @@ FLAGS:
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let jemalloc = args.contains("--jemalloc");
|
||||
let malloc = match (args.contains("--jemalloc"), args.contains("--mimalloc")) {
|
||||
(false, false) => Malloc::System,
|
||||
(true, false) => Malloc::Jemalloc,
|
||||
(false, true) => Malloc::Mimalloc,
|
||||
(true, true) => {
|
||||
eprintln!("error: Cannot use both `--jemalloc` and `--mimalloc`");
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
||||
args.finish()?;
|
||||
|
||||
InstallCmd {
|
||||
client: if server { None } else { Some(ClientOpt::VsCode) },
|
||||
server: if client_code { None } else { Some(ServerOpt { jemalloc }) },
|
||||
server: if client_code { None } else { Some(ServerOpt { malloc }) },
|
||||
}
|
||||
.run()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue