Properly indent messages
This commit is contained in:
parent
99348a5330
commit
f89d6236aa
@ -1408,7 +1408,7 @@ impl EmitterWriter {
|
||||
if !sm.ensure_source_file_source_present(annotated_file.file.clone()) {
|
||||
if !self.short_message {
|
||||
// We'll just print an unannotated message.
|
||||
for line in annotated_file.lines {
|
||||
for (annotation_id, line) in annotated_file.lines.into_iter().enumerate() {
|
||||
let mut annotations = line.annotations.clone();
|
||||
annotations.sort_by_key(|a| Reverse(a.start_col));
|
||||
let mut line_idx = buffer.num_lines();
|
||||
@ -1422,12 +1422,12 @@ impl EmitterWriter {
|
||||
),
|
||||
Style::LineAndColumn,
|
||||
);
|
||||
let prefix = if annotations.len() > 1 {
|
||||
if annotation_id == 0 {
|
||||
buffer.prepend(line_idx, "--> ", Style::LineNumber);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
line_idx += 1;
|
||||
"note: "
|
||||
} else {
|
||||
": "
|
||||
};
|
||||
for (i, annotation) in annotations.into_iter().enumerate() {
|
||||
if let Some(label) = &annotation.label {
|
||||
@ -1436,7 +1436,19 @@ impl EmitterWriter {
|
||||
} else {
|
||||
Style::LabelSecondary
|
||||
};
|
||||
buffer.append(line_idx + i, prefix, style);
|
||||
if annotation_id == 0 {
|
||||
buffer.prepend(line_idx, " |", Style::LineNumber);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
line_idx += 1;
|
||||
buffer.append(line_idx + i, " = note: ", style);
|
||||
for _ in 0..max_line_num_len {
|
||||
buffer.prepend(line_idx, " ", Style::NoStyle);
|
||||
}
|
||||
} else {
|
||||
buffer.append(line_idx + i, ": ", style);
|
||||
}
|
||||
buffer.append(line_idx + i, label, style);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,18 @@
|
||||
error[E0080]: evaluation of constant value failed
|
||||
/rustc/xyz/library/core/src/ptr/mod.rs:1135:9: unable to copy parts of a pointer from memory at alloc10
|
||||
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9
|
||||
|
|
||||
= note: unable to copy parts of a pointer from memory at alloc10
|
||||
|
|
||||
= help: this code performed an operation that depends on the underlying bytes representing a pointer
|
||||
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
|
||||
note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>`
|
||||
/rustc/xyz/library/core/src/ptr/mod.rs:1135:9
|
||||
--> /rustc/xyz/library/core/src/ptr/mod.rs:1135:9
|
||||
note: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>`
|
||||
/rustc/xyz/library/core/src/mem/mod.rs:773:17
|
||||
--> /rustc/xyz/library/core/src/mem/mod.rs:773:17
|
||||
note: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>`
|
||||
/rustc/xyz/library/core/src/ptr/mod.rs:944:9
|
||||
--> /rustc/xyz/library/core/src/ptr/mod.rs:944:9
|
||||
note: inside `swap_nonoverlapping::<MaybeUninit<u8>>`
|
||||
/rustc/xyz/library/core/src/ptr/mod.rs:925:14
|
||||
--> /rustc/xyz/library/core/src/ptr/mod.rs:925:14
|
||||
note: inside `X`
|
||||
--> $DIR/missing_span_in_backtrace.rs:16:9
|
||||
|
|
||||
|
@ -7,7 +7,9 @@ error[E0277]: `MyError` doesn't implement `std::fmt::Display`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `MyError`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `std::error::Error`
|
||||
/rustc/xyz/library/core/src/error.rs:31:26: required by this bound in `std::error::Error`
|
||||
--> /rustc/xyz/library/core/src/error.rs:31:26
|
||||
|
|
||||
= note: required by this bound in `std::error::Error`
|
||||
|
||||
error[E0277]: `MyError` doesn't implement `Debug`
|
||||
--> $DIR/issue-71363.rs:4:6
|
||||
@ -18,7 +20,9 @@ error[E0277]: `MyError` doesn't implement `Debug`
|
||||
= help: the trait `Debug` is not implemented for `MyError`
|
||||
= note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError`
|
||||
note: required by a bound in `std::error::Error`
|
||||
/rustc/xyz/library/core/src/error.rs:31:18: required by this bound in `std::error::Error`
|
||||
--> /rustc/xyz/library/core/src/error.rs:31:18
|
||||
|
|
||||
= note: required by this bound in `std::error::Error`
|
||||
help: consider annotating `MyError` with `#[derive(Debug)]`
|
||||
|
|
||||
3 | #[derive(Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user