Unnamed repository; edit this file 'description' to name the repository.
Do not use `force-always-assert` in `xtask install` by default
But add a flag to do so.
Chayim Refael Friedman 6 months ago
parent 0138b82 · commit c046fd5
-rw-r--r--xtask/src/flags.rs11
-rw-r--r--xtask/src/install.rs16
2 files changed, 24 insertions, 3 deletions
diff --git a/xtask/src/flags.rs b/xtask/src/flags.rs
index 72f6215d4c..8f70a18618 100644
--- a/xtask/src/flags.rs
+++ b/xtask/src/flags.rs
@@ -49,6 +49,9 @@ xflags::xflags! {
/// build in release with debug info set to 2.
optional --dev-rel
+ /// Make `never!()`, `always!()` etc. panic instead of just logging an error.
+ optional --force-always-assert
+
/// Apply PGO optimizations
optional --pgo pgo: PgoTrainingCrate
}
@@ -124,6 +127,7 @@ pub struct Install {
pub jemalloc: bool,
pub proc_macro_server: bool,
pub dev_rel: bool,
+ pub force_always_assert: bool,
pub pgo: Option<PgoTrainingCrate>,
}
@@ -300,7 +304,12 @@ impl Install {
} else {
Malloc::System
};
- Some(ServerOpt { malloc, dev_rel: self.dev_rel, pgo: self.pgo.clone() })
+ Some(ServerOpt {
+ malloc,
+ dev_rel: self.dev_rel,
+ pgo: self.pgo.clone(),
+ force_always_assert: self.force_always_assert,
+ })
}
pub(crate) fn proc_macro_server(&self) -> Option<ProcMacroServerOpt> {
if !self.proc_macro_server {
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index b794f53e76..975e361ba5 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -39,6 +39,18 @@ pub(crate) struct ServerOpt {
pub(crate) malloc: Malloc,
pub(crate) dev_rel: bool,
pub(crate) pgo: Option<PgoTrainingCrate>,
+ pub(crate) force_always_assert: bool,
+}
+
+impl ServerOpt {
+ fn to_features(&self) -> Vec<&'static str> {
+ let mut features = Vec::new();
+ features.extend(self.malloc.to_features());
+ if self.force_always_assert {
+ features.extend(["--features", "force-always-assert"]);
+ }
+ features
+ }
}
pub(crate) struct ProcMacroServerOpt {
@@ -136,7 +148,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> {
}
fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
- let features = opts.malloc.to_features();
+ let features = &opts.to_features();
let profile = if opts.dev_rel { "dev-rel" } else { "release" };
let mut install_cmd = cmd!(
@@ -148,7 +160,7 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
let target = detect_target(sh);
let build_cmd = cmd!(
sh,
- "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked --features force-always-assert {features...}"
+ "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked {features...}"
);
let profile = crate::pgo::gather_pgo_profile(sh, build_cmd, &target, train_crate)?;