Skip to content

Commit 41a93cb

Browse files
committed
Remove -Z continue-parse-after-error
1 parent ed6468d commit 41a93cb

36 files changed

+77
-125
lines changed

src/librustc_codegen_ssa/back/write.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,6 @@ impl SharedEmitterMain {
16791679
d.code(code);
16801680
}
16811681
handler.emit_diagnostic(&d);
1682-
handler.abort_if_errors_and_should_abort();
16831682
}
16841683
Ok(SharedEmitterMessage::InlineAsmError(cookie, msg)) => {
16851684
sess.span_err(ExpnId::from_u32(cookie).expn_data().call_site, &msg)

src/librustc_driver/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,6 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
11781178
if !info.payload().is::<errors::ExplicitBug>() {
11791179
let d = errors::Diagnostic::new(errors::Level::Bug, "unexpected panic");
11801180
handler.emit_diagnostic(&d);
1181-
handler.abort_if_errors_and_should_abort();
11821181
}
11831182

11841183
let mut xs: Vec<Cow<'static, str>> = vec![

src/librustc_errors/lib.rs

-20
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ struct HandlerInner {
278278
err_count: usize,
279279
deduplicated_err_count: usize,
280280
emitter: Box<dyn Emitter + sync::Send>,
281-
continue_after_error: bool,
282281
delayed_span_bugs: Vec<Diagnostic>,
283282

284283
/// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
@@ -402,7 +401,6 @@ impl Handler {
402401
err_count: 0,
403402
deduplicated_err_count: 0,
404403
emitter,
405-
continue_after_error: true,
406404
delayed_span_bugs: Vec::new(),
407405
taught_diagnostics: Default::default(),
408406
emitted_diagnostic_codes: Default::default(),
@@ -412,10 +410,6 @@ impl Handler {
412410
}
413411
}
414412

415-
pub fn set_continue_after_error(&self, continue_after_error: bool) {
416-
self.inner.borrow_mut().continue_after_error = continue_after_error;
417-
}
418-
419413
// This is here to not allow mutation of flags;
420414
// as of this writing it's only used in tests in librustc.
421415
pub fn can_emit_warnings(&self) -> bool {
@@ -672,10 +666,6 @@ impl Handler {
672666
self.inner.borrow_mut().abort_if_errors()
673667
}
674668

675-
pub fn abort_if_errors_and_should_abort(&self) {
676-
self.inner.borrow_mut().abort_if_errors_and_should_abort()
677-
}
678-
679669
/// `true` if we haven't taught a diagnostic with this code already.
680670
/// The caller must then teach the user about such a diagnostic.
681671
///
@@ -696,7 +686,6 @@ impl Handler {
696686
fn emit_diag_at_span(&self, mut diag: Diagnostic, sp: impl Into<MultiSpan>) {
697687
let mut inner = self.inner.borrow_mut();
698688
inner.emit_diagnostic(diag.set_span(sp));
699-
inner.abort_if_errors_and_should_abort();
700689
}
701690

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

833-
fn abort_if_errors_and_should_abort(&mut self) {
834-
self.emit_stashed_diagnostics();
835-
836-
if self.has_errors() && !self.continue_after_error {
837-
FatalError.raise();
838-
}
839-
}
840-
841822
fn abort_if_errors(&mut self) {
842823
self.emit_stashed_diagnostics();
843824

@@ -853,7 +834,6 @@ impl HandlerInner {
853834

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

859839
fn delay_span_bug(&mut self, sp: impl Into<MultiSpan>, msg: &str) {

src/librustc_interface/passes.rs

-3
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,13 @@ use std::rc::Rc;
5454
use std::{env, fs, iter, mem};
5555

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

65-
sess.diagnostic().set_continue_after_error(true);
66-
6764
if sess.opts.debugging_opts.ast_json_noexpand {
6865
println!("{}", json::as_json(&krate));
6966
}

src/librustc_interface/tests.rs

-4
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,6 @@ fn test_debugging_options_tracking_hash() {
601601
opts.debugging_opts.report_delayed_bugs = true;
602602
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
603603

604-
opts = reference.clone();
605-
opts.debugging_opts.continue_parse_after_error = true;
606-
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
607-
608604
opts = reference.clone();
609605
opts.debugging_opts.force_overflow_checks = Some(true);
610606
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

src/librustc_session/options.rs

-2
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
772772
"set the current terminal width"),
773773
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
774774
"support compiling tests with panic=abort"),
775-
continue_parse_after_error: bool = (false, parse_bool, [TRACKED],
776-
"attempt to recover from parse errors (experimental)"),
777775
dep_tasks: bool = (false, parse_bool, [UNTRACKED],
778776
"print tasks that execute and the color their dep node gets (requires debug build)"),
779777
incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],

src/test/ui/consts/miri_unleashed/mutable_const2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error: internal compiler error: mutable allocation in constant
1010
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

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

1616
error: internal compiler error: unexpected panic

src/test/ui/parse-error-correct.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
// Test that the parser is error correcting missing idents. Despite a parsing
42
// error (or two), we still run type checking (and don't get extra errors there).
53

src/test/ui/parse-error-correct.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: unexpected token: `;`
2-
--> $DIR/parse-error-correct.rs:8:15
2+
--> $DIR/parse-error-correct.rs:6:15
33
|
44
LL | let x = y.;
55
| ^
66

77
error: unexpected token: `(`
8-
--> $DIR/parse-error-correct.rs:9:15
8+
--> $DIR/parse-error-correct.rs:7:15
99
|
1010
LL | let x = y.();
1111
| ^
1212

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

2424
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
25-
--> $DIR/parse-error-correct.rs:11:15
25+
--> $DIR/parse-error-correct.rs:9:15
2626
|
2727
LL | let x = y.foo;
2828
| ^^^

src/test/ui/parser-recovery-1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
// Test that we can recover from missing braces in the parser.
42

53
trait Foo {

src/test/ui/parser-recovery-1.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this file contains an unclosed delimiter
2-
--> $DIR/parser-recovery-1.rs:15:54
2+
--> $DIR/parser-recovery-1.rs:13:54
33
|
44
LL | trait Foo {
55
| - unclosed delimiter
@@ -13,19 +13,19 @@ LL | }
1313
| ^
1414

1515
error: unexpected token: `;`
16-
--> $DIR/parser-recovery-1.rs:12:15
16+
--> $DIR/parser-recovery-1.rs:10:15
1717
|
1818
LL | let x = y.;
1919
| ^
2020

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

2727
error[E0425]: cannot find value `y` in this scope
28-
--> $DIR/parser-recovery-1.rs:12:13
28+
--> $DIR/parser-recovery-1.rs:10:13
2929
|
3030
LL | let x = y.;
3131
| ^ not found in this scope

src/test/ui/parser-recovery-2.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
// Test that we can recover from mismatched braces in the parser.
42

53
trait Foo {

src/test/ui/parser-recovery-2.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: unexpected token: `;`
2-
--> $DIR/parser-recovery-2.rs:12:15
2+
--> $DIR/parser-recovery-2.rs:10:15
33
|
44
LL | let x = y.;
55
| ^
66

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

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

2222
error[E0425]: cannot find value `y` in this scope
23-
--> $DIR/parser-recovery-2.rs:12:13
23+
--> $DIR/parser-recovery-2.rs:10:13
2424
|
2525
LL | let x = y.;
2626
| ^ not found in this scope

src/test/ui/parser/ascii-only-character-escape.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
fn main() {
42
let x = "\x80"; //~ ERROR may only be used
53
let y = "\xff"; //~ ERROR may only be used

src/test/ui/parser/ascii-only-character-escape.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
2-
--> $DIR/ascii-only-character-escape.rs:4:14
2+
--> $DIR/ascii-only-character-escape.rs:2:14
33
|
44
LL | let x = "\x80";
55
| ^^^^
66

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

1313
error: this form of character escape may only be used with characters in the range [\x00-\x7f]
14-
--> $DIR/ascii-only-character-escape.rs:6:14
14+
--> $DIR/ascii-only-character-escape.rs:4:14
1515
|
1616
LL | let z = "\xe2";
1717
| ^^^^

src/test/ui/parser/bad-char-literals.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
// ignore-tidy-cr
42
// ignore-tidy-tab
3+
54
fn main() {
65
// these literals are just silly.
76
''';

src/test/ui/parser/bad-char-literals.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: character constant must be escaped: '
2-
--> $DIR/bad-char-literals.rs:7:6
2+
--> $DIR/bad-char-literals.rs:6:6
33
|
44
LL | ''';
55
| ^
66

77
error: character constant must be escaped: \n
8-
--> $DIR/bad-char-literals.rs:11:6
8+
--> $DIR/bad-char-literals.rs:10:6
99
|
1010
LL | '
1111
| ______^
1212
LL | | ';
1313
| |_
1414

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

2121
error: character constant must be escaped: \t
22-
--> $DIR/bad-char-literals.rs:19:6
22+
--> $DIR/bad-char-literals.rs:18:6
2323
|
2424
LL | ' ';
2525
| ^^^^

src/test/ui/parser/byte-literals.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
3-
41
// ignore-tidy-tab
52

63
static FOO: u8 = b'\f'; //~ ERROR unknown byte escape

src/test/ui/parser/byte-literals.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
error: unknown byte escape: f
2-
--> $DIR/byte-literals.rs:6:21
2+
--> $DIR/byte-literals.rs:3:21
33
|
44
LL | static FOO: u8 = b'\f';
55
| ^ unknown byte escape
66

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

1313
error: invalid character in numeric character escape: Z
14-
--> $DIR/byte-literals.rs:10:10
14+
--> $DIR/byte-literals.rs:7:10
1515
|
1616
LL | b'\x0Z';
1717
| ^
1818

1919
error: byte constant must be escaped: \t
20-
--> $DIR/byte-literals.rs:11:7
20+
--> $DIR/byte-literals.rs:8:7
2121
|
2222
LL | b' ';
2323
| ^^^^
2424

2525
error: byte constant must be escaped: '
26-
--> $DIR/byte-literals.rs:12:7
26+
--> $DIR/byte-literals.rs:9:7
2727
|
2828
LL | b''';
2929
| ^
3030

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

3737
error: unterminated byte constant
38-
--> $DIR/byte-literals.rs:14:6
38+
--> $DIR/byte-literals.rs:11:6
3939
|
4040
LL | b'a
4141
| ^^^^

src/test/ui/parser/byte-string-literals.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z continue-parse-after-error
2-
31
static FOO: &'static [u8] = b"\f"; //~ ERROR unknown byte escape
42

53
pub fn main() {

0 commit comments

Comments
 (0)