Skip to content

Commit

Permalink
Remove -Z continue-parse-after-error
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 8, 2020
1 parent ed6468d commit 41a93cb
Show file tree
Hide file tree
Showing 36 changed files with 77 additions and 125 deletions.
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,6 @@ impl SharedEmitterMain {
d.code(code);
}
handler.emit_diagnostic(&d);
handler.abort_if_errors_and_should_abort();
}
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg)) => {
sess.span_err(ExpnId::from_u32(cookie).expn_data().call_site, &msg)
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,6 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
if !info.payload().is::<errors::ExplicitBug>() {
let d = errors::Diagnostic::new(errors::Level::Bug, "unexpected panic");
handler.emit_diagnostic(&d);
handler.abort_if_errors_and_should_abort();
}

let mut xs: Vec<Cow<'static, str>> = vec![
Expand Down
20 changes: 0 additions & 20 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ struct HandlerInner {
err_count: usize,
deduplicated_err_count: usize,
emitter: Box<dyn Emitter + sync::Send>,
continue_after_error: bool,
delayed_span_bugs: Vec<Diagnostic>,

/// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
Expand Down Expand Up @@ -402,7 +401,6 @@ impl Handler {
err_count: 0,
deduplicated_err_count: 0,
emitter,
continue_after_error: true,
delayed_span_bugs: Vec::new(),
taught_diagnostics: Default::default(),
emitted_diagnostic_codes: Default::default(),
Expand All @@ -412,10 +410,6 @@ impl Handler {
}
}

pub fn set_continue_after_error(&self, continue_after_error: bool) {
self.inner.borrow_mut().continue_after_error = continue_after_error;
}

// This is here to not allow mutation of flags;
// as of this writing it's only used in tests in librustc.
pub fn can_emit_warnings(&self) -> bool {
Expand Down Expand Up @@ -672,10 +666,6 @@ impl Handler {
self.inner.borrow_mut().abort_if_errors()
}

pub fn abort_if_errors_and_should_abort(&self) {
self.inner.borrow_mut().abort_if_errors_and_should_abort()
}

/// `true` if we haven't taught a diagnostic with this code already.
/// The caller must then teach the user about such a diagnostic.
///
Expand All @@ -696,7 +686,6 @@ impl Handler {
fn emit_diag_at_span(&self, mut diag: Diagnostic, sp: impl Into<MultiSpan>) {
let mut inner = self.inner.borrow_mut();
inner.emit_diagnostic(diag.set_span(sp));
inner.abort_if_errors_and_should_abort();
}

pub fn emit_artifact_notification(&self, path: &Path, artifact_type: &str) {
Expand Down Expand Up @@ -830,14 +819,6 @@ impl HandlerInner {
self.has_errors() || !self.delayed_span_bugs.is_empty()
}

fn abort_if_errors_and_should_abort(&mut self) {
self.emit_stashed_diagnostics();

if self.has_errors() && !self.continue_after_error {
FatalError.raise();
}
}

fn abort_if_errors(&mut self) {
self.emit_stashed_diagnostics();

Expand All @@ -853,7 +834,6 @@ impl HandlerInner {

fn emit_diag_at_span(&mut self, mut diag: Diagnostic, sp: impl Into<MultiSpan>) {
self.emit_diagnostic(diag.set_span(sp));
self.abort_if_errors_and_should_abort();
}

fn delay_span_bug(&mut self, sp: impl Into<MultiSpan>, msg: &str) {
Expand Down
3 changes: 0 additions & 3 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,13 @@ use std::rc::Rc;
use std::{env, fs, iter, mem};

pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> {
sess.diagnostic().set_continue_after_error(sess.opts.debugging_opts.continue_parse_after_error);
let krate = sess.time("parsing", || match input {
Input::File(file) => parse_crate_from_file(file, &sess.parse_sess),
Input::Str { input, name } => {
parse_crate_from_source_str(name.clone(), input.clone(), &sess.parse_sess)
}
})?;

sess.diagnostic().set_continue_after_error(true);

if sess.opts.debugging_opts.ast_json_noexpand {
println!("{}", json::as_json(&krate));
}
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_interface/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,6 @@ fn test_debugging_options_tracking_hash() {
opts.debugging_opts.report_delayed_bugs = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.continue_parse_after_error = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.force_overflow_checks = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_session/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"set the current terminal width"),
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
"support compiling tests with panic=abort"),
continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
"attempt to recover from parse errors (experimental)"),
dep_tasks: bool = (false, parse_bool, [UNTRACKED],
"print tasks that execute and the color their dep node gets (requires debug build)"),
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/consts/miri_unleashed/mutable_const2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:347:17
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:346:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/parse-error-correct.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -Z continue-parse-after-error

// Test that the parser is error correcting missing idents. Despite a parsing
// error (or two), we still run type checking (and don't get extra errors there).

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/parse-error-correct.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: unexpected token: `;`
--> $DIR/parse-error-correct.rs:8:15
--> $DIR/parse-error-correct.rs:6:15
|
LL | let x = y.;
| ^

error: unexpected token: `(`
--> $DIR/parse-error-correct.rs:9:15
--> $DIR/parse-error-correct.rs:7:15
|
LL | let x = y.();
| ^

error[E0618]: expected function, found `{integer}`
--> $DIR/parse-error-correct.rs:9:13
--> $DIR/parse-error-correct.rs:7:13
|
LL | let y = 42;
| - `{integer}` defined here
Expand All @@ -22,7 +22,7 @@ LL | let x = y.();
| call expression requires function

error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/parse-error-correct.rs:11:15
--> $DIR/parse-error-correct.rs:9:15
|
LL | let x = y.foo;
| ^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/parser-recovery-1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -Z continue-parse-after-error

// Test that we can recover from missing braces in the parser.

trait Foo {
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/parser-recovery-1.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: this file contains an unclosed delimiter
--> $DIR/parser-recovery-1.rs:15:54
--> $DIR/parser-recovery-1.rs:13:54
|
LL | trait Foo {
| - unclosed delimiter
Expand All @@ -13,19 +13,19 @@ LL | }
| ^

error: unexpected token: `;`
--> $DIR/parser-recovery-1.rs:12:15
--> $DIR/parser-recovery-1.rs:10:15
|
LL | let x = y.;
| ^

error[E0425]: cannot find function `foo` in this scope
--> $DIR/parser-recovery-1.rs:7:17
--> $DIR/parser-recovery-1.rs:5:17
|
LL | let x = foo();
| ^^^ not found in this scope

error[E0425]: cannot find value `y` in this scope
--> $DIR/parser-recovery-1.rs:12:13
--> $DIR/parser-recovery-1.rs:10:13
|
LL | let x = y.;
| ^ not found in this scope
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/parser-recovery-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -Z continue-parse-after-error

// Test that we can recover from mismatched braces in the parser.

trait Foo {
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/parser-recovery-2.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: unexpected token: `;`
--> $DIR/parser-recovery-2.rs:12:15
--> $DIR/parser-recovery-2.rs:10:15
|
LL | let x = y.;
| ^

error: mismatched closing delimiter: `)`
--> $DIR/parser-recovery-2.rs:8:5
--> $DIR/parser-recovery-2.rs:6:5
|
LL | fn bar() {
| - unclosed delimiter
Expand All @@ -14,13 +14,13 @@ LL | )
| ^ mismatched closing delimiter

error[E0425]: cannot find function `foo` in this scope
--> $DIR/parser-recovery-2.rs:7:17
--> $DIR/parser-recovery-2.rs:5:17
|
LL | let x = foo();
| ^^^ not found in this scope

error[E0425]: cannot find value `y` in this scope
--> $DIR/parser-recovery-2.rs:12:13
--> $DIR/parser-recovery-2.rs:10:13
|
LL | let x = y.;
| ^ not found in this scope
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/parser/ascii-only-character-escape.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -Z continue-parse-after-error

fn main() {
let x = "\x80"; //~ ERROR may only be used
let y = "\xff"; //~ ERROR may only be used
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/parser/ascii-only-character-escape.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:4:14
--> $DIR/ascii-only-character-escape.rs:2:14
|
LL | let x = "\x80";
| ^^^^

error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:5:14
--> $DIR/ascii-only-character-escape.rs:3:14
|
LL | let y = "\xff";
| ^^^^

error: this form of character escape may only be used with characters in the range [\x00-\x7f]
--> $DIR/ascii-only-character-escape.rs:6:14
--> $DIR/ascii-only-character-escape.rs:4:14
|
LL | let z = "\xe2";
| ^^^^
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/parser/bad-char-literals.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// compile-flags: -Z continue-parse-after-error

// ignore-tidy-cr
// ignore-tidy-tab

fn main() {
// these literals are just silly.
''';
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/parser/bad-char-literals.stderr
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
error: character constant must be escaped: '
--> $DIR/bad-char-literals.rs:7:6
--> $DIR/bad-char-literals.rs:6:6
|
LL | ''';
| ^

error: character constant must be escaped: \n
--> $DIR/bad-char-literals.rs:11:6
--> $DIR/bad-char-literals.rs:10:6
|
LL | '
| ______^
LL | | ';
| |_

error: character constant must be escaped: \r
--> $DIR/bad-char-literals.rs:16:6
--> $DIR/bad-char-literals.rs:15:6
|
LL | '';
| ^

error: character constant must be escaped: \t
--> $DIR/bad-char-literals.rs:19:6
--> $DIR/bad-char-literals.rs:18:6
|
LL | ' ';
| ^^^^
Expand Down
3 changes: 0 additions & 3 deletions src/test/ui/parser/byte-literals.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// compile-flags: -Z continue-parse-after-error


// ignore-tidy-tab

static FOO: u8 = b'\f'; //~ ERROR unknown byte escape
Expand Down
14 changes: 7 additions & 7 deletions src/test/ui/parser/byte-literals.stderr
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
error: unknown byte escape: f
--> $DIR/byte-literals.rs:6:21
--> $DIR/byte-literals.rs:3:21
|
LL | static FOO: u8 = b'\f';
| ^ unknown byte escape

error: unknown byte escape: f
--> $DIR/byte-literals.rs:9:8
--> $DIR/byte-literals.rs:6:8
|
LL | b'\f';
| ^ unknown byte escape

error: invalid character in numeric character escape: Z
--> $DIR/byte-literals.rs:10:10
--> $DIR/byte-literals.rs:7:10
|
LL | b'\x0Z';
| ^

error: byte constant must be escaped: \t
--> $DIR/byte-literals.rs:11:7
--> $DIR/byte-literals.rs:8:7
|
LL | b' ';
| ^^^^

error: byte constant must be escaped: '
--> $DIR/byte-literals.rs:12:7
--> $DIR/byte-literals.rs:9:7
|
LL | b''';
| ^

error: byte constant must be ASCII. Use a \xHH escape for a non-ASCII byte
--> $DIR/byte-literals.rs:13:7
--> $DIR/byte-literals.rs:10:7
|
LL | b'é';
| ^

error: unterminated byte constant
--> $DIR/byte-literals.rs:14:6
--> $DIR/byte-literals.rs:11:6
|
LL | b'a
| ^^^^
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/parser/byte-string-literals.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// compile-flags: -Z continue-parse-after-error

static FOO: &'static [u8] = b"\f"; //~ ERROR unknown byte escape

pub fn main() {
Expand Down
Loading

0 comments on commit 41a93cb

Please sign in to comment.