Skip to content

Commit da8072a

Browse files
committed
Avoid trailing space in error message
1 parent 5fb3394 commit da8072a

File tree

125 files changed

+247
-243
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
-243
lines changed

compiler/rustc_errors/src/emitter.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,11 @@ impl EmitterWriter {
13441344
let buffer_msg_line_offset = buffer.num_lines();
13451345

13461346
// Add spacing line
1347-
draw_col_separator(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1);
1347+
draw_col_separator_no_space(
1348+
&mut buffer,
1349+
buffer_msg_line_offset,
1350+
max_line_num_len + 1,
1351+
);
13481352

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

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

+3-3
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

+2-2
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

+1-1
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

+1-1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LL | fun((async || {})(), (async || {})());
3434
| -- ^^^^^^^^^^^^^^^ expected `async` closure body, found a different `async` closure body
3535
| |
3636
| the expected `async` closure body
37-
|
37+
|
3838
::: $SRC_DIR/core/src/future/mod.rs:LL:COL
3939
|
4040
LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>

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

+1-1
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

+1-1
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

+1-1
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

+1-1
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!();

src/test/ui/bound-suggestions.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
7575
|
7676
LL | const SIZE: usize = core::mem::size_of::<Self>();
7777
| ^^^^ doesn't have a size known at compile-time
78-
|
78+
|
7979
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
8080
|
8181
LL | pub const fn size_of<T>() -> usize {
@@ -91,7 +91,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
9191
|
9292
LL | const SIZE: usize = core::mem::size_of::<Self>();
9393
| ^^^^ doesn't have a size known at compile-time
94-
|
94+
|
9595
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
9696
|
9797
LL | pub const fn size_of<T>() -> usize {
@@ -107,7 +107,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
107107
|
108108
LL | const SIZE: usize = core::mem::size_of::<Self>();
109109
| ^^^^ doesn't have a size known at compile-time
110-
|
110+
|
111111
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
112112
|
113113
LL | pub const fn size_of<T>() -> usize {
@@ -123,7 +123,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
123123
|
124124
LL | const SIZE: usize = core::mem::size_of::<Self>();
125125
| ^^^^ doesn't have a size known at compile-time
126-
|
126+
|
127127
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
128128
|
129129
LL | pub const fn size_of<T>() -> usize {
@@ -139,7 +139,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
139139
|
140140
LL | const SIZE: usize = core::mem::size_of::<Self>();
141141
| ^^^^ doesn't have a size known at compile-time
142-
|
142+
|
143143
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
144144
|
145145
LL | pub const fn size_of<T>() -> usize {

src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: `T` cannot be sent between threads safely
33
|
44
LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely
6-
|
6+
|
77
::: $DIR/auxiliary/trait_superkinds_in_metadata.rs:7:58
88
|
99
LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { }

src/test/ui/c-variadic/issue-86053-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ error[E0412]: cannot find type `F` in this scope
6363
|
6464
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
6565
| ^
66-
|
66+
|
6767
::: $SRC_DIR/core/src/ops/function.rs:LL:COL
6868
|
6969
LL | pub trait Fn<Args>: FnMut<Args> {

src/test/ui/closures/closure-move-sync.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads s
33
|
44
LL | let t = thread::spawn(|| {
55
| ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely
6-
|
6+
|
77
::: $SRC_DIR/std/src/thread/mod.rs:LL:COL
88
|
99
LL | F: Send + 'static,
@@ -18,7 +18,7 @@ error[E0277]: `Sender<()>` cannot be shared between threads safely
1818
|
1919
LL | thread::spawn(|| tx.send(()).unwrap());
2020
| ^^^^^^^^^^^^^ `Sender<()>` cannot be shared between threads safely
21-
|
21+
|
2222
::: $SRC_DIR/std/src/thread/mod.rs:LL:COL
2323
|
2424
LL | F: Send + 'static,

src/test/ui/const-generics/const-argument-if-length.full.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | pub const fn is_zst<T: ?Sized>() -> usize {
55
| - this type parameter needs to be `std::marker::Sized`
66
LL | if std::mem::size_of::<T>() == 0 {
77
| ^ doesn't have a size known at compile-time
8-
|
8+
|
99
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
1010
|
1111
LL | pub const fn size_of<T>() -> usize {

src/test/ui/const-generics/const_evaluatable_checked/cross_crate_predicate.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ error: unconstrained generic constant
33
|
44
LL | let _ = const_evaluatable_lib::test1::<T>();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6-
|
6+
|
77
::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10
88
|
99
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
@@ -16,7 +16,7 @@ error: unconstrained generic constant
1616
|
1717
LL | let _ = const_evaluatable_lib::test1::<T>();
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19-
|
19+
|
2020
::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27
2121
|
2222
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]
@@ -29,7 +29,7 @@ error: unconstrained generic constant
2929
|
3030
LL | let _ = const_evaluatable_lib::test1::<T>();
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32-
|
32+
|
3333
::: $DIR/auxiliary/const_evaluatable_lib.rs:6:10
3434
|
3535
LL | [u8; std::mem::size_of::<T>() - 1]: Sized,
@@ -42,7 +42,7 @@ error: unconstrained generic constant
4242
|
4343
LL | let _ = const_evaluatable_lib::test1::<T>();
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45-
|
45+
|
4646
::: $DIR/auxiliary/const_evaluatable_lib.rs:4:27
4747
|
4848
LL | pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]

src/test/ui/const-ptr/out_of_bounds_read.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ LL | unsafe { copy_nonoverlapping(src, dst, count) }
66
| |
77
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
88
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
9-
|
9+
|
1010
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
1111
|
1212
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
1313
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
14-
|
14+
|
1515
::: $DIR/out_of_bounds_read.rs:13:33
1616
|
1717
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
@@ -25,17 +25,17 @@ LL | unsafe { copy_nonoverlapping(src, dst, count) }
2525
| |
2626
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
2727
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
28-
|
28+
|
2929
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
3030
|
3131
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
3232
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
33-
|
33+
|
3434
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
3535
|
3636
LL | unsafe { read(self) }
3737
| ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
38-
|
38+
|
3939
::: $DIR/out_of_bounds_read.rs:14:39
4040
|
4141
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
@@ -49,17 +49,17 @@ LL | unsafe { copy_nonoverlapping(src, dst, count) }
4949
| |
5050
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
5151
| inside `copy_nonoverlapping::<u32>` at $SRC_DIR/core/src/intrinsics.rs:LL:COL
52-
|
52+
|
5353
::: $SRC_DIR/core/src/ptr/mod.rs:LL:COL
5454
|
5555
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
5656
| --------------------------------------------- inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
57-
|
57+
|
5858
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
5959
|
6060
LL | unsafe { read(self) }
6161
| ---------- inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
62-
|
62+
|
6363
::: $DIR/out_of_bounds_read.rs:15:37
6464
|
6565
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };

src/test/ui/consts/const_unsafe_unreachable_ub.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | unsafe { intrinsics::unreachable() }
66
| |
77
| entering unreachable code
88
| inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL
9-
|
9+
|
1010
::: $DIR/const_unsafe_unreachable_ub.rs:7:18
1111
|
1212
LL | false => std::hint::unreachable_unchecked(),

src/test/ui/consts/miri_unleashed/drop.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
66
| |
77
| calling non-const function `<Vec<i32> as Drop>::drop`
88
| inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
9-
|
9+
|
1010
::: $DIR/drop.rs:18:1
1111
|
1212
LL | };

src/test/ui/consts/offset_from_ub.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
1212
| |
1313
| 0x2a is not a valid pointer
1414
| inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
15-
|
15+
|
1616
::: $DIR/offset_from_ub.rs:24:14
1717
|
1818
LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }

0 commit comments

Comments
 (0)