1
Fork 0

Fix doc nits

Many tiny changes to stdlib doc comments to make them consistent (for example
"Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph
breaks, backticks for monospace style, and other minor nits.

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
This commit is contained in:
John Arundel 2024-07-15 12:26:30 +01:00
parent 83d67685ac
commit a19472a93e
146 changed files with 808 additions and 738 deletions

View file

@ -137,7 +137,7 @@ where
T: MaskElement,
LaneCount<N>: SupportedLaneCount,
{
/// Construct a mask by setting all elements to the given value.
/// Constructs a mask by setting all elements to the given value.
#[inline]
pub fn splat(value: bool) -> Self {
Self(mask_impl::Mask::splat(value))
@ -288,7 +288,7 @@ where
self.0.all()
}
/// Create a bitmask from a mask.
/// Creates a bitmask from a mask.
///
/// Each bit is set if the corresponding element in the mask is `true`.
/// If the mask contains more than 64 elements, the bitmask is truncated to the first 64.
@ -298,7 +298,7 @@ where
self.0.to_bitmask_integer()
}
/// Create a mask from a bitmask.
/// Creates a mask from a bitmask.
///
/// For each bit, if it is set, the corresponding element in the mask is set to `true`.
/// If the mask contains more than 64 elements, the remainder are set to `false`.
@ -308,7 +308,7 @@ where
Self(mask_impl::Mask::from_bitmask_integer(bitmask))
}
/// Create a bitmask vector from a mask.
/// Creates a bitmask vector from a mask.
///
/// Each bit is set if the corresponding element in the mask is `true`.
/// The remaining bits are unset.
@ -328,7 +328,7 @@ where
self.0.to_bitmask_vector()
}
/// Create a mask from a bitmask vector.
/// Creates a mask from a bitmask vector.
///
/// For each bit, if it is set, the corresponding element in the mask is set to `true`.
///
@ -350,7 +350,7 @@ where
Self(mask_impl::Mask::from_bitmask_vector(bitmask))
}
/// Find the index of the first set element.
/// Finds the index of the first set element.
///
/// ```
/// # #![feature(portable_simd)]

View file

@ -54,7 +54,7 @@ pub trait SimdConstPtr: Copy + Sealed {
/// [`Self::with_exposed_provenance`] and returns the "address" portion.
fn expose_provenance(self) -> Self::Usize;
/// Convert an address back to a pointer, picking up a previously "exposed" provenance.
/// Converts an address back to a pointer, picking up a previously "exposed" provenance.
///
/// Equivalent to calling [`core::ptr::with_exposed_provenance`] on each element.
fn with_exposed_provenance(addr: Self::Usize) -> Self;

View file

@ -51,7 +51,7 @@ pub trait SimdMutPtr: Copy + Sealed {
/// [`Self::with_exposed_provenance`] and returns the "address" portion.
fn expose_provenance(self) -> Self::Usize;
/// Convert an address back to a pointer, picking up a previously "exposed" provenance.
/// Converts an address back to a pointer, picking up a previously "exposed" provenance.
///
/// Equivalent to calling [`core::ptr::with_exposed_provenance_mut`] on each element.
fn with_exposed_provenance(addr: Self::Usize) -> Self;

View file

@ -69,12 +69,12 @@ pub macro simd_swizzle {
}
}
/// Create a vector from the elements of another vector.
/// Creates a vector from the elements of another vector.
pub trait Swizzle<const N: usize> {
/// Map from the elements of the input vector to the output vector.
const INDEX: [usize; N];
/// Create a new vector from the elements of `vector`.
/// Creates a new vector from the elements of `vector`.
///
/// Lane `i` of the output is `vector[Self::INDEX[i]]`.
#[inline]
@ -109,7 +109,7 @@ pub trait Swizzle<const N: usize> {
}
}
/// Create a new vector from the elements of `first` and `second`.
/// Creates a new vector from the elements of `first` and `second`.
///
/// Lane `i` of the output is `concat[Self::INDEX[i]]`, where `concat` is the concatenation of
/// `first` and `second`.
@ -145,7 +145,7 @@ pub trait Swizzle<const N: usize> {
}
}
/// Create a new mask from the elements of `mask`.
/// Creates a new mask from the elements of `mask`.
///
/// Element `i` of the output is `concat[Self::INDEX[i]]`, where `concat` is the concatenation of
/// `first` and `second`.
@ -161,7 +161,7 @@ pub trait Swizzle<const N: usize> {
unsafe { Mask::from_int_unchecked(Self::swizzle(mask.to_int())) }
}
/// Create a new mask from the elements of `first` and `second`.
/// Creates a new mask from the elements of `first` and `second`.
///
/// Element `i` of the output is `concat[Self::INDEX[i]]`, where `concat` is the concatenation of
/// `first` and `second`.

View file

@ -10,7 +10,7 @@ mod sealed {
}
use sealed::Sealed;
/// Convert SIMD vectors to vectors of bytes
/// Converts SIMD vectors to vectors of bytes
pub trait ToBytes: Sealed {
/// This type, reinterpreted as bytes.
type Bytes: Copy
@ -22,26 +22,26 @@ pub trait ToBytes: Sealed {
+ SimdUint<Scalar = u8>
+ 'static;
/// Return the memory representation of this integer as a byte array in native byte
/// Returns the memory representation of this integer as a byte array in native byte
/// order.
fn to_ne_bytes(self) -> Self::Bytes;
/// Return the memory representation of this integer as a byte array in big-endian
/// Returns the memory representation of this integer as a byte array in big-endian
/// (network) byte order.
fn to_be_bytes(self) -> Self::Bytes;
/// Return the memory representation of this integer as a byte array in little-endian
/// Returns the memory representation of this integer as a byte array in little-endian
/// byte order.
fn to_le_bytes(self) -> Self::Bytes;
/// Create a native endian integer value from its memory representation as a byte array
/// Creates a native endian integer value from its memory representation as a byte array
/// in native endianness.
fn from_ne_bytes(bytes: Self::Bytes) -> Self;
/// Create an integer value from its representation as a byte array in big endian.
/// Creates an integer value from its representation as a byte array in big endian.
fn from_be_bytes(bytes: Self::Bytes) -> Self;
/// Create an integer value from its representation as a byte array in little endian.
/// Creates an integer value from its representation as a byte array in little endian.
fn from_le_bytes(bytes: Self::Bytes) -> Self;
}

View file

@ -187,7 +187,7 @@ where
unsafe { &mut *(self as *mut Self as *mut [T; N]) }
}
/// Load a vector from an array of `T`.
/// Loads a vector from an array of `T`.
///
/// This function is necessary since `repr(simd)` has padding for non-power-of-2 vectors (at the time of writing).
/// With padding, `read_unaligned` will read past the end of an array of N elements.
@ -567,7 +567,7 @@ where
unsafe { Self::gather_select_ptr(ptrs, enable, or) }
}
/// Read elementwise from pointers into a SIMD vector.
/// Reads elementwise from pointers into a SIMD vector.
///
/// # Safety
///
@ -808,7 +808,7 @@ where
}
}
/// Write pointers elementwise into a SIMD vector.
/// Writes pointers elementwise into a SIMD vector.
///
/// # Safety
///