Skip to content

Return nonzero exit code if there are errors at a stop point #22117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ pub fn compile_input(sess: Session,
output: &Option<PathBuf>,
addl_plugins: Option<Vec<String>>,
control: CompileController) {
macro_rules! controller_entry_point{($point: ident, $make_state: expr) => ({
{
let state = $make_state;
(control.$point.callback)(state);
}
macro_rules! controller_entry_point{($point: ident, $tsess: expr, $make_state: expr) => ({
let state = $make_state;
(control.$point.callback)(state);

$tsess.abort_if_errors();
if control.$point.stop == Compilation::Stop {
return;
}
Expand All @@ -70,6 +70,7 @@ pub fn compile_input(sess: Session,
let krate = phase_1_parse_input(&sess, cfg, input);

controller_entry_point!(after_parse,
sess,
CompileState::state_after_parse(input,
&sess,
outdir,
Expand All @@ -96,6 +97,7 @@ pub fn compile_input(sess: Session,
};

controller_entry_point!(after_expand,
sess,
CompileState::state_after_expand(input,
&sess,
outdir,
Expand All @@ -109,6 +111,7 @@ pub fn compile_input(sess: Session,
write_out_deps(&sess, input, &outputs, &id[..]);

controller_entry_point!(after_write_deps,
sess,
CompileState::state_after_write_deps(input,
&sess,
outdir,
Expand All @@ -123,6 +126,7 @@ pub fn compile_input(sess: Session,
control.make_glob_map);

controller_entry_point!(after_analysis,
analysis.ty_cx.sess,
CompileState::state_after_analysis(input,
&analysis.ty_cx.sess,
outdir,
Expand All @@ -149,6 +153,7 @@ pub fn compile_input(sess: Session,
phase_5_run_llvm_passes(&sess, &trans, &outputs);

controller_entry_point!(after_llvm,
sess,
CompileState::state_after_llvm(input,
&sess,
outdir,
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/mod_file_disambig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/mod_file_not_owning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern: cannot declare a new module at this location

mod mod_file_not_owning_aux1;
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/array-old-syntax-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// Test that the old fixed length array syntax is a parsing error.

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/ascii-only-character-escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
let x = "\x80"; //~ ERROR may only be used
let y = "\xff"; //~ ERROR may only be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// Test you can't use a higher-ranked trait bound inside of a qualified
// path (just won't parse).

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-bad-meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:expected `]`

// asterisk is bogus
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-before-eof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be globally added to parse-fail rather than in each test file?


#[derive(Debug)] //~ERROR expected item after attributes
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-before-ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
#[attr] //~ ERROR expected item after attributes
println!("hi");
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-before-let.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
#[attr] //~ ERROR expected item
let __isize = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-before-stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:expected item

fn f() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-dangling-in-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:expected item

fn f() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr-dangling-in-mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:expected item

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

#![feature(lang_items)]

fn main() {}
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/attrs-after-extern-mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// Constants (static variables) can be used to match in patterns, but mutable
// statics cannot. This ensures that there's some form of error if this is
// attempted.
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-char-literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// ignore-tidy-cr
// ignore-tidy-tab
fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-lit-suffixes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only


extern
"C"suffix //~ ERROR ABI spec with a suffix is illegal
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern: expected

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern: expected

fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-value-ident-false.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn false() { } //~ ERROR expected identifier, found keyword `false`
fn main() { }
2 changes: 2 additions & 0 deletions src/test/parse-fail/bad-value-ident-true.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn true() { } //~ ERROR expected identifier, found keyword `true`
fn main() { }
2 changes: 2 additions & 0 deletions src/test/parse-fail/better-expected.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, `<`, or `]`, found `3`
}
2 changes: 2 additions & 0 deletions src/test/parse-fail/bind-struct-early-modifiers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
struct Foo { x: isize }
match (Foo { x: 10 }) {
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/byte-literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only


// ignore-tidy-tab

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/byte-string-literals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only


// ignore-tidy-tab

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/circular_modules_hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// ignore-test: this is an auxiliary file for circular-modules-main.rs

mod circular_modules_main;
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/circular_modules_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

#[path = "circular_modules_hello.rs"]
mod circular_modules_hello; //~ ERROR: circular modules

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/class-implements-bad-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:nonexistent
class cat : nonexistent {
let meows: usize;
Expand Down
4 changes: 3 additions & 1 deletion src/test/parse-fail/column-offset-1-based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

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

# //~ ERROR 13:1: 13:2 error: expected `[`, found `<eof>`
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

/// hi
#[derive(Debug)] //~ERROR expected item after attributes
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-eof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

/// hi //~ERROR expected item after doc comment
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-extern-rbrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

extern {
/// hi
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
/// hi
println!("hi");
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-rbrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
println!("Hi"); /// hi
//~^ ERROR expected item after doc comment
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/doc-before-semi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main() {
/// hi
;
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/duplicate-visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// error-pattern:unmatched visibility `pub`
extern {
pub pub fn foo();
Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/empty-impl-semicolon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

impl Foo; //~ ERROR expected one of `(`, `+`, `..`, `::`, `<`, `for`, `where`, or `{`, found `;`
2 changes: 2 additions & 0 deletions src/test/parse-fail/extern-expected-fn-or-brace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// Verifies that the expected token errors for `extern crate` are
// raised

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/extern-foreign-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

// Verifies that the expected token errors for `extern crate` are
// raised

Expand Down
2 changes: 2 additions & 0 deletions src/test/parse-fail/extern-no-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

extern {
f(); //~ ERROR expected one of `fn`, `pub`, `static`, `unsafe`, or `}`, found `f`
}
Expand Down
Loading