Skip to content

Commit c370618

Browse files
Document stable versions of number-related intrinsics
1 parent eb475b0 commit c370618

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

src/libcore/intrinsics.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,14 +1438,21 @@ extern "rust-intrinsic" {
14381438
pub fn frem_fast<T>(a: T, b: T) -> T;
14391439

14401440
/// Convert with LLVM’s fptoui/fptosi, which may return undef for values out of range
1441-
/// https://github.com/rust-lang/rust/issues/10184
1441+
/// (<https://github.com/rust-lang/rust/issues/10184>)
1442+
/// This is under stabilization at <https://github.com/rust-lang/rust/issues/67058>
14421443
pub fn float_to_int_approx_unchecked<Float, Int>(value: Float) -> Int;
14431444

14441445
/// Returns the number of bits set in an integer type `T`
1446+
/// The stabilized versions of this intrinsic are available on the integer
1447+
/// primitives via the `count_ones` method. For example,
1448+
/// [`std::u32::count_ones`](../../std/primitive.u32.html#method.count_ones)
14451449
#[rustc_const_stable(feature = "const_ctpop", since = "1.40.0")]
14461450
pub fn ctpop<T>(x: T) -> T;
14471451

14481452
/// Returns the number of leading unset bits (zeroes) in an integer type `T`.
1453+
/// The stabilized versions of this intrinsic are available on the integer
1454+
/// primitives via the `leading_zeros` method. For example,
1455+
/// [`std::u32::leading_zeros`](../../std/primitive.u32.html#method.leading_zeros)
14491456
///
14501457
/// # Examples
14511458
///
@@ -1491,6 +1498,9 @@ extern "rust-intrinsic" {
14911498
pub fn ctlz_nonzero<T>(x: T) -> T;
14921499

14931500
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
1501+
/// The stabilized versions of this intrinsic are available on the integer
1502+
/// primitives via the `trailing_zeros` method. For example,
1503+
/// [`std::u32::trailing_zeros`](../../std/primitive.u32.html#method.trailing_zeros)
14941504
///
14951505
/// # Examples
14961506
///
@@ -1536,10 +1546,16 @@ extern "rust-intrinsic" {
15361546
pub fn cttz_nonzero<T>(x: T) -> T;
15371547

15381548
/// Reverses the bytes in an integer type `T`.
1549+
/// The stabilized versions of this intrinsic are available on the integer
1550+
/// primitives via the `swap_bytes` method. For example,
1551+
/// [`std::u32::swap_bytes`](../../std/primitive.u32.html#method.swap_bytes)
15391552
#[rustc_const_stable(feature = "const_bswap", since = "1.40.0")]
15401553
pub fn bswap<T>(x: T) -> T;
15411554

15421555
/// Reverses the bits in an integer type `T`.
1556+
/// The stabilized versions of this intrinsic are available on the integer
1557+
/// primitives via the `reverse_bits` method. For example,
1558+
/// [`std::u32::reverse_bits`](../../std/primitive.u32.html#method.reverse_bits)
15431559
#[rustc_const_stable(feature = "const_bitreverse", since = "1.40.0")]
15441560
pub fn bitreverse<T>(x: T) -> T;
15451561

@@ -1569,20 +1585,34 @@ extern "rust-intrinsic" {
15691585
pub fn exact_div<T>(x: T, y: T) -> T;
15701586

15711587
/// Performs an unchecked division, resulting in undefined behavior
1572-
/// where y = 0 or x = `T::min_value()` and y = -1
1588+
/// where y = 0 or x = `T::min_value()` and y = -1.
1589+
///
1590+
/// The stabilized versions of this intrinsic are available on the integer
1591+
/// primitives via the `checked_div` method. For example,
1592+
/// [`std::u32::checked_div`](../../std/primitive.u32.html#method.checked_div)
15731593
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
15741594
pub fn unchecked_div<T>(x: T, y: T) -> T;
15751595
/// Returns the remainder of an unchecked division, resulting in
15761596
/// undefined behavior where y = 0 or x = `T::min_value()` and y = -1
1597+
///
1598+
/// The stabilized versions of this intrinsic are available on the integer
1599+
/// primitives via the `checked_rem` method. For example,
1600+
/// [`std::u32::checked_rem`](../../std/primitive.u32.html#method.checked_rem)
15771601
#[rustc_const_unstable(feature = "const_int_unchecked_arith", issue = "none")]
15781602
pub fn unchecked_rem<T>(x: T, y: T) -> T;
15791603

15801604
/// Performs an unchecked left shift, resulting in undefined behavior when
15811605
/// y < 0 or y >= N, where N is the width of T in bits.
1606+
/// The stabilized versions of this intrinsic are available on the integer
1607+
/// primitives via the `wrapping_shl` method. For example,
1608+
/// [`std::u32::wrapping_shl`](../../std/primitive.u32.html#method.wrapping_shl)
15821609
#[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")]
15831610
pub fn unchecked_shl<T>(x: T, y: T) -> T;
15841611
/// Performs an unchecked right shift, resulting in undefined behavior when
15851612
/// y < 0 or y >= N, where N is the width of T in bits.
1613+
/// The stabilized versions of this intrinsic are available on the integer
1614+
/// primitives via the `wrapping_shr` method. For example,
1615+
/// [`std::u32::wrapping_shr`](../../std/primitive.u32.html#method.wrapping_shr)
15861616
#[rustc_const_stable(feature = "const_int_unchecked", since = "1.40.0")]
15871617
pub fn unchecked_shr<T>(x: T, y: T) -> T;
15881618

0 commit comments

Comments
 (0)