Skip to content

Commit a4fdbb0

Browse files
committed
Return nonzero exit code if there are errors at a stop point
1 parent 1501f33 commit a4fdbb0

File tree

215 files changed

+440
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+440
-6
lines changed

src/librustc_driver/driver.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ pub fn compile_input(sess: Session,
5252
output: &Option<PathBuf>,
5353
addl_plugins: Option<Vec<String>>,
5454
control: CompileController) {
55-
macro_rules! controller_entry_point{($point: ident, $make_state: expr) => ({
56-
{
57-
let state = $make_state;
58-
(control.$point.callback)(state);
59-
}
55+
macro_rules! controller_entry_point{($point: ident, $tsess: expr, $make_state: expr) => ({
56+
let state = $make_state;
57+
(control.$point.callback)(state);
58+
59+
$tsess.abort_if_errors();
6060
if control.$point.stop == Compilation::Stop {
6161
return;
6262
}
@@ -70,6 +70,7 @@ pub fn compile_input(sess: Session,
7070
let krate = phase_1_parse_input(&sess, cfg, input);
7171

7272
controller_entry_point!(after_parse,
73+
sess,
7374
CompileState::state_after_parse(input,
7475
&sess,
7576
outdir,
@@ -96,6 +97,7 @@ pub fn compile_input(sess: Session,
9697
};
9798

9899
controller_entry_point!(after_expand,
100+
sess,
99101
CompileState::state_after_expand(input,
100102
&sess,
101103
outdir,
@@ -109,6 +111,7 @@ pub fn compile_input(sess: Session,
109111
write_out_deps(&sess, input, &outputs, &id[..]);
110112

111113
controller_entry_point!(after_write_deps,
114+
sess,
112115
CompileState::state_after_write_deps(input,
113116
&sess,
114117
outdir,
@@ -123,6 +126,7 @@ pub fn compile_input(sess: Session,
123126
control.make_glob_map);
124127

125128
controller_entry_point!(after_analysis,
129+
analysis.ty_cx.sess,
126130
CompileState::state_after_analysis(input,
127131
&analysis.ty_cx.sess,
128132
outdir,
@@ -149,6 +153,7 @@ pub fn compile_input(sess: Session,
149153
phase_5_run_llvm_passes(&sess, &trans, &outputs);
150154

151155
controller_entry_point!(after_llvm,
156+
sess,
152157
CompileState::state_after_llvm(input,
153158
&sess,
154159
outdir,

src/test/compile-fail/mod_file_disambig.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both
1214

1315
fn main() {

src/test/compile-fail/mod_file_not_owning.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern: cannot declare a new module at this location
1214

1315
mod mod_file_not_owning_aux1;

src/test/parse-fail/array-old-syntax-1.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// Test that the old fixed length array syntax is a parsing error.
1214

1315
fn main() {

src/test/parse-fail/ascii-only-character-escape.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
let x = "\x80"; //~ ERROR may only be used
1315
let y = "\xff"; //~ ERROR may only be used

src/test/parse-fail/associated-types-project-from-hrtb-explicit.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// Test you can't use a higher-ranked trait bound inside of a qualified
1214
// path (just won't parse).
1315

src/test/parse-fail/attr-bad-meta.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:expected `]`
1214

1315
// asterisk is bogus

src/test/parse-fail/attr-before-eof.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
#[derive(Debug)] //~ERROR expected item after attributes

src/test/parse-fail/attr-before-ext.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
#[attr] //~ ERROR expected item after attributes
1315
println!("hi");

src/test/parse-fail/attr-before-let.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
#[attr] //~ ERROR expected item
1315
let __isize = 0;

src/test/parse-fail/attr-before-stmt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:expected item
1214

1315
fn f() {

src/test/parse-fail/attr-dangling-in-fn.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:expected item
1214

1315
fn f() {

src/test/parse-fail/attr-dangling-in-mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:expected item
1214

1315
fn main() {

src/test/parse-fail/attr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
#![feature(lang_items)]
1214

1315
fn main() {}

src/test/parse-fail/attrs-after-extern-mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// Constants (static variables) can be used to match in patterns, but mutable
1214
// statics cannot. This ensures that there's some form of error if this is
1315
// attempted.

src/test/parse-fail/bad-char-literals.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// ignore-tidy-cr
1214
// ignore-tidy-tab
1315
fn main() {

src/test/parse-fail/bad-lit-suffixes.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113

1214
extern crate
1315
"foo"suffix //~ ERROR extern crate name with a suffix is illegal

src/test/parse-fail/bad-match.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern: expected
1214

1315
fn main() {

src/test/parse-fail/bad-name.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern: expected
1214

1315
fn main() {

src/test/parse-fail/bad-value-ident-false.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn false() { } //~ ERROR expected identifier, found keyword `false`
1214
fn main() { }

src/test/parse-fail/bad-value-ident-true.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn true() { } //~ ERROR expected identifier, found keyword `true`
1214
fn main() { }

src/test/parse-fail/better-expected.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
1315
}

src/test/parse-fail/bind-struct-early-modifiers.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
struct Foo { x: isize }
1315
match (Foo { x: 10 }) {

src/test/parse-fail/byte-literals.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113

1214
// ignore-tidy-tab
1315

src/test/parse-fail/byte-string-literals.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113

1214
// ignore-tidy-tab
1315

src/test/parse-fail/circular_modules_hello.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// ignore-test: this is an auxiliary file for circular-modules-main.rs
1214

1315
mod circular_modules_main;

src/test/parse-fail/circular_modules_main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
#[path = "circular_modules_hello.rs"]
1214
mod circular_modules_hello; //~ ERROR: circular modules
1315

src/test/parse-fail/class-implements-bad-trait.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:nonexistent
1214
class cat : nonexistent {
1315
let meows: usize;

src/test/parse-fail/column-offset-1-based.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
# //~ ERROR 11:1: 11:2 error: expected `[`, found `<eof>`
11+
// compile-flags: -Z parse-only
12+
13+
# //~ ERROR 13:1: 13:2 error: expected `[`, found `<eof>`

src/test/parse-fail/doc-before-attr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
/// hi
1214
#[derive(Debug)] //~ERROR expected item after attributes

src/test/parse-fail/doc-before-eof.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
/// hi //~ERROR expected item after doc comment

src/test/parse-fail/doc-before-extern-rbrace.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
extern {
1214
/// hi
1315
}

src/test/parse-fail/doc-before-macro.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
/// hi
1315
println!("hi");

src/test/parse-fail/doc-before-rbrace.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
println!("Hi"); /// hi
1315
//~^ ERROR expected item after doc comment

src/test/parse-fail/doc-before-semi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
fn main() {
1214
/// hi
1315
;

src/test/parse-fail/duplicate-visibility.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// error-pattern:unmatched visibility `pub`
1214
extern {
1315
pub pub fn foo();

src/test/parse-fail/empty-impl-semicolon.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
impl Foo; //~ ERROR expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `;`

src/test/parse-fail/extern-expected-fn-or-brace.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// Verifies that the expected token errors for `extern crate` are
1214
// raised
1315

src/test/parse-fail/extern-foreign-crate.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
// Verifies that the expected token errors for `extern crate` are
1214
// raised
1315

src/test/parse-fail/extern-no-fn.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// compile-flags: -Z parse-only
12+
1113
extern {
1214
f(); //~ ERROR expected one of `fn`, `pub`, `static`, `unsafe`, or `}`, found `f`
1315
}

0 commit comments

Comments
 (0)