diff options
| author | bors <bors@rust-lang.org> | 2013-06-26 23:07:41 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-26 23:07:41 -0700 |
| commit | f1e09d6f1faa6e4d7d4d19123d1633fce370e145 (patch) | |
| tree | 660935f34a057fbf3178197e5cec40e8de89d309 /src/libsyntax | |
| parent | eda5e40b79f7aaa51765f59c21a76fe033c937b1 (diff) | |
| parent | ab428b648001030a0ea71c61dd89a531109c0cdd (diff) | |
| download | rust-f1e09d6f1faa6e4d7d4d19123d1633fce370e145.tar.gz rust-f1e09d6f1faa6e4d7d4d19123d1633fce370e145.zip | |
auto merge of #7420 : mozilla/rust/rollup, r=thestinger
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 13fa01c96e1..89867922b25 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -178,16 +178,16 @@ fn diagnosticstr(lvl: level) -> ~str { } } -fn diagnosticcolor(lvl: level) -> u8 { +fn diagnosticcolor(lvl: level) -> term::color::Color { match lvl { - fatal => term::color_bright_red, - error => term::color_bright_red, - warning => term::color_bright_yellow, - note => term::color_bright_green + fatal => term::color::bright_red, + error => term::color::bright_red, + warning => term::color::bright_yellow, + note => term::color::bright_green } } -fn print_maybe_colored(msg: &str, color: u8) { +fn print_maybe_colored(msg: &str, color: term::color::Color) { let stderr = io::stderr(); let t = term::Terminal::new(stderr); @@ -231,7 +231,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) { let ss = cm.span_to_str(sp); let lines = cm.span_to_lines(sp); print_diagnostic(ss, lvl, msg); - highlight_lines(cm, sp, lines); + highlight_lines(cm, sp, lvl, lines); print_macro_backtrace(cm, sp); } None => { @@ -241,7 +241,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) { } fn highlight_lines(cm: @codemap::CodeMap, - sp: span, + sp: span, lvl: level, lines: @codemap::FileLines) { let fm = lines.file; @@ -293,18 +293,18 @@ fn highlight_lines(cm: @codemap::CodeMap, let curChar = (orig[pos] as char); s += match curChar { // Whenever a tab occurs on the previous '\t' => "\t", // line, we insert one on the error-point- - _ => " " // -squigly-line as well (instead of a - }; // space). This way the squigly-line will + _ => " " // -squiggly-line as well (instead of a + }; // space). This way the squiggly-line will } // usually appear in the correct position. io::stderr().write_str(s); let mut s = ~"^"; let hi = cm.lookup_char_pos(sp.hi); if hi.col != lo.col { // the ^ already takes up one space - let num_squiglies = hi.col.to_uint()-lo.col.to_uint()-1u; - for num_squiglies.times() { s += "~"; } + let num_squigglies = hi.col.to_uint()-lo.col.to_uint()-1u; + for num_squigglies.times() { s += "~"; } } - print_maybe_colored(s + "\n", term::color_bright_green); + print_maybe_colored(s + "\n", diagnosticcolor(lvl)); } } |
