about summary refs log tree commit diff
path: root/src/libsyntax/errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-01-26 00:42:08 +0000
committerbors <bors@rust-lang.org>2016-01-26 00:42:08 +0000
commitfaf6d1e87391b25196b35909c3c95e5d873cacf0 (patch)
tree2bc19619fba5216c21015aee7cee4bec5b263b06 /src/libsyntax/errors
parenteceb96b40dedd903ddfca6df97bb1e5749b87787 (diff)
parent43b3681588ef40c78c794548d67a8f50101bc8ad (diff)
downloadrust-faf6d1e87391b25196b35909c3c95e5d873cacf0.tar.gz
rust-faf6d1e87391b25196b35909c3c95e5d873cacf0.zip
Auto merge of #31065 - nrc:ident-correct, r=pnkfelix
This PR adds some minor error correction to the parser - if there is a missing ident, we recover and carry on. It also makes compilation more robust so that non-fatal errors (which is still most of them, unfortunately) in parsing do not cause us to abort compilation. The effect is that a program with a missing or incorrect ident can get all the way to type checking.
Diffstat (limited to 'src/libsyntax/errors')
-rw-r--r--src/libsyntax/errors/mod.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax/errors/mod.rs b/src/libsyntax/errors/mod.rs
index 6983c74696a..a7a4ddc3b2a 100644
--- a/src/libsyntax/errors/mod.rs
+++ b/src/libsyntax/errors/mod.rs
@@ -555,6 +555,9 @@ impl Handler {
 pub enum Level {
     Bug,
     Fatal,
+    // An error which while not immediately fatal, should stop the compiler
+    // progressing beyond the current phase.
+    PhaseFatal,
     Error,
     Warning,
     Note,
@@ -573,7 +576,7 @@ impl fmt::Display for Level {
 impl Level {
     fn color(self) -> term::color::Color {
         match self {
-            Bug | Fatal | Error => term::color::BRIGHT_RED,
+            Bug | Fatal | PhaseFatal | Error => term::color::BRIGHT_RED,
             Warning => term::color::BRIGHT_YELLOW,
             Note => term::color::BRIGHT_GREEN,
             Help => term::color::BRIGHT_CYAN,
@@ -584,7 +587,7 @@ impl Level {
     fn to_str(self) -> &'static str {
         match self {
             Bug => "error: internal compiler error",
-            Fatal | Error => "error",
+            Fatal | PhaseFatal | Error => "error",
             Warning => "warning",
             Note => "note",
             Help => "help",