Skip to content

Commit 301a4ca

Browse files
authored
Rollup merge of #129000 - RalfJung:miri-bootstrap-clear, r=onur-ozkan
bootstrap: clear miri ui-test deps when miri sysroot gets rebuilt Second attempt after #128683: seems like it's not the compiler changing that we care about, but the sysroot changing. I did some local testing with sysroot rebuilds and it works fine for at least those cases I checked. r? ``@onur-ozkan``
2 parents 85eb465 + 6839a8f commit 301a4ca

File tree

1 file changed

+8
-6
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+8
-6
lines changed

src/bootstrap/src/core/build_steps/test.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl Miri {
434434
builder: &Builder<'_>,
435435
compiler: Compiler,
436436
target: TargetSelection,
437-
) -> String {
437+
) -> PathBuf {
438438
let miri_sysroot = builder.out.join(compiler.host.triple).join("miri-sysroot");
439439
let mut cargo = builder::Cargo::new(
440440
builder,
@@ -467,7 +467,7 @@ impl Miri {
467467
// Output is "<sysroot>\n".
468468
let sysroot = stdout.trim_end();
469469
builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
470-
sysroot.to_owned()
470+
PathBuf::from(sysroot)
471471
}
472472
}
473473

@@ -520,12 +520,14 @@ impl Step for Miri {
520520
builder.ensure(compile::Std::new(target_compiler, host));
521521
let host_sysroot = builder.sysroot(target_compiler);
522522

523-
// Miri has its own "target dir" for ui test dependencies. Make sure it gets cleared
524-
// properly when rustc changes. Similar to `Builder::cargo`, we skip this in dry runs to
525-
// make sure the relevant compiler has been set up properly.
523+
// Miri has its own "target dir" for ui test dependencies. Make sure it gets cleared when
524+
// the sysroot gets rebuilt, to avoid "found possibly newer version of crate `std`" errors.
526525
if !builder.config.dry_run() {
527526
let ui_test_dep_dir = builder.stage_out(host_compiler, Mode::ToolStd).join("miri_ui");
528-
builder.clear_if_dirty(&ui_test_dep_dir, &builder.rustc(host_compiler));
527+
// The mtime of `miri_sysroot` changes when the sysroot gets rebuilt (also see
528+
// <https://github.com/RalfJung/rustc-build-sysroot/commit/10ebcf60b80fe2c3dc765af0ff19fdc0da4b7466>).
529+
// We can hence use that directly as a signal to clear the ui test dir.
530+
builder.clear_if_dirty(&ui_test_dep_dir, &miri_sysroot);
529531
}
530532

531533
// Run `cargo test`.

0 commit comments

Comments
 (0)