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