@@ -133,7 +133,7 @@ impl Step for ToolBuild {
133133 builder. std ( self . build_compiler , target) ;
134134 }
135135 }
136- Mode :: ToolBootstrap => { } // uses downloaded stage0 compiler libs
136+ Mode :: ToolBootstrap | Mode :: ToolTarget => { } // uses downloaded stage0 compiler libs
137137 _ => panic ! ( "unexpected Mode for tool build" ) ,
138138 }
139139
@@ -196,7 +196,7 @@ impl Step for ToolBuild {
196196 Kind :: Build ,
197197 self . mode ,
198198 self . tool ,
199- self . build_compiler . stage ,
199+ self . build_compiler . stage + 1 ,
200200 & self . build_compiler . host ,
201201 & self . target ,
202202 ) ;
@@ -365,15 +365,15 @@ pub(crate) fn get_tool_rustc_compiler(
365365 builder. compiler ( target_compiler. stage . saturating_sub ( 1 ) , builder. config . host_target )
366366}
367367
368- /// Returns a compiler that is able to compile a `ToolTarget` tool for the given `target`.
369- pub ( crate ) fn get_tool_target_compiler ( builder : & Builder < ' _ > , target : TargetSelection ) -> Compiler {
370- todo ! ( "FIX" ) ;
371- if builder. host_target == target {
368+ /// Returns the smallest stage compiler that is able to compile code for the given `target`.
369+ pub ( crate ) fn get_compiler_for_target ( builder : & Builder < ' _ > , target : TargetSelection ) -> Compiler {
370+ let compiler = if builder. host_target == target {
372371 builder. compiler ( 0 , builder. host_target )
373372 } else {
374- // FIXME: should this be builder.top_stage to avoid rebuilds?
375- builder. compiler ( 1 , target)
376- }
373+ builder. compiler ( 1 , builder. host_target )
374+ } ;
375+ builder. std ( compiler, target) ;
376+ compiler
377377}
378378
379379/// Links a built tool binary with the given `name` from the build directory to the
@@ -648,7 +648,7 @@ impl Step for ErrorIndex {
648648
649649#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
650650pub struct RemoteTestServer {
651- pub compiler : Compiler ,
651+ pub build_compiler : Compiler ,
652652 pub target : TargetSelection ,
653653}
654654
@@ -661,17 +661,17 @@ impl Step for RemoteTestServer {
661661
662662 fn make_run ( run : RunConfig < ' _ > ) {
663663 run. builder . ensure ( RemoteTestServer {
664- compiler : run . builder . compiler ( run. builder . top_stage , run. builder . config . host_target ) ,
664+ build_compiler : get_compiler_for_target ( run. builder , run. target ) ,
665665 target : run. target ,
666666 } ) ;
667667 }
668668
669669 fn run ( self , builder : & Builder < ' _ > ) -> ToolBuildResult {
670670 builder. ensure ( ToolBuild {
671- build_compiler : self . compiler ,
671+ build_compiler : self . build_compiler ,
672672 target : self . target ,
673673 tool : "remote-test-server" ,
674- mode : Mode :: ToolStd ,
674+ mode : Mode :: ToolTarget ,
675675 path : "src/tools/remote-test-server" ,
676676 source_type : SourceType :: InTree ,
677677 extra_features : Vec :: new ( ) ,
@@ -680,6 +680,10 @@ impl Step for RemoteTestServer {
680680 artifact_kind : ToolArtifactKind :: Binary ,
681681 } )
682682 }
683+
684+ fn metadata ( & self ) -> Option < StepMetadata > {
685+ Some ( StepMetadata :: build ( "remote-test-server" , self . target ) . built_by ( self . build_compiler ) )
686+ }
683687}
684688
685689#[ derive( Debug , Clone , Hash , PartialEq , Eq , Ord , PartialOrd ) ]
0 commit comments