1
Fork 0

Fix a couple UI test failures

This commit is contained in:
Jonathan Turner 2016-07-12 12:37:57 -04:00
parent 8612838dd0
commit f481879d2a
3 changed files with 34 additions and 26 deletions

View file

@ -187,23 +187,24 @@ impl EmitterWriter {
if let Some(ref cm) = self.cm { if let Some(ref cm) = self.cm {
for span_label in msp.span_labels() { for span_label in msp.span_labels() {
let lo = cm.lookup_char_pos(span_label.span.lo); let mut lo = cm.lookup_char_pos(span_label.span.lo);
let hi = cm.lookup_char_pos(span_label.span.hi); let mut hi = cm.lookup_char_pos(span_label.span.hi);
let mut is_minimized = false;
// If the span is multi-line, simplify down to the span of one character // If the span is multi-line, simplify down to the span of one character
let (start_col, mut end_col, is_minimized) = if lo.line != hi.line { if lo.line != hi.line {
(lo.col, CharPos(lo.col.0 + 1), true) hi.line = lo.line;
} else { hi.col = CharPos(lo.col.0 + 1);
(lo.col, hi.col, false) is_minimized = true;
}; }
// Watch out for "empty spans". If we get a span like 6..6, we // Watch out for "empty spans". If we get a span like 6..6, we
// want to just display a `^` at 6, so convert that to // want to just display a `^` at 6, so convert that to
// 6..7. This is degenerate input, but it's best to degrade // 6..7. This is degenerate input, but it's best to degrade
// gracefully -- and the parser likes to supply a span like // gracefully -- and the parser likes to supply a span like
// that for EOF, in particular. // that for EOF, in particular.
if start_col == end_col { if lo.col == hi.col {
end_col.0 += 1; hi.col = CharPos(lo.col.0 + 1);
} }
add_annotation_to_file(&mut output, add_annotation_to_file(&mut output,
@ -530,7 +531,7 @@ impl EmitterWriter {
buffer.prepend(buffer_msg_line_offset, "--> ", Style::LineNumber); buffer.prepend(buffer_msg_line_offset, "--> ", Style::LineNumber);
let loc = primary_lo.clone(); let loc = primary_lo.clone();
buffer.append(buffer_msg_line_offset, buffer.append(buffer_msg_line_offset,
&format!("{}:{}:{}", loc.file.name, loc.line, loc.col.0), &format!("{}:{}:{}", loc.file.name, loc.line, loc.col.0 + 1),
Style::LineAndColumn); Style::LineAndColumn);
for i in 0..max_line_num_len { for i in 0..max_line_num_len {
buffer.prepend(buffer_msg_line_offset, " ", Style::NoStyle); buffer.prepend(buffer_msg_line_offset, " ", Style::NoStyle);
@ -593,6 +594,10 @@ impl EmitterWriter {
} }
} }
if let Some(ref primary_span) = msp.primary_span().as_ref() {
self.render_macro_backtrace_old_school(primary_span, &mut buffer)?;
}
// final step: take our styled buffer, render it, then output it // final step: take our styled buffer, render it, then output it
emit_to_destination(&buffer.render(), level, &mut self.dst); emit_to_destination(&buffer.render(), level, &mut self.dst);
@ -1180,7 +1185,7 @@ impl EmitterWriter {
} }
let snippet = cm.span_to_string(trace.call_site); let snippet = cm.span_to_string(trace.call_site);
buffer.append(line_offset, &format!("{} ", snippet), Style::NoStyle); buffer.append(line_offset, &format!("{} ", snippet), Style::NoStyle);
buffer.append(line_offset, "Note", Style::Level(Level::Note)); buffer.append(line_offset, "note", Style::Level(Level::Note));
buffer.append(line_offset, ": ", Style::NoStyle); buffer.append(line_offset, ": ", Style::NoStyle);
buffer.append(line_offset, &diag_string, Style::OldSchoolNoteText); buffer.append(line_offset, &diag_string, Style::OldSchoolNoteText);
} }

View file

@ -1,15 +1,16 @@
error: mismatched types [--explain E0308] error[E0308]: mismatched types
--> $DIR/issue-26480.rs:27:19 --> $DIR/issue-26480.rs:27:19
|> |
27 |> $arr.len() * size_of($arr[0])); 27 | $arr.len() * size_of($arr[0]));
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize
$DIR/issue-26480.rs:38:5: 38:19: note: in this expansion of write! (defined in $DIR/issue-26480.rs) $DIR/issue-26480.rs:38:5: 38:19 note: in this expansion of write! (defined in $DIR/issue-26480.rs)
error: non-scalar cast: `_` as `()` error: non-scalar cast: `_` as `()`
--> $DIR/issue-26480.rs:33:19 --> $DIR/issue-26480.rs:33:19
|> |
33 |> ($x:expr) => ($x as ()) 33 | ($x:expr) => ($x as ())
|> ^^^^^^^^ | ^^^^^^^^
$DIR/issue-26480.rs:39:5: 39:14: note: in this expansion of cast! (defined in $DIR/issue-26480.rs) $DIR/issue-26480.rs:39:5: 39:14 note: in this expansion of cast! (defined in $DIR/issue-26480.rs)
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -1,9 +1,11 @@
error: mismatched types [--explain E0308] error[E0308]: mismatched types
--> $DIR/main.rs:14:18 --> $DIR/main.rs:14:18
|> |
14 |> let x: u32 = ( 14 | let x: u32 = (
|> ^ expected u32, found () | ^ expected u32, found ()
note: expected type `u32` |
note: found type `()` = note: expected type `u32`
= note: found type `()`
error: aborting due to previous error error: aborting due to previous error