From 63dd00b97b0f46e901af7d9299534c2e66f311b1 Mon Sep 17 00:00:00 2001 From: mbartlett21 <29034492+mbartlett21@users.noreply.github.com> Date: Tue, 5 Jan 2021 17:27:10 +1000 Subject: [PATCH] Add code spans to docs in intrinsics.rs --- library/core/src/intrinsics.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 938dc214486a6..2225339d27d60 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -712,8 +712,8 @@ extern "rust-intrinsic" { /// [`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 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. pub fn volatile_copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: usize); /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with - /// a size of `count` * `size_of::()` and an alignment of + /// a size of `count * size_of::()` and an alignment of /// `min_align_of::()` /// /// The volatile parameter is set to `true`, so it will not be optimized out @@ -1142,7 +1142,7 @@ extern "rust-intrinsic" { /// This intrinsic does not have a stable counterpart. pub fn volatile_copy_memory(dst: *mut T, src: *const T, count: usize); /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a - /// size of `count` * `size_of::()` and an alignment of + /// size of `count * size_of::()` and an alignment of /// `min_align_of::()`. /// /// The volatile parameter is set to `true`, so it will not be optimized out @@ -1588,7 +1588,7 @@ extern "rust-intrinsic" { pub fn exact_div(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 @@ extern "rust-intrinsic" { #[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")] pub fn unchecked_div(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 @@ extern "rust-intrinsic" { pub fn unchecked_rem(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 @@ extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")] pub fn unchecked_shl(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 @@ extern "rust-intrinsic" { #[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")] pub fn wrapping_mul(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(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 @@ extern "rust-intrinsic" { pub fn saturating_sub(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(v: &T) -> ::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")]