Skip to content

Commit 765954a

Browse files
authored
Merge pull request #20852 from ChayimFriedman2/xtask-install-never
Do not use `force-always-assert` in `xtask install` by default
2 parents cd2bcd6 + c046fd5 commit 765954a

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

xtask/src/flags.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ xflags::xflags! {
4949
/// build in release with debug info set to 2.
5050
optional --dev-rel
5151

52+
/// Make `never!()`, `always!()` etc. panic instead of just logging an error.
53+
optional --force-always-assert
54+
5255
/// Apply PGO optimizations
5356
optional --pgo pgo: PgoTrainingCrate
5457
}
@@ -124,6 +127,7 @@ pub struct Install {
124127
pub jemalloc: bool,
125128
pub proc_macro_server: bool,
126129
pub dev_rel: bool,
130+
pub force_always_assert: bool,
127131
pub pgo: Option<PgoTrainingCrate>,
128132
}
129133

@@ -300,7 +304,12 @@ impl Install {
300304
} else {
301305
Malloc::System
302306
};
303-
Some(ServerOpt { malloc, dev_rel: self.dev_rel, pgo: self.pgo.clone() })
307+
Some(ServerOpt {
308+
malloc,
309+
dev_rel: self.dev_rel,
310+
pgo: self.pgo.clone(),
311+
force_always_assert: self.force_always_assert,
312+
})
304313
}
305314
pub(crate) fn proc_macro_server(&self) -> Option<ProcMacroServerOpt> {
306315
if !self.proc_macro_server {

xtask/src/install.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ pub(crate) struct ServerOpt {
3939
pub(crate) malloc: Malloc,
4040
pub(crate) dev_rel: bool,
4141
pub(crate) pgo: Option<PgoTrainingCrate>,
42+
pub(crate) force_always_assert: bool,
43+
}
44+
45+
impl ServerOpt {
46+
fn to_features(&self) -> Vec<&'static str> {
47+
let mut features = Vec::new();
48+
features.extend(self.malloc.to_features());
49+
if self.force_always_assert {
50+
features.extend(["--features", "force-always-assert"]);
51+
}
52+
features
53+
}
4254
}
4355

4456
pub(crate) struct ProcMacroServerOpt {
@@ -136,7 +148,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> {
136148
}
137149

138150
fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
139-
let features = opts.malloc.to_features();
151+
let features = &opts.to_features();
140152
let profile = if opts.dev_rel { "dev-rel" } else { "release" };
141153

142154
let mut install_cmd = cmd!(
@@ -148,7 +160,7 @@ fn install_server(sh: &Shell, opts: ServerOpt) -> anyhow::Result<()> {
148160
let target = detect_target(sh);
149161
let build_cmd = cmd!(
150162
sh,
151-
"cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked --features force-always-assert {features...}"
163+
"cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --profile={profile} --locked {features...}"
152164
);
153165

154166
let profile = crate::pgo::gather_pgo_profile(sh, build_cmd, &target, train_crate)?;

0 commit comments

Comments
 (0)