Skip to content

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

Duplicate of#131437
@RalfJung

Description

@RalfJung
Member

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.

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Aug 1, 2024
added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Aug 1, 2024
onur-ozkan

onur-ozkan commented on Aug 2, 2024

@onur-ozkan
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

jieyouxu commented on Apr 2, 2025

@jieyouxu
Member

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

xry111

xry111 commented on Apr 2, 2025

@xry111
Contributor

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

jieyouxu commented on Apr 2, 2025

@jieyouxu
Member

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @RalfJung@xry111@saethlin@jieyouxu@onur-ozkan

        Issue actions

          bootstrap: `./x.py test mir-opt` dirties build cache for standard library · Issue #128493 · rust-lang/rust