@@ -27,6 +27,7 @@ use crate::core::builder::crate_description;
2727use crate :: core:: builder:: Cargo ;
2828use crate :: core:: builder:: { Builder , Kind , PathSet , RunConfig , ShouldRun , Step , TaskPath } ;
2929use crate :: core:: config:: { DebuginfoLevel , LlvmLibunwind , RustcLto , TargetSelection } ;
30+ use crate :: utils:: exec:: BehaviorOnFailure ;
3031use crate :: utils:: helpers:: {
3132 exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, output, symlink_dir, t, up_to_date,
3233} ;
@@ -289,7 +290,8 @@ impl Step for Std {
289290 target_deps,
290291 self . is_for_mir_opt_tests , // is_check
291292 false ,
292- ) ;
293+ )
294+ . unwrap ( ) ;
293295
294296 builder. ensure ( StdLink :: from_std (
295297 self ,
@@ -969,7 +971,8 @@ impl Step for Rustc {
969971 vec ! [ ] ,
970972 false ,
971973 true , // Only ship rustc_driver.so and .rmeta files, not all intermediate .rlib files.
972- ) ;
974+ )
975+ . unwrap ( ) ;
973976
974977 // When building `librustc_driver.so` (like `libLLVM.so`) on linux, it can contain
975978 // unexpected debuginfo from dependencies, for example from the C++ standard library used in
@@ -1381,7 +1384,7 @@ impl Step for CodegenBackend {
13811384 let tmp_stamp = out_dir. join ( ".tmp.stamp" ) ;
13821385
13831386 let _guard = builder. msg_build ( compiler, format_args ! ( "codegen backend {backend}" ) , target) ;
1384- let files = run_cargo ( builder, cargo, vec ! [ ] , & tmp_stamp, vec ! [ ] , false , false ) ;
1387+ let files = run_cargo ( builder, cargo, vec ! [ ] , & tmp_stamp, vec ! [ ] , false , false ) . unwrap ( ) ;
13851388 if builder. config . dry_run ( ) {
13861389 return ;
13871390 }
@@ -1907,7 +1910,8 @@ pub fn run_cargo(
19071910 additional_target_deps : Vec < ( PathBuf , DependencyType ) > ,
19081911 is_check : bool ,
19091912 rlib_only_metadata : bool ,
1910- ) -> Vec < PathBuf > {
1913+ ) -> Result < Vec < PathBuf > , ( ) > {
1914+ let failure_behavior = cargo. bootstrap_command . failure_behavior ;
19111915 // `target_root_dir` looks like $dir/$target/release
19121916 let target_root_dir = stamp. parent ( ) . unwrap ( ) ;
19131917 // `target_deps_dir` looks like $dir/$target/release/deps
@@ -2011,11 +2015,15 @@ pub fn run_cargo(
20112015 } ) ;
20122016
20132017 if !ok {
2014- crate :: exit!( 1 ) ;
2018+ if failure_behavior == BehaviorOnFailure :: Ignore {
2019+ return Ok ( Vec :: new ( ) ) ;
2020+ }
2021+
2022+ return Err ( ( ) ) ;
20152023 }
20162024
20172025 if builder. config . dry_run ( ) {
2018- return Vec :: new ( ) ;
2026+ return Ok ( Vec :: new ( ) ) ;
20192027 }
20202028
20212029 // Ok now we need to actually find all the files listed in `toplevel`. We've
@@ -2063,7 +2071,7 @@ pub fn run_cargo(
20632071 new_contents. extend ( b"\0 " ) ;
20642072 }
20652073 t ! ( fs:: write( stamp, & new_contents) ) ;
2066- deps. into_iter ( ) . map ( |( d, _) | d) . collect ( )
2074+ Ok ( deps. into_iter ( ) . map ( |( d, _) | d) . collect ( ) )
20672075}
20682076
20692077pub fn stream_cargo (
0 commit comments