diff options
| author | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-06-06 14:28:59 -0700 |
|---|---|---|
| committer | Lindsey Kuper <lindsey@rockstargirl.org> | 2012-06-06 14:51:13 -0700 |
| commit | cba77ffbfa469727314f65405117277839a1783b (patch) | |
| tree | 11139ec29c4744b8cf1fc6b59555a299aa9517e6 | |
| parent | 9e3e57c58bebe1f8d6872c62be8f8b697846109b (diff) | |
| download | rust-cba77ffbfa469727314f65405117277839a1783b.tar.gz rust-cba77ffbfa469727314f65405117277839a1783b.zip | |
syntax: More grammatical error message
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 11 |
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); |
