@@ -227,6 +227,7 @@ pub struct Config {
227227 pub incremental : bool ,
228228 pub dry_run : DryRun ,
229229 pub dump_bootstrap_shims : bool ,
230+ pub enable_release_build : bool ,
230231 /// Arguments appearing after `--` to be forwarded to tools,
231232 /// e.g. `--fix-broken` or test arguments.
232233 pub free_args : Vec < String > ,
@@ -1355,6 +1356,7 @@ impl Config {
13551356 config. llvm_profile_generate = flags. llvm_profile_generate ;
13561357 config. enable_bolt_settings = flags. enable_bolt_settings ;
13571358 config. bypass_bootstrap_lock = flags. bypass_bootstrap_lock ;
1359+ config. enable_release_build = flags. release || CiEnv :: is_ci ( ) ;
13581360
13591361 // Infer the rest of the configuration.
13601362
@@ -2182,7 +2184,14 @@ impl Config {
21822184 config. llvm_enzyme = llvm_enzyme. unwrap_or ( false ) ;
21832185 config. llvm_offload = llvm_offload. unwrap_or ( false ) ;
21842186 config. llvm_plugins = llvm_plugins. unwrap_or ( false ) ;
2185- config. rust_optimize = optimize. unwrap_or ( RustOptimize :: Bool ( true ) ) ;
2187+
2188+ config. rust_optimize = match optimize {
2189+ Some ( inner) => match inner {
2190+ RustOptimize :: Bool ( false ) => RustOptimize :: Bool ( config. enable_release_build ) ,
2191+ t => t,
2192+ } ,
2193+ None => RustOptimize :: Bool ( true ) ,
2194+ } ;
21862195
21872196 // We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will
21882197 // build our internal lld and use it as the default linker, by setting the `rust.lld` config
0 commit comments