@@ -86,7 +86,7 @@ struct ToolBuild {
8686}
8787
8888impl Step for ToolBuild {
89- type Output = PathBuf ;
89+ type Output = Option < PathBuf > ;
9090
9191 fn should_run ( run : ShouldRun ) -> ShouldRun {
9292 run. never ( )
@@ -96,7 +96,7 @@ impl Step for ToolBuild {
9696 ///
9797 /// This will build the specified tool with the specified `host` compiler in
9898 /// `stage` into the normal cargo output directory.
99- fn run ( self , builder : & Builder ) -> PathBuf {
99+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
100100 let build = builder. build ;
101101 let compiler = self . compiler ;
102102 let target = self . target ;
@@ -116,11 +116,15 @@ impl Step for ToolBuild {
116116
117117 let mut cargo = prepare_tool_cargo ( builder, compiler, target, "build" , path) ;
118118 build. run_expecting ( & mut cargo, expectation) ;
119- let cargo_out = build. cargo_out ( compiler, Mode :: Tool , target)
120- . join ( exe ( tool, & compiler. host ) ) ;
121- let bin = build. tools_dir ( compiler) . join ( exe ( tool, & compiler. host ) ) ;
122- copy ( & cargo_out, & bin) ;
123- bin
119+ if expectation == BuildExpectation :: Succeeding || expectation == BuildExpectation :: None {
120+ let cargo_out = build. cargo_out ( compiler, Mode :: Tool , target)
121+ . join ( exe ( tool, & compiler. host ) ) ;
122+ let bin = build. tools_dir ( compiler) . join ( exe ( tool, & compiler. host ) ) ;
123+ copy ( & cargo_out, & bin) ;
124+ Some ( bin)
125+ } else {
126+ None
127+ }
124128 }
125129}
126130
@@ -229,7 +233,7 @@ macro_rules! tool {
229233 mode: $mode,
230234 path: $path,
231235 expectation: BuildExpectation :: None ,
232- } )
236+ } ) . expect ( "expected to build -- BuildExpectation::None" )
233237 }
234238 }
235239 ) +
@@ -277,7 +281,7 @@ impl Step for RemoteTestServer {
277281 mode : Mode :: Libstd ,
278282 path : "src/tools/remote-test-server" ,
279283 expectation : BuildExpectation :: None ,
280- } )
284+ } ) . expect ( "expected to build -- BuildExpectation::None" )
281285 }
282286}
283287
@@ -395,7 +399,7 @@ impl Step for Cargo {
395399 mode : Mode :: Librustc ,
396400 path : "src/tools/cargo" ,
397401 expectation : BuildExpectation :: None ,
398- } )
402+ } ) . expect ( "BuildExpectation::None - expected to build" )
399403 }
400404}
401405
@@ -406,7 +410,7 @@ pub struct Clippy {
406410}
407411
408412impl Step for Clippy {
409- type Output = PathBuf ;
413+ type Output = Option < PathBuf > ;
410414 const DEFAULT : bool = true ;
411415 const ONLY_HOSTS : bool = true ;
412416
@@ -421,7 +425,7 @@ impl Step for Clippy {
421425 } ) ;
422426 }
423427
424- fn run ( self , builder : & Builder ) -> PathBuf {
428+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
425429 // Clippy depends on procedural macros (serde), which requires a full host
426430 // compiler to be available, so we need to depend on that.
427431 builder. ensure ( compile:: Rustc {
@@ -446,7 +450,7 @@ pub struct Rls {
446450}
447451
448452impl Step for Rls {
449- type Output = PathBuf ;
453+ type Output = Option < PathBuf > ;
450454 const DEFAULT : bool = true ;
451455 const ONLY_HOSTS : bool = true ;
452456
@@ -462,7 +466,7 @@ impl Step for Rls {
462466 } ) ;
463467 }
464468
465- fn run ( self , builder : & Builder ) -> PathBuf {
469+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
466470 builder. ensure ( native:: Openssl {
467471 target : self . target ,
468472 } ) ;
@@ -490,7 +494,7 @@ pub struct Rustfmt {
490494}
491495
492496impl Step for Rustfmt {
493- type Output = PathBuf ;
497+ type Output = Option < PathBuf > ;
494498 const DEFAULT : bool = true ;
495499 const ONLY_HOSTS : bool = true ;
496500
@@ -506,7 +510,7 @@ impl Step for Rustfmt {
506510 } ) ;
507511 }
508512
509- fn run ( self , builder : & Builder ) -> PathBuf {
513+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
510514 builder. ensure ( ToolBuild {
511515 compiler : self . compiler ,
512516 target : self . target ,
@@ -526,7 +530,7 @@ pub struct Miri {
526530}
527531
528532impl Step for Miri {
529- type Output = PathBuf ;
533+ type Output = Option < PathBuf > ;
530534 const DEFAULT : bool = true ;
531535 const ONLY_HOSTS : bool = true ;
532536
@@ -542,7 +546,7 @@ impl Step for Miri {
542546 } ) ;
543547 }
544548
545- fn run ( self , builder : & Builder ) -> PathBuf {
549+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
546550 builder. ensure ( ToolBuild {
547551 compiler : self . compiler ,
548552 target : self . target ,
0 commit comments