Skip to content

Commit e0eb63a

Browse files
authored
Rollup merge of #106860 - anden3:doc-double-spaces, r=Dylan-DPC
Remove various double spaces in the libraries. I was just pretty bothered by this when reading the source for a function, and was suggested to check if this happened elsewhere.
2 parents bc0c816 + 2fea03f commit e0eb63a

File tree

35 files changed

+71
-71
lines changed

35 files changed

+71
-71
lines changed

library/alloc/src/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use core::marker::Destruct;
2020
mod tests;
2121

2222
extern "Rust" {
23-
// These are the magic symbols to call the global allocator. rustc generates
23+
// These are the magic symbols to call the global allocator. rustc generates
2424
// them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
2525
// (the code expanding that attribute macro generates those functions), or to call
2626
// the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
@@ -353,7 +353,7 @@ pub(crate) const unsafe fn box_free<T: ?Sized, A: ~const Allocator + ~const Dest
353353

354354
#[cfg(not(no_global_oom_handling))]
355355
extern "Rust" {
356-
// This is the magic symbol to call the global alloc error handler. rustc generates
356+
// This is the magic symbol to call the global alloc error handler. rustc generates
357357
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
358358
// default implementations below (`__rdl_oom`) otherwise.
359359
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;

library/alloc/src/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ pub struct Weak<T: ?Sized> {
21792179
// This is a `NonNull` to allow optimizing the size of this type in enums,
21802180
// but it is not necessarily a valid pointer.
21812181
// `Weak::new` sets this to `usize::MAX` so that it doesn’t need
2182-
// to allocate space on the heap. That's not a value a real pointer
2182+
// to allocate space on the heap. That's not a value a real pointer
21832183
// will ever have because RcBox has alignment at least 2.
21842184
// This is only possible when `T: Sized`; unsized `T` never dangle.
21852185
ptr: NonNull<RcBox<T>>,

library/alloc/src/sync.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ pub struct Weak<T: ?Sized> {
295295
// This is a `NonNull` to allow optimizing the size of this type in enums,
296296
// but it is not necessarily a valid pointer.
297297
// `Weak::new` sets this to `usize::MAX` so that it doesn’t need
298-
// to allocate space on the heap. That's not a value a real pointer
298+
// to allocate space on the heap. That's not a value a real pointer
299299
// will ever have because RcBox has alignment at least 2.
300300
// This is only possible when `T: Sized`; unsized `T` never dangle.
301301
ptr: NonNull<ArcInner<T>>,
@@ -1656,7 +1656,7 @@ impl<T: ?Sized> Arc<T> {
16561656
//
16571657
// The acquire label here ensures a happens-before relationship with any
16581658
// writes to `strong` (in particular in `Weak::upgrade`) prior to decrements
1659-
// of the `weak` count (via `Weak::drop`, which uses release). If the upgraded
1659+
// of the `weak` count (via `Weak::drop`, which uses release). If the upgraded
16601660
// weak ref was never dropped, the CAS here will fail so we do not care to synchronize.
16611661
if self.inner().weak.compare_exchange(1, usize::MAX, Acquire, Relaxed).is_ok() {
16621662
// This needs to be an `Acquire` to synchronize with the decrement of the `strong`
@@ -1712,7 +1712,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc<T> {
17121712
}
17131713

17141714
// This fence is needed to prevent reordering of use of the data and
1715-
// deletion of the data. Because it is marked `Release`, the decreasing
1715+
// deletion of the data. Because it is marked `Release`, the decreasing
17161716
// of the reference count synchronizes with this `Acquire` fence. This
17171717
// means that use of the data happens before decreasing the reference
17181718
// count, which happens before this fence, which happens before the
@@ -2172,7 +2172,7 @@ impl<T: ?Sized> Clone for Weak<T> {
21722172
} else {
21732173
return Weak { ptr: self.ptr };
21742174
};
2175-
// See comments in Arc::clone() for why this is relaxed. This can use a
2175+
// See comments in Arc::clone() for why this is relaxed. This can use a
21762176
// fetch_add (ignoring the lock) because the weak count is only locked
21772177
// where are *no other* weak pointers in existence. (So we can't be
21782178
// running this code in that case).

library/alloc/src/vec/into_iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct IntoIter<
4040
// to avoid dropping the allocator twice we need to wrap it into ManuallyDrop
4141
pub(super) alloc: ManuallyDrop<A>,
4242
pub(super) ptr: *const T,
43-
pub(super) end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
43+
pub(super) end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
4444
// ptr == end is a quick test for the Iterator being empty, that works
4545
// for both ZST and non-ZST.
4646
}
@@ -146,9 +146,9 @@ impl<T, A: Allocator> IntoIter<T, A> {
146146
let mut this = ManuallyDrop::new(self);
147147

148148
// SAFETY: This allocation originally came from a `Vec`, so it passes
149-
// all those checks. We have `this.buf` ≤ `this.ptr` ≤ `this.end`,
149+
// all those checks. We have `this.buf` ≤ `this.ptr` ≤ `this.end`,
150150
// so the `sub_ptr`s below cannot wrap, and will produce a well-formed
151-
// range. `end` ≤ `buf + cap`, so the range will be in-bounds.
151+
// range. `end` ≤ `buf + cap`, so the range will be in-bounds.
152152
// Taking `alloc` is ok because nothing else is going to look at it,
153153
// since our `Drop` impl isn't going to run so there's no more code.
154154
unsafe {

library/alloc/src/vec/is_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ unsafe impl<T: IsZero, const N: usize> IsZero for [T; N] {
5757
#[inline]
5858
fn is_zero(&self) -> bool {
5959
// Because this is generated as a runtime check, it's not obvious that
60-
// it's worth doing if the array is really long. The threshold here
60+
// it's worth doing if the array is really long. The threshold here
6161
// is largely arbitrary, but was picked because as of 2022-07-01 LLVM
6262
// fails to const-fold the check in `vec![[1; 32]; n]`
6363
// See https://github.com/rust-lang/rust/pull/97581#issuecomment-1166628022

library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,7 +2429,7 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
24292429
self.reserve(range.len());
24302430

24312431
// SAFETY:
2432-
// - `slice::range` guarantees that the given range is valid for indexing self
2432+
// - `slice::range` guarantees that the given range is valid for indexing self
24332433
unsafe {
24342434
self.spec_extend_from_within(range);
24352435
}
@@ -2686,7 +2686,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for Vec<T, A> {
26862686

26872687
// HACK(japaric): with cfg(test) the inherent `[T]::to_vec` method, which is
26882688
// required for this method definition, is not available. Instead use the
2689-
// `slice::to_vec` function which is only available with cfg(test)
2689+
// `slice::to_vec` function which is only available with cfg(test)
26902690
// NB see the slice::hack module in slice.rs for more information
26912691
#[cfg(test)]
26922692
fn clone(&self) -> Self {

library/alloc/tests/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ fn test_stable_pointers() {
18491849
}
18501850

18511851
// Test that, if we reserved enough space, adding and removing elements does not
1852-
// invalidate references into the vector (such as `v0`). This test also
1852+
// invalidate references into the vector (such as `v0`). This test also
18531853
// runs in Miri, which would detect such problems.
18541854
// Note that this test does *not* constitute a stable guarantee that all these functions do not
18551855
// reallocate! Only what is explicitly documented at

library/core/src/array/iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ impl<T, const N: usize> IntoIter<T, N> {
109109
/// use std::array::IntoIter;
110110
/// use std::mem::MaybeUninit;
111111
///
112-
/// # // Hi! Thanks for reading the code. This is restricted to `Copy` because
113-
/// # // otherwise it could leak. A fully-general version this would need a drop
112+
/// # // Hi! Thanks for reading the code. This is restricted to `Copy` because
113+
/// # // otherwise it could leak. A fully-general version this would need a drop
114114
/// # // guard to handle panics from the iterator, but this works for an example.
115115
/// fn next_chunk<T: Copy, const N: usize>(
116116
/// it: &mut impl Iterator<Item = T>,
@@ -211,7 +211,7 @@ impl<T, const N: usize> IntoIter<T, N> {
211211
let initialized = 0..0;
212212

213213
// SAFETY: We're telling it that none of the elements are initialized,
214-
// which is trivially true. And ∀N: usize, 0 <= N.
214+
// which is trivially true. And ∀N: usize, 0 <= N.
215215
unsafe { Self::new_unchecked(buffer, initialized) }
216216
}
217217

library/core/src/iter/range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl<A: Step> Iterator for ops::Range<A> {
756756
where
757757
Self: TrustedRandomAccessNoCoerce,
758758
{
759-
// SAFETY: The TrustedRandomAccess contract requires that callers only pass an index
759+
// SAFETY: The TrustedRandomAccess contract requires that callers only pass an index
760760
// that is in bounds.
761761
// Additionally Self: TrustedRandomAccess is only implemented for Copy types
762762
// which means even repeated reads of the same index would be safe.

library/core/src/num/dec2flt/fpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod fpu_precision {
2626
/// Developer's Manual (Volume 1).
2727
///
2828
/// The only field which is relevant for the following code is PC, Precision Control. This
29-
/// field determines the precision of the operations performed by the FPU. It can be set to:
29+
/// field determines the precision of the operations performed by the FPU. It can be set to:
3030
/// - 0b00, single precision i.e., 32-bits
3131
/// - 0b10, double precision i.e., 64-bits
3232
/// - 0b11, double extended precision i.e., 80-bits (default state)

0 commit comments

Comments
 (0)