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);
|
||||
} else {
|
||||
let mut label_width = 0;
|
||||
// The failure note level itself does not provide any useful diagnostic information
|
||||
if *level != Level::FailureNote {
|
||||
buffer.append(0, level.to_str(), Style::Level(*level));
|
||||
label_width += level.to_str().len();
|
||||
}
|
||||
// only render error codes, not lint codes
|
||||
if let Some(DiagnosticId::Error(ref code)) = *code {
|
||||
buffer.append(0, "[", Style::Level(*level));
|
||||
buffer.append(0, &code, 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 };
|
||||
if *level != Level::FailureNote {
|
||||
buffer.append(0, ": ", header_style);
|
||||
label_width += 2;
|
||||
}
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ error: unexpected token: `{
|
|||
::core::fmt::Display::fmt)],
|
||||
}));
|
||||
res
|
||||
}.as_str()`
|
||||
}.as_str()`
|
||||
--> $DIR/key-value-expansion.rs:48:23
|
||||
|
|
||||
LL | doc_comment! {format!("{coor}", coor = stringify!($t1)).as_str()}
|
||||
|
|
|
@ -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: 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: aborting due to previous error
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ error: layout_of(E) = Layout {
|
|||
size: Size {
|
||||
raw: 12,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/debug.rs:6:1
|
||||
|
|
||||
LL | enum E { Foo, Bar(!, i32, i32) }
|
||||
|
@ -158,7 +158,7 @@ error: layout_of(S) = Layout {
|
|||
size: Size {
|
||||
raw: 8,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/debug.rs:9:1
|
||||
|
|
||||
LL | struct S { f1: i32, f2: (), f3: i32 }
|
||||
|
@ -184,7 +184,7 @@ error: layout_of(U) = Layout {
|
|||
size: Size {
|
||||
raw: 8,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/debug.rs:12:1
|
||||
|
|
||||
LL | union U { f1: (i32, i32), f3: i32 }
|
||||
|
@ -309,7 +309,7 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
|
|||
size: Size {
|
||||
raw: 8,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/debug.rs:15:1
|
||||
|
|
||||
LL | type Test = Result<i32, i32>;
|
||||
|
@ -339,7 +339,7 @@ error: layout_of(i32) = Layout {
|
|||
size: Size {
|
||||
raw: 4,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/debug.rs:18:1
|
||||
|
|
||||
LL | type T = impl std::fmt::Debug;
|
||||
|
|
|
@ -80,7 +80,7 @@ error: layout_of(A) = Layout {
|
|||
size: Size {
|
||||
raw: 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/hexagon-enum.rs:16:1
|
||||
|
|
||||
LL | enum A { Apple }
|
||||
|
@ -168,7 +168,7 @@ error: layout_of(B) = Layout {
|
|||
size: Size {
|
||||
raw: 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/hexagon-enum.rs:20:1
|
||||
|
|
||||
LL | enum B { Banana = 255, }
|
||||
|
@ -256,7 +256,7 @@ error: layout_of(C) = Layout {
|
|||
size: Size {
|
||||
raw: 2,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/hexagon-enum.rs:24:1
|
||||
|
|
||||
LL | enum C { Chaenomeles = 256, }
|
||||
|
@ -344,7 +344,7 @@ error: layout_of(P) = Layout {
|
|||
size: Size {
|
||||
raw: 4,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/hexagon-enum.rs:28:1
|
||||
|
|
||||
LL | enum P { Peach = 0x1000_0000isize, }
|
||||
|
@ -432,7 +432,7 @@ error: layout_of(T) = Layout {
|
|||
size: Size {
|
||||
raw: 4,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/hexagon-enum.rs:34:1
|
||||
|
|
||||
LL | enum T { Tangerine = TANGERINE as isize }
|
||||
|
|
|
@ -80,7 +80,7 @@ error: layout_of(A) = Layout {
|
|||
size: Size {
|
||||
raw: 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/thumb-enum.rs:16:1
|
||||
|
|
||||
LL | enum A { Apple }
|
||||
|
@ -168,7 +168,7 @@ error: layout_of(B) = Layout {
|
|||
size: Size {
|
||||
raw: 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/thumb-enum.rs:20:1
|
||||
|
|
||||
LL | enum B { Banana = 255, }
|
||||
|
@ -256,7 +256,7 @@ error: layout_of(C) = Layout {
|
|||
size: Size {
|
||||
raw: 2,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/thumb-enum.rs:24:1
|
||||
|
|
||||
LL | enum C { Chaenomeles = 256, }
|
||||
|
@ -344,7 +344,7 @@ error: layout_of(P) = Layout {
|
|||
size: Size {
|
||||
raw: 4,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/thumb-enum.rs:28:1
|
||||
|
|
||||
LL | enum P { Peach = 0x1000_0000isize, }
|
||||
|
@ -432,7 +432,7 @@ error: layout_of(T) = Layout {
|
|||
size: Size {
|
||||
raw: 4,
|
||||
},
|
||||
}
|
||||
}
|
||||
--> $DIR/thumb-enum.rs:34:1
|
||||
|
|
||||
LL | enum T { Tangerine = TANGERINE as isize }
|
||||
|
|
|
@ -7,7 +7,7 @@ error: vtable entries for `<S as D>`: [
|
|||
Method(<S as C>::foo_c),
|
||||
TraitVPtr(<S as C>),
|
||||
Method(<S as D>::foo_d),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-diamond.rs:21:1
|
||||
|
|
||||
LL | / trait D: B + C {
|
||||
|
@ -22,7 +22,7 @@ error: vtable entries for `<S as C>`: [
|
|||
MetadataAlign,
|
||||
Method(<S as A>::foo_a),
|
||||
Method(<S as C>::foo_c),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-diamond.rs:15:1
|
||||
|
|
||||
LL | / trait C: A {
|
||||
|
|
|
@ -28,7 +28,7 @@ error: vtable entries for `<S as O>`: [
|
|||
Method(<S as N>::foo_n),
|
||||
TraitVPtr(<S as N>),
|
||||
Method(<S as O>::foo_o),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:95:1
|
||||
|
|
||||
LL | / trait O: G + N {
|
||||
|
@ -42,7 +42,7 @@ error: vtable entries for `<S as B>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as B>::foo_b),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:19:1
|
||||
|
|
||||
LL | / trait B {
|
||||
|
@ -56,7 +56,7 @@ error: vtable entries for `<S as D>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as D>::foo_d),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:30:1
|
||||
|
|
||||
LL | / trait D {
|
||||
|
@ -70,7 +70,7 @@ error: vtable entries for `<S as E>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as E>::foo_e),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:36:1
|
||||
|
|
||||
LL | / trait E {
|
||||
|
@ -87,7 +87,7 @@ error: vtable entries for `<S as F>`: [
|
|||
Method(<S as E>::foo_e),
|
||||
TraitVPtr(<S as E>),
|
||||
Method(<S as F>::foo_f),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:42:1
|
||||
|
|
||||
LL | / trait F: D + E {
|
||||
|
@ -101,7 +101,7 @@ error: vtable entries for `<S as H>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as H>::foo_h),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:53:1
|
||||
|
|
||||
LL | / trait H {
|
||||
|
@ -115,7 +115,7 @@ error: vtable entries for `<S as I>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as I>::foo_i),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:59:1
|
||||
|
|
||||
LL | / trait I {
|
||||
|
@ -132,7 +132,7 @@ error: vtable entries for `<S as J>`: [
|
|||
Method(<S as I>::foo_i),
|
||||
TraitVPtr(<S as I>),
|
||||
Method(<S as J>::foo_j),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:65:1
|
||||
|
|
||||
LL | / trait J: H + I {
|
||||
|
@ -146,7 +146,7 @@ error: vtable entries for `<S as K>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as K>::foo_k),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:71:1
|
||||
|
|
||||
LL | / trait K {
|
||||
|
@ -160,7 +160,7 @@ error: vtable entries for `<S as L>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as L>::foo_l),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:77:1
|
||||
|
|
||||
LL | / trait L {
|
||||
|
@ -177,7 +177,7 @@ error: vtable entries for `<S as M>`: [
|
|||
Method(<S as L>::foo_l),
|
||||
TraitVPtr(<S as L>),
|
||||
Method(<S as M>::foo_m),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:83:1
|
||||
|
|
||||
LL | / trait M: K + L {
|
||||
|
@ -201,7 +201,7 @@ error: vtable entries for `<S as N>`: [
|
|||
Method(<S as M>::foo_m),
|
||||
TraitVPtr(<S as M>),
|
||||
Method(<S as N>::foo_n),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multi-level.rs:89:1
|
||||
|
|
||||
LL | / trait N: J + M {
|
||||
|
|
|
@ -6,7 +6,7 @@ error: vtable entries for `<S as C>`: [
|
|||
Method(<S as B>::foo_b),
|
||||
TraitVPtr(<S as B>),
|
||||
Method(<S as C>::foo_c),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multiple.rs:16:1
|
||||
|
|
||||
LL | / trait C: A + B {
|
||||
|
@ -20,7 +20,7 @@ error: vtable entries for `<S as B>`: [
|
|||
MetadataSize,
|
||||
MetadataAlign,
|
||||
Method(<S as B>::foo_b),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-multiple.rs:10:1
|
||||
|
|
||||
LL | / trait B {
|
||||
|
|
|
@ -6,7 +6,7 @@ error: vtable entries for `<std::vec::IntoIter<u8> as A>`: [
|
|||
Method(<std::vec::IntoIter<u8> as Iterator>::size_hint),
|
||||
Method(<std::vec::IntoIter<u8> as Iterator>::advance_by),
|
||||
Method(<std::vec::IntoIter<u8> as Iterator>::nth),
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-non-object-safe.rs:8:1
|
||||
|
|
||||
LL | trait A: Iterator {}
|
||||
|
|
|
@ -6,7 +6,7 @@ error: vtable entries for `<S as B>`: [
|
|||
Vacant,
|
||||
Method(<S as B>::foo_b1),
|
||||
Vacant,
|
||||
]
|
||||
]
|
||||
--> $DIR/vtable-vacant.rs:15:1
|
||||
|
|
||||
LL | / trait B: A {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue