authorbors <bors@rust-lang.org> 2025-09-06 06:43:38 UTC
committerbors <bors@rust-lang.org> 2025-09-06 06:43:38 UTC
log0d0f4eac8b98133e5da6d3604d86a8f3b5a67844
tree9d82fab63d40098cda0d1913ac84a4f8ffbb4fef
parent397f93362974d298b79e0e0cd43677014aa7b722
parentedb92a33d73852582c76d0ed48d9373c5f709b2e

Auto merge of #146253 - Kobzol:cargo-lto, r=jieyouxu

Optimize Cargo with LTO This optimization was "lost" when Cargo was switched away from a `ToolRustcPrivate` to a `ToolTarget` tool. r? `@jieyouxu`

1 files changed, 4 insertions(+), 2 deletions(-)

src/bootstrap/src/core/build_steps/tool.rs+4-2
......@@ -121,9 +121,11 @@ impl Step for ToolBuild {
121121 cargo.env("RUSTC_WRAPPER", ccache);
122122 }
123123
124 // Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer)
124 // RustcPrivate tools (miri, clippy, rustfmt, rust-analyzer) and cargo
125125 // could use the additional optimizations.
126 if self.mode == Mode::ToolRustcPrivate && is_lto_stage(&self.build_compiler) {
126 if is_lto_stage(&self.build_compiler)
127 && (self.mode == Mode::ToolRustcPrivate || self.path == "src/tools/cargo")
128 {
127129 let lto = match builder.config.rust_lto {
128130 RustcLto::Off => Some("off"),
129131 RustcLto::Thin => Some("thin"),