@@ -1630,10 +1630,14 @@ pub fn ptr_mask<T>(_ptr: *const T, _mask: usize) -> *const T;
16301630/// a size of `count` * `size_of::<T>()` and an alignment of
16311631/// `min_align_of::<T>()`
16321632///
1633- /// The volatile parameter is set to `true`, so it will not be optimized out
1634- /// unless size is equal to zero.
1635- ///
16361633/// This intrinsic does not have a stable counterpart.
1634+ /// # Safety
1635+ ///
1636+ /// The safety requirements are consistent with [`copy_nonoverlapping`]
1637+ /// while the read and write behaviors are volatile,
1638+ /// which means it will not be optimized out unless size is equal to zero.
1639+ ///
1640+ /// [`copy_nonoverlapping`]: ptr::copy_nonoverlapping
16371641#[ rustc_intrinsic]
16381642#[ rustc_nounwind]
16391643pub unsafe fn volatile_copy_nonoverlapping_memory < T > ( _dst : * mut T , _src : * const T , _count : usize ) ;
@@ -1652,10 +1656,13 @@ pub unsafe fn volatile_copy_memory<T>(_dst: *mut T, _src: *const T, _count: usiz
16521656/// size of `count * size_of::<T>()` and an alignment of
16531657/// `min_align_of::<T>()`.
16541658///
1655- /// The volatile parameter is set to `true`, so it will not be optimized out
1656- /// unless size is equal to zero.
1657- ///
16581659/// This intrinsic does not have a stable counterpart.
1660+ /// # Safety
1661+ ///
1662+ /// The safety requirements are consistent with [`write_bytes`] while the write behavior is volatile,
1663+ /// which means it will not be optimized out unless size is equal to zero.
1664+ ///
1665+ /// [`write_bytes`]: ptr::write_bytes
16591666#[ rustc_intrinsic]
16601667#[ rustc_nounwind]
16611668pub unsafe fn volatile_set_memory < T > ( _dst : * mut T , _val : u8 , _count : usize ) ;
@@ -3197,8 +3204,18 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
31973204/// The stabilized form of this intrinsic is [`crate::mem::swap`].
31983205///
31993206/// # Safety
3207+ /// Behavior is undefined if any of the following conditions are violated:
3208+ ///
3209+ /// * Both `x` and `y` must be [valid] for both reads and writes.
32003210///
3201- /// `x` and `y` are readable and writable as `T`, and non-overlapping.
3211+ /// * Both `x` and `y` must be properly aligned.
3212+ ///
3213+ /// * The region of memory beginning at `x` must *not* overlap with the region of memory
3214+ /// beginning at `y`.
3215+ ///
3216+ /// * The memory pointed by `x` and `y` must contain correct value of type `T`.
3217+ ///
3218+ /// [valid]: crate::ptr#safety
32023219#[ rustc_nounwind]
32033220#[ inline]
32043221#[ rustc_intrinsic]
0 commit comments