Skip to content

Commit edb92a3

Browse files
committed
Optimize Cargo with LTO
1 parent 45b9d13 commit edb92a3

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)