diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 6ce3fa3535d..74852ba3698 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -984,7 +984,7 @@ impl HumanEmitter {
// 4 | }
// |
for pos in 0..=line_len {
- draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2);
+ draw_col_separator_no_space(buffer, line_offset + pos + 1, width_offset - 2);
}
// Write the horizontal lines for multiline annotations
@@ -2260,13 +2260,23 @@ impl HumanEmitter {
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
}
[] => {
- draw_col_separator(buffer, *row_num, max_line_num_len + 1);
+ draw_col_separator_no_space(buffer, *row_num, max_line_num_len + 1);
}
_ => {
buffer.puts(*row_num, max_line_num_len + 1, "~ ", Style::Addition);
}
}
- buffer.append(*row_num, &normalize_whitespace(line_to_add), Style::NoStyle);
+ // LL | line_to_add
+ // ++^^^
+ // | |
+ // | magic `3`
+ // `max_line_num_len`
+ buffer.puts(
+ *row_num,
+ max_line_num_len + 3,
+ &normalize_whitespace(line_to_add),
+ Style::NoStyle,
+ );
} else if let DisplaySuggestion::Add = show_code_change {
buffer.puts(*row_num, 0, &self.maybe_anonymized(line_num), Style::LineNumber);
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
diff --git a/tests/ui/codemap_tests/huge_multispan_highlight.svg b/tests/ui/codemap_tests/huge_multispan_highlight.svg
index f1e96583ff0..7b6dbb17c6f 100644
--- a/tests/ui/codemap_tests/huge_multispan_highlight.svg
+++ b/tests/ui/codemap_tests/huge_multispan_highlight.svg
@@ -27,11 +27,11 @@
LL | let _ = match true {
- | ---------- `match` arms have incompatible types
+ | ---------- `match` arms have incompatible types
LL | true => (
- | _________________-
+ | _________________-
LL | | // last line shown in multispan header
@@ -41,11 +41,11 @@
LL | | ),
- | |_________- this is found to be of type `()`
+ | |_________- this is found to be of type `()`
LL | false => "
- | __________________^
+ | __________________^
... |
@@ -53,7 +53,7 @@
LL | | ",
- | |_________^ expected `()`, found `&str`
+ | |_________^ expected `()`, found `&str`
@@ -65,11 +65,11 @@
LL | let _ = match true {
- | ---------- `match` arms have incompatible types
+ | ---------- `match` arms have incompatible types
LL | true => (
- | _________________-
+ | _________________-
LL | |
@@ -81,11 +81,11 @@
LL | | ),
- | |_________- this is found to be of type `{integer}`
+ | |_________- this is found to be of type `{integer}`
LL | false => "
- | __________________^
+ | __________________^
LL | |
@@ -99,7 +99,7 @@
LL | | ",
- | |_________^ expected integer, found `&str`
+ | |_________^ expected integer, found `&str`
diff --git a/tests/ui/error-emitter/highlighting.svg b/tests/ui/error-emitter/highlighting.svg
index 1d82a97888a..be92c00c19b 100644
--- a/tests/ui/error-emitter/highlighting.svg
+++ b/tests/ui/error-emitter/highlighting.svg
@@ -29,11 +29,11 @@
LL | query(wrapped_fn);
- | ----- ^^^^^^^^^^ one type is more general than the other
+ | ----- ^^^^^^^^^^ one type is more general than the other
- | |
+ | |
- | arguments to this function are incorrect
+ | arguments to this function are incorrect
|
@@ -49,13 +49,13 @@
LL | fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(
- | ____^^^^^_-
+ | ____^^^^^_-
LL | | dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
LL | | )>>) {}
- | |___-
+ | |___-
diff --git a/tests/ui/error-emitter/highlighting.windows.svg b/tests/ui/error-emitter/highlighting.windows.svg
index 88143f725a5..152245da9dd 100644
--- a/tests/ui/error-emitter/highlighting.windows.svg
+++ b/tests/ui/error-emitter/highlighting.windows.svg
@@ -30,11 +30,11 @@
LL | query(wrapped_fn);
- | ----- ^^^^^^^^^^ one type is more general than the other
+ | ----- ^^^^^^^^^^ one type is more general than the other
- | |
+ | |
- | arguments to this function are incorrect
+ | arguments to this function are incorrect
|
@@ -50,13 +50,13 @@
LL | fn query(_: fn(Box<(dyn Any + Send + '_)>) -> Pin<Box<(
- | ____^^^^^_-
+ | ____^^^^^_-
LL | | dyn Future<Output = Result<Box<(dyn Any + 'static)>, String>> + Send + 'static
LL | | )>>) {}
- | |___-
+ | |___-
diff --git a/tests/ui/error-emitter/multiline-multipart-suggestion.svg b/tests/ui/error-emitter/multiline-multipart-suggestion.svg
index 26210fade74..c0fb98555ad 100644
--- a/tests/ui/error-emitter/multiline-multipart-suggestion.svg
+++ b/tests/ui/error-emitter/multiline-multipart-suggestion.svg
@@ -29,7 +29,7 @@
LL | fn short(foo_bar: &Vec<&i32>) -> &i32 {
- | ---------- ^ expected named lifetime parameter
+ | ---------- ^ expected named lifetime parameter
|
@@ -53,13 +53,13 @@
LL | foo_bar: &Vec<&i32>,
- | ----------
+ | ----------
LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
LL | ) -> &i32 {
- | ^ expected named lifetime parameter
+ | ^ expected named lifetime parameter
|
@@ -73,7 +73,7 @@
LL ~ foo_bar: &'a Vec<&'a i32>,
- LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
+ LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
LL ~ ) -> &'a i32 {
@@ -89,7 +89,7 @@
LL | foo_bar: &Vec<&i32>) -> &i32 {
- | ---------- ^ expected named lifetime parameter
+ | ---------- ^ expected named lifetime parameter
|
diff --git a/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg b/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg
index 3fa9cc18f0d..61b544001f0 100644
--- a/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg
+++ b/tests/ui/error-emitter/multiline-multipart-suggestion.windows.svg
@@ -29,7 +29,7 @@
LL | fn short(foo_bar: &Vec<&i32>) -> &i32 {
- | ---------- ^ expected named lifetime parameter
+ | ---------- ^ expected named lifetime parameter
|
@@ -53,13 +53,13 @@
LL | foo_bar: &Vec<&i32>,
- | ----------
+ | ----------
LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
LL | ) -> &i32 {
- | ^ expected named lifetime parameter
+ | ^ expected named lifetime parameter
|
@@ -73,7 +73,7 @@
LL ~ foo_bar: &'a Vec<&'a i32>,
- LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
+ LL | something_very_long_so_that_the_line_will_wrap_around__________: i32,
LL ~ ) -> &'a i32 {
@@ -89,7 +89,7 @@
LL | foo_bar: &Vec<&i32>) -> &i32 {
- | ---------- ^ expected named lifetime parameter
+ | ---------- ^ expected named lifetime parameter
|
diff --git a/tests/ui/imports/issue-59764.stderr b/tests/ui/imports/issue-59764.stderr
index fe58eb97b8d..293c2a60d80 100644
--- a/tests/ui/imports/issue-59764.stderr
+++ b/tests/ui/imports/issue-59764.stderr
@@ -208,9 +208,9 @@ LL | makro as foobar}
help: a macro with this name exists at the root of the crate
|
LL ~ issue_59764::{makro as foobar,
-LL |
+LL |
...
-LL |
+LL |
LL ~ foo::{baz}
|
diff --git a/tests/ui/issues/issue-22644.stderr b/tests/ui/issues/issue-22644.stderr
index 0799e9ef11b..7d8a0ff170a 100644
--- a/tests/ui/issues/issue-22644.stderr
+++ b/tests/ui/issues/issue-22644.stderr
@@ -63,9 +63,9 @@ LL | 5);
help: try comparing the cast value
|
LL ~ println!("{}", (a
-LL |
+LL |
...
-LL |
+LL |
LL ~ usize)
|
diff --git a/tests/ui/lint/use_suggestion_json.stderr b/tests/ui/lint/use_suggestion_json.stderr
index 16fb1682d4a..acc36550642 100644
--- a/tests/ui/lint/use_suggestion_json.stderr
+++ b/tests/ui/lint/use_suggestion_json.stderr
@@ -384,7 +384,7 @@ mod foo {
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0m$DIR/use_suggestion_json.rs:12:12\u001b[0m
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
\u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let x: Iter;\u001b[0m
-\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m
+\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these items\u001b[0m
\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m
diff --git a/tests/ui/macros/issue-118048.stderr b/tests/ui/macros/issue-118048.stderr
index 6acf78f63b2..4dc5ef71fec 100644
--- a/tests/ui/macros/issue-118048.stderr
+++ b/tests/ui/macros/issue-118048.stderr
@@ -12,7 +12,7 @@ help: use type parameters instead
LL ~ fn foo(_: $ty, _: $ty) {}
LL | }
LL | }
-LL |
+LL |
LL ~ foo!(T);
|
diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr
index 7d9b38fb29b..5a76449e9f9 100644
--- a/tests/ui/methods/method-call-err-msg.stderr
+++ b/tests/ui/methods/method-call-err-msg.stderr
@@ -55,7 +55,7 @@ LL | / y.zero()
LL | | .take()
| | -^^^^ `Foo` is not an iterator
| |______|
- |
+ |
|
= note: the following trait bounds were not satisfied:
`Foo: Iterator`
diff --git a/tests/ui/str/str-escape.stderr b/tests/ui/str/str-escape.stderr
index 00fe5444e1a..c4aee2a110a 100644
--- a/tests/ui/str/str-escape.stderr
+++ b/tests/ui/str/str-escape.stderr
@@ -15,7 +15,7 @@ LL | let s = c"foo\
LL | | bar
| | ^ whitespace symbol '\u{a0}' is not skipped
| |___|
- |
+ |
warning: whitespace symbol '\u{c}' is not skipped
--> $DIR/str-escape.rs:26:16
@@ -25,7 +25,7 @@ LL | let s = b"a\
LL | | b";
| | ^- whitespace symbol '\u{c}' is not skipped
| |____|
- |
+ |
warning: 3 warnings emitted
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
index cdf51632acd..e818409366d 100644
--- a/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
@@ -11,7 +11,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL ~ struct Baz { q: Option> }
LL |
-LL |
+LL |
LL ~ struct Foo { q: Option> }
|
diff --git a/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr b/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
index 881bc281936..afe523939ac 100644
--- a/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
+++ b/tests/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
@@ -16,7 +16,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL ~ y: Box>,
LL | }
-LL |
+LL |
LL | struct B {
LL ~ z: Box>
|
@@ -39,7 +39,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL ~ y: Option