]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/diagnostic.rs
rollup merge of #21457: alexcrichton/issue-21436
[rust.git] / src / libsyntax / diagnostic.rs
index 6de466ea9bd3ad2a2d082be8b5a706a99b104b6f..0c7f6befc4e3e1b884c5a95df1828e5f050c559b 100644 (file)
@@ -92,6 +92,10 @@ pub fn span_fatal(&self, sp: Span, msg: &str) -> ! {
         self.handler.emit(Some((&self.cm, sp)), msg, Fatal);
         panic!(FatalError);
     }
+    pub fn span_fatal_with_code(&self, sp: Span, msg: &str, code: &str) -> ! {
+        self.handler.emit_with_code(Some((&self.cm, sp)), msg, code, Fatal);
+        panic!(FatalError);
+    }
     pub fn span_err(&self, sp: Span, msg: &str) {
         self.handler.emit(Some((&self.cm, sp)), msg, Error);
         self.handler.bump_err_count();
@@ -235,9 +239,9 @@ pub enum Level {
     Help,
 }
 
-impl fmt::String for Level {
+impl fmt::Display for Level {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        use std::fmt::String;
+        use std::fmt::Display;
 
         match *self {
             Bug => "error: internal compiler error".fmt(f),
@@ -280,7 +284,7 @@ fn print_maybe_styled(w: &mut EmitterWriter,
             // to be miscolored. We assume this is rare enough that we don't
             // have to worry about it.
             if msg.ends_with("\n") {
-                try!(t.write_str(&msg[..(msg.len()-1)]));
+                try!(t.write_str(&msg[..msg.len()-1]));
                 try!(t.reset());
                 try!(t.write_str("\n"));
             } else {