Skip to content

Commit 4397076

Browse files
committed
Return nonzero exit code if there are errors at a stop point
1 parent ecdf792 commit 4397076

File tree

217 files changed

+445
-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.

217 files changed

+445
-6
lines changed

src/librustc_driver/driver.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ 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();
60+
6061
if control.$point.stop == Compilation::Stop {
6162
return;
6263
}
@@ -70,6 +71,7 @@ pub fn compile_input(sess: Session,
7071
let krate = phase_1_parse_input(&sess, cfg, input);
7172

7273
controller_entry_point!(after_parse,
74+
sess,
7375
CompileState::state_after_parse(input,
7476
&sess,
7577
outdir,
@@ -96,6 +98,7 @@ pub fn compile_input(sess: Session,
9698
};
9799

98100
controller_entry_point!(after_expand,
101+
sess,
99102
CompileState::state_after_expand(input,
100103
&sess,
101104
outdir,
@@ -109,6 +112,7 @@ pub fn compile_input(sess: Session,
109112
write_out_deps(&sess, input, &outputs, &id[..]);
110113

111114
controller_entry_point!(after_write_deps,
115+
sess,
112116
CompileState::state_after_write_deps(input,
113117
&sess,
114118
outdir,
@@ -123,6 +127,7 @@ pub fn compile_input(sess: Session,
123127
control.make_glob_map);
124128

125129
controller_entry_point!(after_analysis,
130+
analysis.ty_cx.sess,
126131
CompileState::state_after_analysis(input,
127132
&analysis.ty_cx.sess,
128133
outdir,
@@ -149,6 +154,7 @@ pub fn compile_input(sess: Session,
149154
phase_5_run_llvm_passes(&sess, &trans, &outputs);
150155

151156
controller_entry_point!(after_llvm,
157+
sess,
152158
CompileState::state_after_llvm(input,
153159
&sess,
154160
outdir,

src/test/compile-fail/mod_file_disambig.rs

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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;

0 commit comments

Comments
 (0)