Skip to content

Commit 476a3c6

Browse files
committed
Return nonzero exit code if there are errors at a stop point
1 parent cf636c2 commit 476a3c6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/librustc_driver/driver.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,22 @@ pub fn compile_input(sess: Session,
5252
addl_plugins: Option<Vec<String>>,
5353
control: CompileController) {
5454
macro_rules! controller_entry_point{($point: ident, $make_state: expr) => ({
55+
let err_count;
5556
{
5657
let state = $make_state;
58+
err_count = (*state.session).err_count();
5759
(control.$point.callback)(state);
5860
}
5961
if control.$point.stop == Compilation::Stop {
60-
return;
62+
let s;
63+
match err_count {
64+
0 => return,
65+
1 => s = "build failed due to previous error".to_string(),
66+
_ => {
67+
s = format!("builed failed due to {} previous errors", err_count);
68+
}
69+
}
70+
panic!(s);
6171
}
6272
})}
6373

0 commit comments

Comments
 (0)