Skip to content

Commit c1cc39f

Browse files
committed
Return nonzero exit code if there are errors at a stop point
1 parent 012e964 commit c1cc39f

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
@@ -51,12 +51,22 @@ pub fn compile_input(sess: Session,
5151
addl_plugins: Option<Vec<String>>,
5252
control: CompileController) {
5353
macro_rules! controller_entry_point{($point: ident, $make_state: expr) => ({
54+
let err_count;
5455
{
5556
let state = $make_state;
57+
err_count = (*state.session).err_count();
5658
(control.$point.callback)(state);
5759
}
5860
if control.$point.stop {
59-
return;
61+
let s;
62+
match err_count {
63+
0 => return,
64+
1 => s = "build failed due to previous error".to_string(),
65+
_ => {
66+
s = format!("builed failed due to {} previous errors", err_count);
67+
}
68+
}
69+
panic!(s);
6070
}
6171
})}
6272

0 commit comments

Comments
 (0)