@@ -48,32 +48,6 @@ const MIR_OPT_BLESS_TARGET_MAPPING: &[(&str, &str)] = &[
4848 // build for, so there is no entry for "aarch64-apple-darwin" here.
4949] ;
5050
51- fn try_run ( builder : & Builder < ' _ > , cmd : & mut Command ) -> bool {
52- if !builder. fail_fast {
53- if builder. try_run ( cmd) . is_err ( ) {
54- let mut failures = builder. delayed_failures . borrow_mut ( ) ;
55- failures. push ( format ! ( "{:?}" , cmd) ) ;
56- return false ;
57- }
58- } else {
59- builder. run ( cmd) ;
60- }
61- true
62- }
63-
64- fn try_run_quiet ( builder : & Builder < ' _ > , cmd : & mut Command ) -> bool {
65- if !builder. fail_fast {
66- if !builder. try_run_quiet ( cmd) {
67- let mut failures = builder. delayed_failures . borrow_mut ( ) ;
68- failures. push ( format ! ( "{:?}" , cmd) ) ;
69- return false ;
70- }
71- } else {
72- builder. run_quiet ( cmd) ;
73- }
74- true
75- }
76-
7751#[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
7852pub struct CrateBootstrap {
7953 path : Interned < PathBuf > ,
@@ -193,7 +167,7 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
193167 let _guard =
194168 builder. msg ( Kind :: Test , compiler. stage , "Linkcheck" , bootstrap_host, bootstrap_host) ;
195169 let _time = util:: timeit ( & builder) ;
196- try_run ( builder, linkchecker. arg ( builder. out . join ( host. triple ) . join ( "doc" ) ) ) ;
170+ builder. run_delaying_failure ( linkchecker. arg ( builder. out . join ( host. triple ) . join ( "doc" ) ) ) ;
197171 }
198172
199173 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
@@ -246,7 +220,9 @@ impl Step for HtmlCheck {
246220 builder. default_doc ( & [ ] ) ;
247221 builder. ensure ( crate :: doc:: Rustc :: new ( builder. top_stage , self . target , builder) ) ;
248222
249- try_run ( builder, builder. tool_cmd ( Tool :: HtmlChecker ) . arg ( builder. doc_out ( self . target ) ) ) ;
223+ builder. run_delaying_failure (
224+ builder. tool_cmd ( Tool :: HtmlChecker ) . arg ( builder. doc_out ( self . target ) ) ,
225+ ) ;
250226 }
251227}
252228
@@ -285,8 +261,7 @@ impl Step for Cargotest {
285261
286262 let _time = util:: timeit ( & builder) ;
287263 let mut cmd = builder. tool_cmd ( Tool :: CargoTest ) ;
288- try_run (
289- builder,
264+ builder. run_delaying_failure (
290265 cmd. arg ( & cargo)
291266 . arg ( & out_dir)
292267 . args ( builder. config . test_args ( ) )
@@ -827,7 +802,8 @@ impl Step for Clippy {
827802
828803 let _guard = builder. msg_sysroot_tool ( Kind :: Test , compiler. stage , "clippy" , host, host) ;
829804
830- if builder. try_run ( & mut cargo) . is_ok ( ) {
805+ #[ allow( deprecated) ] // Clippy reports errors if it blessed the outputs
806+ if builder. config . try_run ( & mut cargo) . is_ok ( ) {
831807 // The tests succeeded; nothing to do.
832808 return ;
833809 }
@@ -887,7 +863,7 @@ impl Step for RustdocTheme {
887863 util:: lld_flag_no_threads ( self . compiler . host . contains ( "windows" ) ) ,
888864 ) ;
889865 }
890- try_run ( builder, & mut cmd) ;
866+ builder. run_delaying_failure ( & mut cmd) ;
891867 }
892868}
893869
@@ -1147,7 +1123,7 @@ help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy`
11471123 }
11481124
11491125 builder. info ( "tidy check" ) ;
1150- try_run ( builder, & mut cmd) ;
1126+ builder. run_delaying_failure ( & mut cmd) ;
11511127
11521128 builder. ensure ( ExpandYamlAnchors ) ;
11531129
@@ -1192,8 +1168,7 @@ impl Step for ExpandYamlAnchors {
11921168 /// by the user before committing CI changes.
11931169 fn run ( self , builder : & Builder < ' _ > ) {
11941170 builder. info ( "Ensuring the YAML anchors in the GitHub Actions config were expanded" ) ;
1195- try_run (
1196- builder,
1171+ builder. run_delaying_failure (
11971172 & mut builder. tool_cmd ( Tool :: ExpandYamlAnchors ) . arg ( "check" ) . arg ( & builder. src ) ,
11981173 ) ;
11991174 }
@@ -1982,7 +1957,7 @@ impl BookTest {
19821957 compiler. host ,
19831958 ) ;
19841959 let _time = util:: timeit ( & builder) ;
1985- let toolstate = if try_run ( builder, & mut rustbook_cmd) {
1960+ let toolstate = if builder. run_delaying_failure ( & mut rustbook_cmd) {
19861961 ToolState :: TestPass
19871962 } else {
19881963 ToolState :: TestFail
@@ -2144,9 +2119,9 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
21442119 cmd. arg ( "--test-args" ) . arg ( test_args) ;
21452120
21462121 if builder. config . verbose_tests {
2147- try_run ( builder, & mut cmd)
2122+ builder. run_delaying_failure ( & mut cmd)
21482123 } else {
2149- try_run_quiet ( builder, & mut cmd)
2124+ builder. run_quiet_delaying_failure ( & mut cmd)
21502125 }
21512126}
21522127
@@ -2172,7 +2147,7 @@ impl Step for RustcGuide {
21722147
21732148 let src = builder. src . join ( relative_path) ;
21742149 let mut rustbook_cmd = builder. tool_cmd ( Tool :: Rustbook ) ;
2175- let toolstate = if try_run ( builder, rustbook_cmd. arg ( "linkcheck" ) . arg ( & src) ) {
2150+ let toolstate = if builder. run_delaying_failure ( rustbook_cmd. arg ( "linkcheck" ) . arg ( & src) ) {
21762151 ToolState :: TestPass
21772152 } else {
21782153 ToolState :: TestFail
@@ -2725,7 +2700,7 @@ impl Step for Bootstrap {
27252700 . current_dir ( builder. src . join ( "src/bootstrap/" ) ) ;
27262701 // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible.
27272702 // Use `python -m unittest` manually if you want to pass arguments.
2728- try_run ( builder, & mut check_bootstrap) ;
2703+ builder. run_delaying_failure ( & mut check_bootstrap) ;
27292704
27302705 let mut cmd = Command :: new ( & builder. initial_cargo ) ;
27312706 cmd. arg ( "test" )
@@ -2801,7 +2776,7 @@ impl Step for TierCheck {
28012776 self . compiler . host ,
28022777 self . compiler . host ,
28032778 ) ;
2804- try_run ( builder, & mut cargo. into ( ) ) ;
2779+ builder. run_delaying_failure ( & mut cargo. into ( ) ) ;
28052780 }
28062781}
28072782
@@ -2887,7 +2862,7 @@ impl Step for RustInstaller {
28872862 cmd. env ( "CARGO" , & builder. initial_cargo ) ;
28882863 cmd. env ( "RUSTC" , & builder. initial_rustc ) ;
28892864 cmd. env ( "TMP_DIR" , & tmpdir) ;
2890- try_run ( builder, & mut cmd) ;
2865+ builder. run_delaying_failure ( & mut cmd) ;
28912866 }
28922867
28932868 fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
0 commit comments