summaryrefslogtreecommitdiff
path: root/src/bootstrap/builder.rs
diff options
context:
space:
mode:
authorhi-rustin <rustin.liu@gmail.com>2023-06-18 14:38:58 +0800
committerhi-rustin <rustin.liu@gmail.com>2023-07-01 16:03:42 +0800
commite6e2825bb018baa4f0f6dfecd4206beb73d3ebf4 (patch)
tree45dd16bda258fa377d6370cf71b924e3e4a4a63f /src/bootstrap/builder.rs
parent6b06fdfcd4f06ba95123624f8e21de6bdeea3616 (diff)
Use RustOptimize to set optimize
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Diffstat (limited to 'src/bootstrap/builder.rs')
-rw-r--r--src/bootstrap/builder.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index a1d3453377a..05b66f94727 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1207,7 +1207,7 @@ impl<'a> Builder<'a> {
assert_eq!(target, compiler.host);
}
- if self.config.rust_optimize {
+ if self.config.rust_optimize.is_release() {
// FIXME: cargo bench/install do not accept `--release`
if cmd != "bench" && cmd != "install" {
cargo.arg("--release");
@@ -1263,7 +1263,7 @@ impl<'a> Builder<'a> {
}
let profile_var = |name: &str| {
- let profile = if self.config.rust_optimize { "RELEASE" } else { "DEV" };
+ let profile = if self.config.rust_optimize.is_release() { "RELEASE" } else { "DEV" };
format!("CARGO_PROFILE_{}_{}", profile, name)
};
@@ -1652,6 +1652,9 @@ impl<'a> Builder<'a> {
}
};
cargo.env(profile_var("DEBUG"), debuginfo_level.to_string());
+ if let Some(opt_level) = &self.config.rust_optimize.get_opt_level() {
+ cargo.env(profile_var("OPT_LEVEL"), opt_level);
+ }
if !self.config.dry_run() && self.cc.borrow()[&target].args().iter().any(|arg| arg == "-gz")
{
rustflags.arg("-Clink-arg=-gz");