Skip to content

Remove unneeded stage parameter when setting up stdlib Cargo #145000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Step for Std {
Kind::Check,
);

std_cargo(builder, target, stage, &mut cargo);
std_cargo(builder, target, &mut cargo);
if matches!(builder.config.cmd, Subcommand::Fix) {
// By default, cargo tries to fix all targets. Tell it not to fix tests until we've added `test` to the sysroot.
cargo.arg("--lib");
Expand Down Expand Up @@ -125,7 +125,7 @@ impl Step for Std {
Kind::Check,
);

std_cargo(builder, target, build_compiler.stage, &mut cargo);
std_cargo(builder, target, &mut cargo);

// Explicitly pass -p for all dependencies krates -- this will force cargo
// to also check the tests/benches/examples for these crates, rather
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl Step for Std {
Kind::Clippy,
);

std_cargo(builder, target, compiler.stage, &mut cargo);
std_cargo(builder, target, &mut cargo);

for krate in &*self.crates {
cargo.arg("-p").arg(krate);
Expand Down
12 changes: 4 additions & 8 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl Step for Std {
target,
Kind::Build,
);
std_cargo(builder, target, compiler.stage, &mut cargo);
std_cargo(builder, target, &mut cargo);
for krate in &*self.crates {
cargo.arg("-p").arg(krate);
}
Expand Down Expand Up @@ -497,7 +497,7 @@ fn compiler_rt_for_profiler(builder: &Builder<'_>) -> PathBuf {

/// Configure cargo to compile the standard library, adding appropriate env vars
/// and such.
pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, cargo: &mut Cargo) {
pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, cargo: &mut Cargo) {
// rustc already ensures that it builds with the minimum deployment
// target, so ideally we shouldn't need to do anything here.
//
Expand Down Expand Up @@ -645,12 +645,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
// built with bitcode so that the produced rlibs can be used for both LTO
// builds (which use bitcode) and non-LTO builds (which use object code).
// So we override the override here!
//
// But we don't bother for the stage 0 compiler because it's never used
// with LTO.
if stage >= 1 {
cargo.rustflag("-Cembed-bitcode=yes");
}
cargo.rustflag("-Cembed-bitcode=yes");

if builder.config.rust_lto == RustcLto::Off {
cargo.rustflag("-Clto=off");
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ fn doc_std(
let mut cargo =
builder::Cargo::new(builder, compiler, Mode::Std, SourceType::InTree, target, Kind::Doc);

compile::std_cargo(builder, target, compiler.stage, &mut cargo);
compile::std_cargo(builder, target, &mut cargo);
cargo
.arg("--no-deps")
.arg("--target-dir")
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2858,7 +2858,7 @@ impl Step for Crate {
.arg("--manifest-path")
.arg(builder.src.join("library/sysroot/Cargo.toml"));
} else {
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
compile::std_cargo(builder, target, &mut cargo);
}
}
Mode::Rustc => {
Expand Down
Loading