Skip to content

Commit 8cc5cd4

Browse files
committed
Always ignore build failure of failable tools (rls, rustfmt, clippy, miri).
If build failed for these tools, they will be automatically skipped from distribution, and will not fail the whole build. Test failures are *not* ignored, nor build failure of other tools (e.g. cargo). Therefore it should have no observable effect to the current CI system. This is step 1/8 of automatic management of broken tools #45861.
1 parent 63739ab commit 8cc5cd4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/bootstrap/dist.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ impl Step for Rls {
10831083
let rls = builder.ensure(tool::Rls {
10841084
compiler: builder.compiler(stage, build.build),
10851085
target
1086-
}).expect("Rls to build: toolstate is testing");
1086+
}).or_else(|| { println!("Unable to build RLS, skipping dist"); None })?;
1087+
10871088
install(&rls, &image.join("bin"), 0o755);
10881089
let doc = image.join("share/doc/rls");
10891090
install(&src.join("README.md"), &doc, 0o644);
@@ -1167,11 +1168,12 @@ impl Step for Rustfmt {
11671168
let rustfmt = builder.ensure(tool::Rustfmt {
11681169
compiler: builder.compiler(stage, build.build),
11691170
target
1170-
}).expect("Rustfmt to build: toolstate is testing");
1171+
}).or_else(|| { println!("Unable to build Rustfmt, skipping dist"); None })?;
11711172
let cargofmt = builder.ensure(tool::Cargofmt {
11721173
compiler: builder.compiler(stage, build.build),
11731174
target
1174-
}).expect("Cargofmt to build: toolstate is testing");
1175+
}).or_else(|| { println!("Unable to build Cargofmt, skipping dist"); None })?;
1176+
11751177
install(&rustfmt, &image.join("bin"), 0o755);
11761178
install(&cargofmt, &image.join("bin"), 0o755);
11771179
let doc = image.join("share/doc/rustfmt");

src/bootstrap/tool.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use std::fs;
1212
use std::env;
1313
use std::path::PathBuf;
14-
use std::process::Command;
14+
use std::process::{Command, exit};
1515

1616
use Mode;
1717
use Compiler;
@@ -115,7 +115,14 @@ impl Step for ToolBuild {
115115
println!("Building stage{} tool {} ({})", compiler.stage, tool, target);
116116

117117
let mut cargo = prepare_tool_cargo(builder, compiler, target, "build", path);
118-
build.run_expecting(&mut cargo, expectation);
118+
if !build.try_run(&mut cargo, expectation) {
119+
if expectation == BuildExpectation::None {
120+
exit(1);
121+
} else {
122+
return None;
123+
}
124+
}
125+
119126
if expectation == BuildExpectation::Succeeding || expectation == BuildExpectation::None {
120127
let cargo_out = build.cargo_out(compiler, Mode::Tool, target)
121128
.join(exe(tool, &compiler.host));

0 commit comments

Comments
 (0)