Auto merge of #1366 - RalfJung:rustc-exit, r=RalfJung
fix exit code on rustc errors Fixes https://github.com/rust-lang/miri/issues/1352
This commit is contained in:
commit
01db8b4d1e
2 changed files with 11 additions and 2 deletions
|
|
@ -259,6 +259,11 @@ fn main() {
|
|||
rustc_driver::install_ice_hook();
|
||||
let result = rustc_driver::catch_fatal_errors(move || {
|
||||
rustc_driver::run_compiler(&rustc_args, &mut MiriCompilerCalls { miri_config }, None, None)
|
||||
});
|
||||
std::process::exit(result.is_err() as i32);
|
||||
})
|
||||
.and_then(|result| result);
|
||||
let exit_code = match result {
|
||||
Ok(()) => rustc_driver::EXIT_SUCCESS,
|
||||
Err(_) => rustc_driver::EXIT_FAILURE,
|
||||
};
|
||||
std::process::exit(exit_code);
|
||||
}
|
||||
|
|
|
|||
4
tests/compile-fail/rustc-error.rs
Normal file
4
tests/compile-fail/rustc-error.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Make sure we exit with non-0 status code when the program fails to build.
|
||||
fn main() {
|
||||
println("Hello, world!"); //~ ERROR expected function, found macro
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue