Auto merge of #80717 - mbartlett21:patch-2, r=dtolnay
Add more code spans to docs in intrinsics.rs I have added some more code spans in core/src/intrinsics.rs, changing some `=` to `==`, etc. I also changed the wording in some sections.
This commit is contained in:
commit
3b63e16552
@ -712,8 +712,8 @@
|
||||
/// [`std::process::abort`](../../std/process/fn.abort.html).
|
||||
pub fn abort() -> !;
|
||||
|
||||
/// Tells LLVM that this point in the code is not reachable, enabling
|
||||
/// further optimizations.
|
||||
/// Informs the optimizer that this point in the code is not reachable,
|
||||
/// enabling further optimizations.
|
||||
///
|
||||
/// N.B., this is very different from the `unreachable!()` macro: Unlike the
|
||||
/// macro, which panics when it is executed, it is *undefined behavior* to
|
||||
@ -1133,7 +1133,7 @@
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
pub fn volatile_copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: usize);
|
||||
/// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with
|
||||
/// a size of `count` * `size_of::<T>()` and an alignment of
|
||||
/// a size of `count * size_of::<T>()` and an alignment of
|
||||
/// `min_align_of::<T>()`
|
||||
///
|
||||
/// The volatile parameter is set to `true`, so it will not be optimized out
|
||||
@ -1142,7 +1142,7 @@
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
pub fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize);
|
||||
/// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a
|
||||
/// size of `count` * `size_of::<T>()` and an alignment of
|
||||
/// size of `count * size_of::<T>()` and an alignment of
|
||||
/// `min_align_of::<T>()`.
|
||||
///
|
||||
/// The volatile parameter is set to `true`, so it will not be optimized out
|
||||
@ -1588,7 +1588,7 @@
|
||||
pub fn exact_div<T: Copy>(x: T, y: T) -> T;
|
||||
|
||||
/// Performs an unchecked division, resulting in undefined behavior
|
||||
/// where y = 0 or x = `T::MIN` and y = -1
|
||||
/// where `y == 0` or `x == T::MIN && y == -1`
|
||||
///
|
||||
/// Safe wrappers for this intrinsic are available on the integer
|
||||
/// primitives via the `checked_div` method. For example,
|
||||
@ -1596,7 +1596,7 @@
|
||||
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
|
||||
pub fn unchecked_div<T: Copy>(x: T, y: T) -> T;
|
||||
/// Returns the remainder of an unchecked division, resulting in
|
||||
/// undefined behavior where y = 0 or x = `T::MIN` and y = -1
|
||||
/// undefined behavior when `y == 0` or `x == T::MIN && y == -1`
|
||||
///
|
||||
/// Safe wrappers for this intrinsic are available on the integer
|
||||
/// primitives via the `checked_rem` method. For example,
|
||||
@ -1605,7 +1605,7 @@
|
||||
pub fn unchecked_rem<T: Copy>(x: T, y: T) -> T;
|
||||
|
||||
/// Performs an unchecked left shift, resulting in undefined behavior when
|
||||
/// y < 0 or y >= N, where N is the width of T in bits.
|
||||
/// `y < 0` or `y >= N`, where N is the width of T in bits.
|
||||
///
|
||||
/// Safe wrappers for this intrinsic are available on the integer
|
||||
/// primitives via the `checked_shl` method. For example,
|
||||
@ -1613,7 +1613,7 @@
|
||||
#[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")]
|
||||
pub fn unchecked_shl<T: Copy>(x: T, y: T) -> T;
|
||||
/// Performs an unchecked right shift, resulting in undefined behavior when
|
||||
/// y < 0 or y >= N, where N is the width of T in bits.
|
||||
/// `y < 0` or `y >= N`, where N is the width of T in bits.
|
||||
///
|
||||
/// Safe wrappers for this intrinsic are available on the integer
|
||||
/// primitives via the `checked_shr` method. For example,
|
||||
@ -1680,14 +1680,14 @@
|
||||
#[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")]
|
||||
pub fn wrapping_mul<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Computes `a + b`, while saturating at numeric bounds.
|
||||
/// Computes `a + b`, saturating at numeric bounds.
|
||||
///
|
||||
/// The stabilized versions of this intrinsic are available on the integer
|
||||
/// primitives via the `saturating_add` method. For example,
|
||||
/// [`u32::saturating_add`]
|
||||
#[rustc_const_stable(feature = "const_int_saturating", since = "1.40.0")]
|
||||
pub fn saturating_add<T: Copy>(a: T, b: T) -> T;
|
||||
/// Computes `a - b`, while saturating at numeric bounds.
|
||||
/// Computes `a - b`, saturating at numeric bounds.
|
||||
///
|
||||
/// The stabilized versions of this intrinsic are available on the integer
|
||||
/// primitives via the `saturating_sub` method. For example,
|
||||
@ -1696,14 +1696,14 @@
|
||||
pub fn saturating_sub<T: Copy>(a: T, b: T) -> T;
|
||||
|
||||
/// Returns the value of the discriminant for the variant in 'v',
|
||||
/// cast to a `u64`; if `T` has no discriminant, returns 0.
|
||||
/// cast to a `u64`; if `T` has no discriminant, returns `0`.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is [`core::mem::discriminant`](crate::mem::discriminant).
|
||||
#[rustc_const_unstable(feature = "const_discriminant", issue = "69821")]
|
||||
pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant;
|
||||
|
||||
/// Returns the number of variants of the type `T` cast to a `usize`;
|
||||
/// if `T` has no variants, returns 0. Uninhabited variants will be counted.
|
||||
/// if `T` has no variants, returns `0`. Uninhabited variants will be counted.
|
||||
///
|
||||
/// The to-be-stabilized version of this intrinsic is [`mem::variant_count`].
|
||||
#[rustc_const_unstable(feature = "variant_count", issue = "73662")]
|
||||
|
Loading…
Reference in New Issue
Block a user