Skip to content

bootstrap: ./x.py test mir-opt dirties build cache for standard library #128493

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

Closed
RalfJung opened this issue Aug 1, 2024 · 4 comments
Closed
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@RalfJung
Copy link
Member

RalfJung commented Aug 1, 2024

To reproduce:

./x.py test ui -- mir
# The next command should not have to build a new standard library,
# since it was already built. And yet, a rebuild happens.
./x.py test mir-opt
# Another rebuild happens here
./x.py test ui -- mir

Cc @saethlin this may be related to the special hacks the mir-opt test suite uses for standard libraries for other targets.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 1, 2024
@RalfJung RalfJung added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 1, 2024
@saethlin saethlin added the C-bug Category: This is a bug. label Aug 1, 2024
@onur-ozkan
Copy link
Member

The cache gets broken due to using different rustflags in the following code:

let mut cargo = if self.is_for_mir_opt_tests {
let mut cargo = builder::Cargo::new_for_mir_opt_tests(
builder,
compiler,
Mode::Std,
SourceType::InTree,
target,
Kind::Check,
);
cargo.rustflag("-Zalways-encode-mir");
cargo.arg("--manifest-path").arg(builder.src.join("library/sysroot/Cargo.toml"));
cargo
} else {
let mut cargo = builder::Cargo::new(
builder,
compiler,
Mode::Std,
SourceType::InTree,
target,
Kind::Build,
);
std_cargo(builder, target, compiler.stage, &mut cargo);
for krate in &*self.crates {
cargo.arg("-p").arg(krate);
}
cargo
};
. In the first block bootstrap sets -Zalways-encode-mir directly but in the second block it uses std_cargo to handle rustflags (and other cargo-specific environment variables).

@jieyouxu
Copy link
Member

jieyouxu commented Apr 2, 2025

Triage: I believe this was later superseded by #131437.

@jieyouxu jieyouxu closed this as completed Apr 2, 2025
@xry111
Copy link
Contributor

xry111 commented Apr 2, 2025

Triage: I believe this was later superseded by #131437.

#131437 was closed months ago but IIRC this still happens with rustc-1.85.0.

@jieyouxu
Copy link
Member

jieyouxu commented Apr 2, 2025

I'm not observing the rebuild locally, please open a new issue with repro steps if you can still repro on latest nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

6 participants