Skip to content

Commit 0d0f4ea

Browse files
committed
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`
2 parents 397f933 + edb92a3 commit 0d0f4ea

File tree

1 file changed

+4
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+4
-2
lines changed

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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"),

0 commit comments

Comments
 (0)