Skip to content

Commit 9e6190d

Browse files
committed
Return nonzero exit code if there are errors at a stop point
1 parent cf636c2 commit 9e6190d

File tree

130 files changed

+275
-5
lines changed

Some content is hidden

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

130 files changed

+275
-5
lines changed

src/librustc_driver/driver.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ pub fn compile_input(sess: Session,
5151
output: &Option<Path>,
5252
addl_plugins: Option<Vec<String>>,
5353
control: CompileController) {
54-
macro_rules! controller_entry_point{($point: ident, $make_state: expr) => ({
55-
{
56-
let state = $make_state;
57-
(control.$point.callback)(state);
58-
}
54+
macro_rules! controller_entry_point{($point: ident, $tsess: expr, $make_state: expr) => ({
55+
let state = $make_state;
56+
(control.$point.callback)(state);
57+
58+
$tsess.abort_if_errors();
59+
5960
if control.$point.stop == Compilation::Stop {
6061
return;
6162
}
@@ -69,6 +70,7 @@ pub fn compile_input(sess: Session,
6970
let krate = phase_1_parse_input(&sess, cfg, input);
7071

7172
controller_entry_point!(after_parse,
73+
sess,
7274
CompileState::state_after_parse(input,
7375
&sess,
7476
outdir,
@@ -95,6 +97,7 @@ pub fn compile_input(sess: Session,
9597
};
9698

9799
controller_entry_point!(after_expand,
100+
sess,
98101
CompileState::state_after_expand(input,
99102
&sess,
100103
outdir,
@@ -108,6 +111,7 @@ pub fn compile_input(sess: Session,
108111
write_out_deps(&sess, input, &outputs, &id[]);
109112

110113
controller_entry_point!(after_write_deps,
114+
sess,
111115
CompileState::state_after_write_deps(input,
112116
&sess,
113117
outdir,
@@ -121,6 +125,7 @@ pub fn compile_input(sess: Session,
121125
control.make_glob_map);
122126

123127
controller_entry_point!(after_analysis,
128+
analysis.ty_cx.sess,
124129
CompileState::state_after_analysis(input,
125130
&analysis.ty_cx.sess,
126131
outdir,
@@ -147,6 +152,7 @@ pub fn compile_input(sess: Session,
147152
phase_5_run_llvm_passes(&sess, &trans, &outputs);
148153

149154
controller_entry_point!(after_llvm,
155+
sess,
150156
CompileState::state_after_llvm(input,
151157
&sess,
152158
outdir,

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/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/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/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

+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
# //~ ERROR 11:1: 11:2 error: expected one of `!` or `[`, found `<eof>`

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
}

src/test/parse-fail/import-from-path.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
// error-pattern:expected
1214
use foo::{bar}::baz

src/test/parse-fail/import-from-rename.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
use foo::{bar} as baz;

src/test/parse-fail/import-glob-path.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
// error-pattern:expected
1214
use foo::*::bar

src/test/parse-fail/import-glob-rename.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
use foo::* as baz;

src/test/parse-fail/issue-10392-2.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
struct A { foo: isize }
1214

1315
fn a() -> A { panic!() }

src/test/parse-fail/issue-10392.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
struct A { foo: isize }
1214

1315
fn a() -> A { panic!() }

src/test/parse-fail/issue-10636-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
struct Obj { //~ NOTE: unclosed delimiter
1214
member: usize
1315
) //~ ERROR: incorrect close delimiter

src/test/parse-fail/issue-10636-2.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
pub fn trace_option(option: Option<isize>) {
1214
option.map(|some| 42; //~ NOTE: unclosed delimiter
1315
} //~ ERROR: incorrect close delimiter

src/test/parse-fail/issue-14303-enum.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
enum X<'a, T, 'b> {
1214
//~^ ERROR lifetime parameters must be declared prior to type parameters
1315
A(&'a T)

src/test/parse-fail/issue-14303-fn-def.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 foo<'a, T, 'b>(x: &'a T) {}
1214
//~^ ERROR lifetime parameters must be declared prior to type parameters

src/test/parse-fail/issue-14303-fncall.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
(0..4)
1315
.map(|x| x * 2)

src/test/parse-fail/issue-14303-impl.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
struct X { x: isize }
1214

1315
impl<'a, T, 'b> X {}

src/test/parse-fail/issue-14303-path.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 bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {}
1214
//~^ ERROR lifetime parameters must be declared prior to type parameters

src/test/parse-fail/issue-14303-struct.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
struct X<'a, T, 'b> {
1214
//~^ ERROR lifetime parameters must be declared prior to type parameters
1315
x: &'a T

src/test/parse-fail/issue-14303-trait.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
trait Foo<'a, T, 'b> {}
1214
//~^ ERROR lifetime parameters must be declared prior to type parameters

src/test/parse-fail/issue-15914.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 ref
1315
(); //~ ERROR expected identifier, found `(`

src/test/parse-fail/issue-1655.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 one of `!` or `[`, found `vec`
1214
mod blade_runner {
1315
#vec[doc(

src/test/parse-fail/issue-17904.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
struct Baz<U> where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax.
1214
struct Baz<U> where U: Eq(U) -> R; // Notice this parses as well.
1315
struct Baz<U>(U) where U: Eq; // This rightfully signals no error as well.

src/test/parse-fail/issue-1802-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
// error-pattern:no valid digits found for number
1214
fn main() {
1315
log(error, 0b42);

src/test/parse-fail/issue-19096.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 t = (42, 42);
1315
t.0::<isize>; //~ ERROR expected one of `.`, `;`, `}`, or an operator, found `::`

src/test/parse-fail/issue-19398.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
trait T {
1214
extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found `unsafe`
1315
}

0 commit comments

Comments
 (0)