@@ -22,7 +22,6 @@ use native;
2222use channel:: GitInfo ;
2323use cache:: Interned ;
2424use toolstate:: ToolState ;
25- use build_helper:: BuildExpectation ;
2625
2726#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
2827pub struct CleanTools {
@@ -82,7 +81,7 @@ struct ToolBuild {
8281 tool : & ' static str ,
8382 path : & ' static str ,
8483 mode : Mode ,
85- expectation : BuildExpectation ,
84+ is_ext_tool : bool ,
8685}
8786
8887impl Step for ToolBuild {
@@ -102,7 +101,7 @@ impl Step for ToolBuild {
102101 let target = self . target ;
103102 let tool = self . tool ;
104103 let path = self . path ;
105- let expectation = self . expectation ;
104+ let is_ext_tool = self . is_ext_tool ;
106105
107106 match self . mode {
108107 Mode :: Libstd => builder. ensure ( compile:: Std { compiler, target } ) ,
@@ -115,34 +114,25 @@ impl Step for ToolBuild {
115114 println ! ( "Building stage{} tool {} ({})" , compiler. stage, tool, target) ;
116115
117116 let mut cargo = prepare_tool_cargo ( builder, compiler, target, "build" , path) ;
118- let is_expected = build. try_run ( & mut cargo, expectation) ;
119- // If the expectation is "Failing", `try_run` returning true actually
120- // means a build-failure is successfully observed, i.e. the tool is
121- // broken. Thus the XOR here.
122- // Sorry for the complicated logic, but we can remove this expectation
123- // logic after #45861 is fully fixed.
124- build. save_toolstate ( tool, if is_expected ^ ( expectation == BuildExpectation :: Failing ) {
117+ let is_expected = build. try_run ( & mut cargo) ;
118+ build. save_toolstate ( tool, if is_expected {
125119 ToolState :: Compiling
126120 } else {
127121 ToolState :: Broken
128122 } ) ;
129123
130124 if !is_expected {
131- if expectation == BuildExpectation :: None {
125+ if !is_ext_tool {
132126 exit ( 1 ) ;
133127 } else {
134128 return None ;
135129 }
136- }
137-
138- if expectation == BuildExpectation :: Succeeding || expectation == BuildExpectation :: None {
130+ } else {
139131 let cargo_out = build. cargo_out ( compiler, Mode :: Tool , target)
140132 . join ( exe ( tool, & compiler. host ) ) ;
141133 let bin = build. tools_dir ( compiler) . join ( exe ( tool, & compiler. host ) ) ;
142134 copy ( & cargo_out, & bin) ;
143135 Some ( bin)
144- } else {
145- None
146136 }
147137 }
148138}
@@ -251,8 +241,8 @@ macro_rules! tool {
251241 tool: $tool_name,
252242 mode: $mode,
253243 path: $path,
254- expectation : BuildExpectation :: None ,
255- } ) . expect( "expected to build -- BuildExpectation::None " )
244+ is_ext_tool : false ,
245+ } ) . expect( "expected to build -- essential tool " )
256246 }
257247 }
258248 ) +
@@ -299,8 +289,8 @@ impl Step for RemoteTestServer {
299289 tool : "remote-test-server" ,
300290 mode : Mode :: Libstd ,
301291 path : "src/tools/remote-test-server" ,
302- expectation : BuildExpectation :: None ,
303- } ) . expect ( "expected to build -- BuildExpectation::None " )
292+ is_ext_tool : false ,
293+ } ) . expect ( "expected to build -- essential tool " )
304294 }
305295}
306296
@@ -417,8 +407,8 @@ impl Step for Cargo {
417407 tool : "cargo" ,
418408 mode : Mode :: Librustc ,
419409 path : "src/tools/cargo" ,
420- expectation : BuildExpectation :: None ,
421- } ) . expect ( "BuildExpectation::None - expected to build" )
410+ is_ext_tool : false ,
411+ } ) . expect ( "expected to build -- essential tool " )
422412 }
423413}
424414
@@ -455,14 +445,13 @@ macro_rules! tool_extended {
455445
456446 fn run( $sel, $builder: & Builder ) -> Option <PathBuf > {
457447 $extra_deps
458- let toolstate = $builder. build. config. toolstate. $toolstate;
459448 $builder. ensure( ToolBuild {
460449 compiler: $sel. compiler,
461450 target: $sel. target,
462451 tool: $tool_name,
463452 mode: Mode :: Librustc ,
464453 path: $path,
465- expectation : toolstate . passes ( ToolState :: Compiling ) ,
454+ is_ext_tool : true ,
466455 } )
467456 }
468457 }
0 commit comments