Auto merge of #52197 - euclio:exit-code, r=oli-obk
overhaul exit codes for rustc and rustdoc This commit changes the exit status of rustc to 1 in the presence of compilation errors. In the event of an unexpected panic (ICE) the standard panic error exit status of 101 remains. A run-make test is added to ensure that the exit code does not regress, and compiletest is updated to check for an exit status of 1 or 101, depending on the mode and suite. This is a breaking change for custom drivers. Note that while changes were made to the rustdoc binary, there is no intended behavior change. rustdoc errors (i.e., failed lints) will still report 101. While this could *also* hide potential ICEs, I will leave that work to a future PR. Fixes #51971.
This commit is contained in:
commit
a8247dd5c6
9 changed files with 110 additions and 25 deletions
11
src/test/run-make-fulldeps/exit-code/Makefile
Normal file
11
src/test/run-make-fulldeps/exit-code/Makefile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) success.rs; [ $$? -eq 0 ]
|
||||
$(RUSTC) --invalid-arg-foo; [ $$? -eq 1 ]
|
||||
$(RUSTC) compile-error.rs; [ $$? -eq 1 ]
|
||||
$(RUSTC) -Ztreat-err-as-bug compile-error.rs; [ $$? -eq 101 ]
|
||||
$(RUSTDOC) -o $(TMPDIR)/exit-code success.rs; [ $$? -eq 0 ]
|
||||
$(RUSTDOC) --invalid-arg-foo; [ $$? -eq 1 ]
|
||||
$(RUSTDOC) compile-error.rs; [ $$? -eq 1 ]
|
||||
$(RUSTDOC) lint-failure.rs; [ $$? -eq 1 ]
|
||||
13
src/test/run-make-fulldeps/exit-code/compile-error.rs
Normal file
13
src/test/run-make-fulldeps/exit-code/compile-error.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
compile_error!("kaboom");
|
||||
}
|
||||
16
src/test/run-make-fulldeps/exit-code/lint-failure.rs
Normal file
16
src/test/run-make-fulldeps/exit-code/lint-failure.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(intra_doc_link_resolution_failure)]
|
||||
|
||||
/// [intradoc::failure]
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
14
src/test/run-make-fulldeps/exit-code/success.rs
Normal file
14
src/test/run-make-fulldeps/exit-code/success.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/// Main function
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test currently ICEs when using NLL (#52416)
|
||||
|
||||
// We used to ICE when moving out of a `*mut T` or `*const T`.
|
||||
|
||||
struct T(u8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue