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.
This commit is contained in:
commit
e0eb63a73c
35 changed files with 71 additions and 71 deletions
|
@ -109,8 +109,8 @@ impl<T, const N: usize> IntoIter<T, N> {
|
|||
/// use std::array::IntoIter;
|
||||
/// use std::mem::MaybeUninit;
|
||||
///
|
||||
/// # // Hi! Thanks for reading the code. This is restricted to `Copy` because
|
||||
/// # // otherwise it could leak. A fully-general version this would need a drop
|
||||
/// # // Hi! Thanks for reading the code. This is restricted to `Copy` because
|
||||
/// # // otherwise it could leak. A fully-general version this would need a drop
|
||||
/// # // guard to handle panics from the iterator, but this works for an example.
|
||||
/// fn next_chunk<T: Copy, const N: usize>(
|
||||
/// it: &mut impl Iterator<Item = T>,
|
||||
|
@ -211,7 +211,7 @@ impl<T, const N: usize> IntoIter<T, N> {
|
|||
let initialized = 0..0;
|
||||
|
||||
// SAFETY: We're telling it that none of the elements are initialized,
|
||||
// which is trivially true. And ∀N: usize, 0 <= N.
|
||||
// which is trivially true. And ∀N: usize, 0 <= N.
|
||||
unsafe { Self::new_unchecked(buffer, initialized) }
|
||||
}
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ impl<A: Step> Iterator for ops::Range<A> {
|
|||
where
|
||||
Self: TrustedRandomAccessNoCoerce,
|
||||
{
|
||||
// SAFETY: The TrustedRandomAccess contract requires that callers only pass an index
|
||||
// SAFETY: The TrustedRandomAccess contract requires that callers only pass an index
|
||||
// that is in bounds.
|
||||
// Additionally Self: TrustedRandomAccess is only implemented for Copy types
|
||||
// which means even repeated reads of the same index would be safe.
|
||||
|
|
|
@ -26,7 +26,7 @@ mod fpu_precision {
|
|||
/// Developer's Manual (Volume 1).
|
||||
///
|
||||
/// The only field which is relevant for the following code is PC, Precision Control. This
|
||||
/// field determines the precision of the operations performed by the FPU. It can be set to:
|
||||
/// field determines the precision of the operations performed by the FPU. It can be set to:
|
||||
/// - 0b00, single precision i.e., 32-bits
|
||||
/// - 0b10, double precision i.e., 64-bits
|
||||
/// - 0b11, double extended precision i.e., 80-bits (default state)
|
||||
|
|
|
@ -1538,7 +1538,7 @@ macro_rules! int_impl {
|
|||
///
|
||||
/// ```
|
||||
/// #![feature(bigint_helper_methods)]
|
||||
/// // Only the most significant word is signed.
|
||||
/// // Only the most significant word is signed.
|
||||
/// //
|
||||
#[doc = concat!("// 10 MAX (a = 10 × 2^", stringify!($BITS), " + 2^", stringify!($BITS), " - 1)")]
|
||||
#[doc = concat!("// + -5 9 (b = -5 × 2^", stringify!($BITS), " + 9)")]
|
||||
|
@ -1646,7 +1646,7 @@ macro_rules! int_impl {
|
|||
///
|
||||
/// ```
|
||||
/// #![feature(bigint_helper_methods)]
|
||||
/// // Only the most significant word is signed.
|
||||
/// // Only the most significant word is signed.
|
||||
/// //
|
||||
#[doc = concat!("// 6 8 (a = 6 × 2^", stringify!($BITS), " + 8)")]
|
||||
#[doc = concat!("// - -5 9 (b = -5 × 2^", stringify!($BITS), " + 9)")]
|
||||
|
|
|
@ -753,7 +753,7 @@ impl<P: DerefMut> Pin<P> {
|
|||
impl<'a, T: ?Sized> Pin<&'a T> {
|
||||
/// Constructs a new pin by mapping the interior value.
|
||||
///
|
||||
/// For example, if you wanted to get a `Pin` of a field of something,
|
||||
/// For example, if you wanted to get a `Pin` of a field of something,
|
||||
/// you could use this to get access to that field in one line of code.
|
||||
/// However, there are several gotchas with these "pinning projections";
|
||||
/// see the [`pin` module] documentation for further details on that topic.
|
||||
|
@ -856,7 +856,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
|
|||
|
||||
/// Construct a new pin by mapping the interior value.
|
||||
///
|
||||
/// For example, if you wanted to get a `Pin` of a field of something,
|
||||
/// For example, if you wanted to get a `Pin` of a field of something,
|
||||
/// you could use this to get access to that field in one line of code.
|
||||
/// However, there are several gotchas with these "pinning projections";
|
||||
/// see the [`pin` module] documentation for further details on that topic.
|
||||
|
|
|
@ -1701,7 +1701,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
|
|||
// offset is not a multiple of `stride`, the input pointer was misaligned and no pointer
|
||||
// offset will be able to produce a `p` aligned to the specified `a`.
|
||||
//
|
||||
// The naive `-p (mod a)` equation inhibits LLVM's ability to select instructions
|
||||
// The naive `-p (mod a)` equation inhibits LLVM's ability to select instructions
|
||||
// like `lea`. We compute `(round_up_to_next_alignment(p, a) - p)` instead. This
|
||||
// redistributes operations around the load-bearing, but pessimizing `and` instruction
|
||||
// sufficiently for LLVM to be able to utilize the various optimizations it knows about.
|
||||
|
|
|
@ -65,7 +65,7 @@ fn size_from_ptr<T>(_: *const T) -> usize {
|
|||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct Iter<'a, T: 'a> {
|
||||
ptr: NonNull<T>,
|
||||
end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
|
||||
end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
|
||||
// ptr == end is a quick test for the Iterator being empty, that works
|
||||
// for both ZST and non-ZST.
|
||||
_marker: PhantomData<&'a T>,
|
||||
|
@ -186,7 +186,7 @@ impl<T> AsRef<[T]> for Iter<'_, T> {
|
|||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct IterMut<'a, T: 'a> {
|
||||
ptr: NonNull<T>,
|
||||
end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
|
||||
end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
|
||||
// ptr == end is a quick test for the Iterator being empty, that works
|
||||
// for both ZST and non-ZST.
|
||||
_marker: PhantomData<&'a mut T>,
|
||||
|
|
|
@ -23,7 +23,7 @@ macro_rules! len {
|
|||
$self.end.addr().wrapping_sub(start.as_ptr().addr())
|
||||
} else {
|
||||
// We know that `start <= end`, so can do better than `offset_from`,
|
||||
// which needs to deal in signed. By setting appropriate flags here
|
||||
// which needs to deal in signed. By setting appropriate flags here
|
||||
// we can tell LLVM this, which helps it remove bounds checks.
|
||||
// SAFETY: By the type invariant, `start <= end`
|
||||
let diff = unsafe { unchecked_sub($self.end.addr(), start.as_ptr().addr()) };
|
||||
|
|
|
@ -703,7 +703,7 @@ impl<T> [T] {
|
|||
|
||||
// Because this function is first compiled in isolation,
|
||||
// this check tells LLVM that the indexing below is
|
||||
// in-bounds. Then after inlining -- once the actual
|
||||
// in-bounds. Then after inlining -- once the actual
|
||||
// lengths of the slices are known -- it's removed.
|
||||
let (a, b) = (&mut a[..n], &mut b[..n]);
|
||||
|
||||
|
@ -1248,7 +1248,7 @@ impl<T> [T] {
|
|||
ArrayChunksMut::new(self)
|
||||
}
|
||||
|
||||
/// Returns an iterator over overlapping windows of `N` elements of a slice,
|
||||
/// Returns an iterator over overlapping windows of `N` elements of a slice,
|
||||
/// starting at the beginning of the slice.
|
||||
///
|
||||
/// This is the const generic equivalent of [`windows`].
|
||||
|
@ -2476,7 +2476,7 @@ impl<T> [T] {
|
|||
let mid = left + size / 2;
|
||||
|
||||
// SAFETY: the while condition means `size` is strictly positive, so
|
||||
// `size/2 < size`. Thus `left + size/2 < left + size`, which
|
||||
// `size/2 < size`. Thus `left + size/2 < left + size`, which
|
||||
// coupled with the `left + size <= self.len()` invariant means
|
||||
// we have `left + size/2 < self.len()`, and this is in-bounds.
|
||||
let cmp = f(unsafe { self.get_unchecked(mid) });
|
||||
|
|
|
@ -18,9 +18,9 @@ struct CopyOnDrop<T> {
|
|||
|
||||
impl<T> Drop for CopyOnDrop<T> {
|
||||
fn drop(&mut self) {
|
||||
// SAFETY: This is a helper class.
|
||||
// Please refer to its usage for correctness.
|
||||
// Namely, one must be sure that `src` and `dst` does not overlap as required by `ptr::copy_nonoverlapping`.
|
||||
// SAFETY: This is a helper class.
|
||||
// Please refer to its usage for correctness.
|
||||
// Namely, one must be sure that `src` and `dst` does not overlap as required by `ptr::copy_nonoverlapping`.
|
||||
unsafe {
|
||||
ptr::copy_nonoverlapping(self.src, self.dest, 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue