11//! Implementation of compiling the compiler and standard library, in "check"-based modes.
22
3- use std:: path:: PathBuf ;
4-
53use crate :: core:: build_steps:: compile:: {
64 add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make,
75} ;
@@ -10,6 +8,7 @@ use crate::core::builder::{
108 self , Alias , Builder , Kind , RunConfig , ShouldRun , Step , crate_description,
119} ;
1210use crate :: core:: config:: TargetSelection ;
11+ use crate :: utils:: build_stamp:: BuildStamp ;
1312use crate :: { Compiler , Mode , Subcommand } ;
1413
1514#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -393,8 +392,9 @@ impl Step for RustAnalyzer {
393392
394393 /// Cargo's output path in a given stage, compiled by a particular
395394 /// compiler for the specified target.
396- fn stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> PathBuf {
397- builder. cargo_out ( compiler, Mode :: ToolRustc , target) . join ( ".rust-analyzer-check.stamp" )
395+ fn stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> BuildStamp {
396+ BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: ToolRustc , target) )
397+ . with_prefix ( "rust-analyzer-check" )
398398 }
399399 }
400400}
@@ -469,9 +469,8 @@ fn run_tool_check_step(
469469 cargo. arg ( "--all-targets" ) ;
470470 }
471471
472- let stamp = builder
473- . cargo_out ( compiler, Mode :: ToolRustc , target)
474- . join ( format ! ( ".{}-check.stamp" , step_type_name. to_lowercase( ) ) ) ;
472+ let stamp = BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: ToolRustc , target) )
473+ . with_prefix ( & format ! ( "{}-check" , step_type_name. to_lowercase( ) ) ) ;
475474
476475 let _guard = builder. msg_check ( format ! ( "{display_name} artifacts" ) , target) ;
477476 run_cargo ( builder, cargo, builder. config . free_args . clone ( ) , & stamp, vec ! [ ] , true , false ) ;
@@ -502,8 +501,8 @@ tool_check_step!(Compiletest { path: "src/tools/compiletest", default: false });
502501
503502/// Cargo's output path for the standard library in a given stage, compiled
504503/// by a particular compiler for the specified target.
505- fn libstd_stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> PathBuf {
506- builder. cargo_out ( compiler, Mode :: Std , target) . join ( ". libstd-check.stamp ")
504+ fn libstd_stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> BuildStamp {
505+ BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: Std , target) ) . with_prefix ( " libstd-check")
507506}
508507
509508/// Cargo's output path for the standard library in a given stage, compiled
@@ -512,14 +511,19 @@ fn libstd_test_stamp(
512511 builder : & Builder < ' _ > ,
513512 compiler : Compiler ,
514513 target : TargetSelection ,
515- ) -> PathBuf {
516- builder. cargo_out ( compiler, Mode :: Std , target) . join ( ".libstd-check-test.stamp" )
514+ ) -> BuildStamp {
515+ BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: Std , target) )
516+ . with_prefix ( "libstd-check-test" )
517517}
518518
519519/// Cargo's output path for librustc in a given stage, compiled by a particular
520520/// compiler for the specified target.
521- fn librustc_stamp ( builder : & Builder < ' _ > , compiler : Compiler , target : TargetSelection ) -> PathBuf {
522- builder. cargo_out ( compiler, Mode :: Rustc , target) . join ( ".librustc-check.stamp" )
521+ fn librustc_stamp (
522+ builder : & Builder < ' _ > ,
523+ compiler : Compiler ,
524+ target : TargetSelection ,
525+ ) -> BuildStamp {
526+ BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: Rustc , target) ) . with_prefix ( "librustc-check" )
523527}
524528
525529/// Cargo's output path for librustc_codegen_llvm in a given stage, compiled by a particular
@@ -529,8 +533,7 @@ fn codegen_backend_stamp(
529533 compiler : Compiler ,
530534 target : TargetSelection ,
531535 backend : & str ,
532- ) -> PathBuf {
533- builder
534- . cargo_out ( compiler, Mode :: Codegen , target)
535- . join ( format ! ( ".librustc_codegen_{backend}-check.stamp" ) )
536+ ) -> BuildStamp {
537+ BuildStamp :: new ( & builder. cargo_out ( compiler, Mode :: Codegen , target) )
538+ . with_prefix ( & format ! ( "librustc_codegen_{backend}-check" ) )
536539}
0 commit comments