@@ -434,7 +434,7 @@ impl Miri {
434
434
builder : & Builder < ' _ > ,
435
435
compiler : Compiler ,
436
436
target : TargetSelection ,
437
- ) -> String {
437
+ ) -> PathBuf {
438
438
let miri_sysroot = builder. out . join ( compiler. host . triple ) . join ( "miri-sysroot" ) ;
439
439
let mut cargo = builder:: Cargo :: new (
440
440
builder,
@@ -467,7 +467,7 @@ impl Miri {
467
467
// Output is "<sysroot>\n".
468
468
let sysroot = stdout. trim_end ( ) ;
469
469
builder. verbose ( || println ! ( "`cargo miri setup --print-sysroot` said: {sysroot:?}" ) ) ;
470
- sysroot . to_owned ( )
470
+ PathBuf :: from ( sysroot )
471
471
}
472
472
}
473
473
@@ -520,12 +520,14 @@ impl Step for Miri {
520
520
builder. ensure ( compile:: Std :: new ( target_compiler, host) ) ;
521
521
let host_sysroot = builder. sysroot ( target_compiler) ;
522
522
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.
526
525
if !builder. config . dry_run ( ) {
527
526
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
+ // It currently seems to be the case that the mtime of `miri_sysroot` changes when
528
+ // the sysroot gets rebuilt. If that ever stops happening, we'll have to make
529
+ // Miri explicitly update the mtime so that the logic here keeps working.
530
+ builder. clear_if_dirty ( & ui_test_dep_dir, & miri_sysroot) ;
529
531
}
530
532
531
533
// Run `cargo test`.
0 commit comments