diff options
| author | Andy Russell <arussell123@gmail.com> | 2018-07-09 14:01:10 -0400 |
|---|---|---|
| committer | Andy Russell <arussell123@gmail.com> | 2018-07-18 00:24:13 -0400 |
| commit | 8f4ccac5e24ab9f0a786a87eb08d633c28d076ef (patch) | |
| tree | 89cfe1ff1d4d0cc12f0babd436919d6d44f7650b /src/test/run-make-fulldeps/exit-code | |
| parent | 4f3c7a472b77ba3f3afbc12d004b9d1bbcee7fe7 (diff) | |
| download | rust-8f4ccac5e24ab9f0a786a87eb08d633c28d076ef.tar.gz rust-8f4ccac5e24ab9f0a786a87eb08d633c28d076ef.zip | |
rustc: distinguish compilation failure from ICE
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. Fixes #51971.
Diffstat (limited to 'src/test/run-make-fulldeps/exit-code')
| -rw-r--r-- | src/test/run-make-fulldeps/exit-code/Makefile | 11 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/exit-code/compile-error.rs | 13 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/exit-code/lint-failure.rs | 16 | ||||
| -rw-r--r-- | src/test/run-make-fulldeps/exit-code/success.rs | 14 |
4 files changed, 54 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/exit-code/Makefile b/src/test/run-make-fulldeps/exit-code/Makefile new file mode 100644 index 00000000000..007f19852a6 --- /dev/null +++ b/src/test/run-make-fulldeps/exit-code/Makefile @@ -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 ] diff --git a/src/test/run-make-fulldeps/exit-code/compile-error.rs b/src/test/run-make-fulldeps/exit-code/compile-error.rs new file mode 100644 index 00000000000..8c05318a508 --- /dev/null +++ b/src/test/run-make-fulldeps/exit-code/compile-error.rs @@ -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"); +} diff --git a/src/test/run-make-fulldeps/exit-code/lint-failure.rs b/src/test/run-make-fulldeps/exit-code/lint-failure.rs new file mode 100644 index 00000000000..3bf40b753c1 --- /dev/null +++ b/src/test/run-make-fulldeps/exit-code/lint-failure.rs @@ -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!"); +} diff --git a/src/test/run-make-fulldeps/exit-code/success.rs b/src/test/run-make-fulldeps/exit-code/success.rs new file mode 100644 index 00000000000..9f6c5734a30 --- /dev/null +++ b/src/test/run-make-fulldeps/exit-code/success.rs @@ -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!"); +} |
