about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 6d54615e827..f58333c5599 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -86,11 +86,14 @@ impl codemap_handler of handler for handler_t {
     }
     fn has_errors() -> bool { self.err_count > 0u }
     fn abort_if_errors() {
-        if self.err_count > 0u {
-            let s = #fmt["aborting due to %u previous errors",
-                         self.err_count];
-            self.fatal(s);
+        let s;
+        alt self.err_count {
+          0u { ret; }
+          1u { s = "aborting due to previous error"; }
+          _  { s = #fmt["aborting due to %u previous errors",
+                        self.err_count]; }
         }
+        self.fatal(s);
     }
     fn warn(msg: str) {
         self.emit(none, msg, warning);