Align multiline messages to their label (add left margin)
This commit is contained in:
parent
563db4245b
commit
8f433adf75
12 changed files with 1310 additions and 1297 deletions
|
@ -1266,22 +1266,37 @@ impl EmitterWriter {
|
||||||
}
|
}
|
||||||
self.msg_to_buffer(&mut buffer, msg, max_line_num_len, "note", None);
|
self.msg_to_buffer(&mut buffer, msg, max_line_num_len, "note", None);
|
||||||
} else {
|
} else {
|
||||||
|
let mut label_width = 0;
|
||||||
// The failure note level itself does not provide any useful diagnostic information
|
// The failure note level itself does not provide any useful diagnostic information
|
||||||
if *level != Level::FailureNote {
|
if *level != Level::FailureNote {
|
||||||
buffer.append(0, level.to_str(), Style::Level(*level));
|
buffer.append(0, level.to_str(), Style::Level(*level));
|
||||||
|
label_width += level.to_str().len();
|
||||||
}
|
}
|
||||||
// only render error codes, not lint codes
|
// only render error codes, not lint codes
|
||||||
if let Some(DiagnosticId::Error(ref code)) = *code {
|
if let Some(DiagnosticId::Error(ref code)) = *code {
|
||||||
buffer.append(0, "[", Style::Level(*level));
|
buffer.append(0, "[", Style::Level(*level));
|
||||||
buffer.append(0, &code, Style::Level(*level));
|
buffer.append(0, &code, Style::Level(*level));
|
||||||
buffer.append(0, "]", Style::Level(*level));
|
buffer.append(0, "]", Style::Level(*level));
|
||||||
|
label_width += 2 + code.len();
|
||||||
}
|
}
|
||||||
let header_style = if is_secondary { Style::HeaderMsg } else { Style::MainHeaderMsg };
|
let header_style = if is_secondary { Style::HeaderMsg } else { Style::MainHeaderMsg };
|
||||||
if *level != Level::FailureNote {
|
if *level != Level::FailureNote {
|
||||||
buffer.append(0, ": ", header_style);
|
buffer.append(0, ": ", header_style);
|
||||||
|
label_width += 2;
|
||||||
}
|
}
|
||||||
for &(ref text, _) in msg.iter() {
|
for &(ref text, _) in msg.iter() {
|
||||||
buffer.append(0, &replace_tabs(text), header_style);
|
// Account for newlines to align output to its label.
|
||||||
|
for (line, text) in replace_tabs(text).lines().enumerate() {
|
||||||
|
buffer.append(
|
||||||
|
0 + line,
|
||||||
|
&format!(
|
||||||
|
"{}{}",
|
||||||
|
if line == 0 { String::new() } else { " ".repeat(label_width) },
|
||||||
|
text
|
||||||
|
),
|
||||||
|
header_style,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
error: <unknown>:0:0: in function test i32 (i32, i32, i32, i32, i32): call to non-secure function would require passing arguments on stack
|
error: <unknown>:0:0: in function test i32 (i32, i32, i32, i32, i32): call to non-secure function would require passing arguments on stack
|
||||||
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
error: <unknown>:0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack
|
error: <unknown>:0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack
|
||||||
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue