Skip to content

Commit eb475b0

Browse files
Document stable versions of memory-related intrinsics
1 parent 216f100 commit eb475b0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/libcore/intrinsics.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,15 @@ extern "rust-intrinsic" {
855855
/// Moves a value to an uninitialized memory location.
856856
///
857857
/// Drop glue is not run on the destination.
858+
///
859+
/// The stabilized version of this intrinsic is
860+
/// [`std::ptr::write`](../../std/ptr/fn.write.html).
858861
pub fn move_val_init<T>(dst: *mut T, src: T);
859862

863+
/// The minimum alignment of a type.
864+
///
865+
/// The stabilized version of this intrinsic is
866+
/// [`std::mem::align_of`](../../std/mem/fn.align_of.html).
860867
#[rustc_const_stable(feature = "const_min_align_of", since = "1.40.0")]
861868
pub fn min_align_of<T>() -> usize;
862869
#[rustc_const_unstable(feature = "const_pref_align_of", issue = "none")]
@@ -867,6 +874,10 @@ extern "rust-intrinsic" {
867874
/// The stabilized version of this intrinsic is
868875
/// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
869876
pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
877+
/// The minimum alignment of the type of the value that `val` points to.
878+
///
879+
/// The stabilized version of this intrinsic is
880+
/// [`std::mem::min_align_of_val`](../../std/mem/fn.min_align_of_val.html).
870881
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
871882

872883
/// Gets a static string slice containing the name of a type.
@@ -897,6 +908,9 @@ extern "rust-intrinsic" {
897908
/// which is unsafe unless `T` is `Copy`. Also, even if T is
898909
/// `Copy`, an all-zero value may not correspond to any legitimate
899910
/// state for the type in question.
911+
///
912+
/// The stabilized version of this intrinsic is
913+
/// [`std::mem::zeroed`](../../std/mem/fn.zeroed.html).
900914
#[unstable(
901915
feature = "core_intrinsics",
902916
reason = "intrinsics are unlikely to ever be stabilized, instead \
@@ -914,6 +928,9 @@ extern "rust-intrinsic" {
914928
/// state, which means it may claim either dropped or
915929
/// undropped. In the general case one must use `ptr::write` to
916930
/// initialize memory previous set to the result of `uninit`.
931+
///
932+
/// The stabilized version of this intrinsic is
933+
/// [`std::mem::MaybeUninit`](../../std/mem/union.MaybeUninit.html).
917934
#[unstable(
918935
feature = "core_intrinsics",
919936
reason = "intrinsics are unlikely to ever be stabilized, instead \
@@ -1159,6 +1176,9 @@ extern "rust-intrinsic" {
11591176
/// byte past the end of an allocated object. If either pointer is out of
11601177
/// bounds or arithmetic overflow occurs then any further use of the
11611178
/// returned value will result in undefined behavior.
1179+
///
1180+
/// The stabilized version of this intrinsic is
1181+
/// [`std::pointer::offset`](../../std/primitive.pointer.html#method.offset).
11621182
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
11631183

11641184
/// Calculates the offset from a pointer, potentially wrapping.
@@ -1172,6 +1192,9 @@ extern "rust-intrinsic" {
11721192
/// resulting pointer to point into or one byte past the end of an allocated
11731193
/// object, and it wraps with two's complement arithmetic. The resulting
11741194
/// value is not necessarily valid to be used to actually access memory.
1195+
///
1196+
/// The stabilized version of this intrinsic is
1197+
/// [`std::pointer::wrapping_offset`](../../std/primitive.pointer.html#method.wrapping_offset).
11751198
pub fn arith_offset<T>(dst: *const T, offset: isize) -> *const T;
11761199

11771200
/// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with
@@ -1626,6 +1649,8 @@ extern "rust-intrinsic" {
16261649

16271650
/// Returns the value of the discriminant for the variant in 'v',
16281651
/// cast to a `u64`; if `T` has no discriminant, returns 0.
1652+
/// The stabilized version of this intrinsic is
1653+
/// [`std::mem::discriminant`](../../std/mem/fn.discriminant.html)
16291654
pub fn discriminant_value<T>(v: &T) -> u64;
16301655

16311656
/// Rust's "try catch" construct which invokes the function pointer `f` with

0 commit comments

Comments
 (0)