@@ -437,47 +437,44 @@ pub struct Miri {
437437 target : TargetSelection ,
438438}
439439
440- impl Miri {
441- /// Run `cargo miri setup` for the given target, return where the Miri sysroot was put.
442- pub fn build_miri_sysroot (
443- builder : & Builder < ' _ > ,
444- compiler : Compiler ,
445- target : TargetSelection ,
446- ) -> PathBuf {
447- let miri_sysroot = builder. out . join ( compiler. host ) . join ( "miri-sysroot" ) ;
448- let mut cargo = builder:: Cargo :: new (
449- builder,
450- compiler,
451- Mode :: Std ,
452- SourceType :: Submodule ,
453- target,
454- Kind :: MiriSetup ,
455- ) ;
440+ /// Run `cargo miri setup` for the given target, return where the Miri sysroot was put.
441+ pub ( crate ) fn build_miri_sysroot (
442+ builder : & Builder < ' _ > ,
443+ compiler : Compiler ,
444+ target : TargetSelection ,
445+ ) -> PathBuf {
446+ let miri_sysroot = builder. out . join ( compiler. host ) . join ( "miri-sysroot" ) ;
447+ let mut cargo = builder:: Cargo :: new (
448+ builder,
449+ compiler,
450+ Mode :: Std ,
451+ SourceType :: Submodule ,
452+ target,
453+ Kind :: MiriSetup ,
454+ ) ;
456455
457- // Tell `cargo miri setup` where to find the sources.
458- cargo. env ( "MIRI_LIB_SRC" , builder. src . join ( "library" ) ) ;
459- // Tell it where to put the sysroot.
460- cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
456+ // Tell `cargo miri setup` where to find the sources.
457+ cargo. env ( "MIRI_LIB_SRC" , builder. src . join ( "library" ) ) ;
458+ // Tell it where to put the sysroot.
459+ cargo. env ( "MIRI_SYSROOT" , & miri_sysroot) ;
461460
462- let mut cargo = BootstrapCommand :: from ( cargo) ;
463- let _guard =
464- builder. msg ( Kind :: Build , compiler. stage , "miri sysroot" , compiler. host , target) ;
465- cargo. run ( builder) ;
461+ let mut cargo = BootstrapCommand :: from ( cargo) ;
462+ let _guard = builder. msg ( Kind :: Build , compiler. stage , "miri sysroot" , compiler. host , target) ;
463+ cargo. run ( builder) ;
466464
467- // # Determine where Miri put its sysroot.
468- // To this end, we run `cargo miri setup --print-sysroot` and capture the output.
469- // (We do this separately from the above so that when the setup actually
470- // happens we get some output.)
471- // We re-use the `cargo` from above.
472- cargo. arg ( "--print-sysroot" ) ;
465+ // # Determine where Miri put its sysroot.
466+ // To this end, we run `cargo miri setup --print-sysroot` and capture the output.
467+ // (We do this separately from the above so that when the setup actually
468+ // happens we get some output.)
469+ // We re-use the `cargo` from above.
470+ cargo. arg ( "--print-sysroot" ) ;
473471
474- builder. verbose ( || println ! ( "running: {cargo:?}" ) ) ;
475- let stdout = cargo. run_capture_stdout ( builder) . stdout ( ) ;
476- // Output is "<sysroot>\n".
477- let sysroot = stdout. trim_end ( ) ;
478- builder. verbose ( || println ! ( "`cargo miri setup --print-sysroot` said: {sysroot:?}" ) ) ;
479- PathBuf :: from ( sysroot)
480- }
472+ builder. verbose ( || println ! ( "running: {cargo:?}" ) ) ;
473+ let stdout = cargo. run_capture_stdout ( builder) . stdout ( ) ;
474+ // Output is "<sysroot>\n".
475+ let sysroot = stdout. trim_end ( ) ;
476+ builder. verbose ( || println ! ( "`cargo miri setup --print-sysroot` said: {sysroot:?}" ) ) ;
477+ PathBuf :: from ( sysroot)
481478}
482479
483480impl Step for Miri {
@@ -517,7 +514,7 @@ impl Step for Miri {
517514
518515 // We also need sysroots, for Miri and for the host (the latter for build scripts).
519516 // This is for the tests so everything is done with the target compiler.
520- let miri_sysroot = Miri :: build_miri_sysroot ( builder, target_compiler, target) ;
517+ let miri_sysroot = build_miri_sysroot ( builder, target_compiler, target) ;
521518 builder. ensure ( compile:: Std :: new ( target_compiler, host) ) ;
522519 let host_sysroot = builder. sysroot ( target_compiler) ;
523520
0 commit comments