Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 87d713f

Browse files
committed
Auto merge of rust-lang#86197 - FabianWolff:trailing-whitespace, r=JohnTitor
Remove unnecessary trailing whitespace from error messages Some error messages currently contain unnecessary trailing whitespace. There are some legitimate reasons for having trailing whitespace in the output, such as for uniform indentation of possibly-empty input lines, but the whitespace I have addressed here occurs in a line used only for spacing, and I see no reason why that should have trailing whitespace (spacing lines inserted in other places also don't have trailing whitespace). I have also removed a superfluous call to `buffer.putc()`, which has no effect because the same character is already placed there by `draw_col_separator()`. Use `git diff --ignore-space-at-eol` to see my changes; otherwise the diff is quite large due to the whitespace removed from expected outputs in `src/test/ui/`.
2 parents 49ca3d9 + f8372f8 commit 87d713f

File tree

125 files changed

+247
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+247
-244
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,6 @@ impl EmitterWriter {
954954
// |
955955
for pos in 0..=line_len {
956956
draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2);
957-
buffer.putc(line_offset + pos + 1, width_offset - 2, '|', Style::LineNumber);
958957
}
959958

960959
// Write the horizontal lines for multiline annotations
@@ -1344,7 +1343,11 @@ impl EmitterWriter {
13441343
let buffer_msg_line_offset = buffer.num_lines();
13451344

13461345
// Add spacing line
1347-
draw_col_separator(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1);
1346+
draw_col_separator_no_space(
1347+
&mut buffer,
1348+
buffer_msg_line_offset,
1349+
max_line_num_len + 1,
1350+
);
13481351

13491352
// Then, the secondary file indicator
13501353
buffer.prepend(buffer_msg_line_offset + 1, "::: ", Style::LineNumber);

src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be sent between th
33
|
44
LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
55
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be sent between threads safely
6-
|
6+
|
77
::: $SRC_DIR/core/src/marker.rs:LL:COL
88
|
99
LL | pub unsafe auto trait Send {
@@ -20,7 +20,7 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` is not an iterator
2020
|
2121
LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<<Self as Case1>::C as Iterator>::Item` is not an iterator
23-
|
23+
|
2424
::: $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
2525
|
2626
LL | pub trait Iterator {
@@ -37,7 +37,7 @@ error[E0277]: `<<Self as Case1>::C as Iterator>::Item` cannot be shared between
3737
|
3838
LL | type C: Clone + Iterator<Item: Send + Iterator<Item: for<'a> Lam<&'a u8, App: Debug>> + Sync>;
3939
| ^^^^ `<<Self as Case1>::C as Iterator>::Item` cannot be shared between threads safely
40-
|
40+
|
4141
::: $SRC_DIR/core/src/marker.rs:LL:COL
4242
|
4343
LL | pub unsafe auto trait Sync {

src/test/ui/associated-type-bounds/bounds-on-assoc-in-trait.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug`
33
|
44
LL | type A: Iterator<Item: Debug>;
55
| ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
6-
|
6+
|
77
::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
88
|
99
LL | pub trait Debug {
@@ -20,7 +20,7 @@ error[E0277]: the trait bound `<<Self as Foo>::Out as Baz>::Assoc: Default` is n
2020
|
2121
LL | pub trait Foo { type Out: Baz<Assoc: Default>; }
2222
| ^^^^^^^ the trait `Default` is not implemented for `<<Self as Foo>::Out as Baz>::Assoc`
23-
|
23+
|
2424
::: $SRC_DIR/core/src/default.rs:LL:COL
2525
|
2626
LL | pub trait Default: Sized {

src/test/ui/associated-types/defaults-wf.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
33
|
44
LL | type Ty = Vec<[u8]>;
55
| ^^^^^^^^^ doesn't have a size known at compile-time
6-
|
6+
|
77
::: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
88
|
99
LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {

src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
33
|
44
LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> {}
55
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
6-
|
6+
|
77
::: $SRC_DIR/core/src/ops/arith.rs:LL:COL
88
|
99
LL | pub trait Add<Rhs = Self> {

src/test/ui/async-await/generator-desc.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ LL | fun((async || {})(), (async || {})());
3737
| -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
3838
| |
3939
| the expected `async` closure body
40-
|
40+
|
4141
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
4242
|
4343
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>

src/test/ui/async-await/issue-72442.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: the trait bound `Option<&str>: AsRef<Path>` is not satisfied
33
|
44
LL | let mut f = File::open(path.to_str())?;
55
| ^^^^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Option<&str>`
6-
|
6+
|
77
::: $SRC_DIR/std/src/fs.rs:LL:COL
88
|
99
LL | pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> {

src/test/ui/async-await/issues/issue-67893.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn g(_: impl Send) {}
66
...
77
LL | g(issue_67893::run())
88
| ^ `MutexGuard<'_, ()>` cannot be sent between threads safely
9-
|
9+
|
1010
::: $DIR/auxiliary/issue_67893.rs:7:20
1111
|
1212
LL | pub async fn run() {

src/test/ui/async-await/pin-needed-to-poll.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | struct Sleep;
66
...
77
LL | self.sleep.poll(cx)
88
| ^^^^ method not found in `Sleep`
9-
|
9+
|
1010
::: $SRC_DIR/core/src/future/future.rs:LL:COL
1111
|
1212
LL | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>;

src/test/ui/borrowck/move-error-snippets.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let a = $c;
66
| |
77
| move occurs because `D` has type `A`, which does not implement the `Copy` trait
88
| help: consider borrowing here: `&$c`
9-
|
9+
|
1010
::: $DIR/move-error-snippets.rs:21:1
1111
|
1212
LL | sss!();

0 commit comments

Comments
 (0)