@@ -1623,10 +1623,14 @@ pub fn ptr_mask<T>(ptr: *const T, mask: usize) -> *const T;
16231623/// a size of `count` * `size_of::<T>()` and an alignment of
16241624/// `min_align_of::<T>()`
16251625///
1626- /// The volatile parameter is set to `true`, so it will not be optimized out
1627- /// unless size is equal to zero.
1628- ///
16291626/// This intrinsic does not have a stable counterpart.
1627+ /// # Safety
1628+ ///
1629+ /// The safety requirements are consistent with [`copy_nonoverlapping`]
1630+ /// while the read and write behaviors are volatile,
1631+ /// which means it will not be optimized out unless size is equal to zero.
1632+ ///
1633+ /// [`copy_nonoverlapping`]: ptr::copy_nonoverlapping
16301634#[ rustc_intrinsic]
16311635#[ rustc_nounwind]
16321636pub unsafe fn volatile_copy_nonoverlapping_memory < T > ( dst : * mut T , src : * const T , count : usize ) ;
@@ -1645,10 +1649,13 @@ pub unsafe fn volatile_copy_memory<T>(dst: *mut T, src: *const T, count: usize);
16451649/// size of `count * size_of::<T>()` and an alignment of
16461650/// `min_align_of::<T>()`.
16471651///
1648- /// The volatile parameter is set to `true`, so it will not be optimized out
1649- /// unless size is equal to zero.
1650- ///
16511652/// This intrinsic does not have a stable counterpart.
1653+ /// # Safety
1654+ ///
1655+ /// The safety requirements are consistent with [`write_bytes`] while the write behavior is volatile,
1656+ /// which means it will not be optimized out unless size is equal to zero.
1657+ ///
1658+ /// [`write_bytes`]: ptr::write_bytes
16521659#[ rustc_intrinsic]
16531660#[ rustc_nounwind]
16541661pub unsafe fn volatile_set_memory < T > ( dst : * mut T , val : u8 , count : usize ) ;
@@ -3190,8 +3197,18 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
31903197/// The stabilized form of this intrinsic is [`crate::mem::swap`].
31913198///
31923199/// # Safety
3200+ /// Behavior is undefined if any of the following conditions are violated:
3201+ ///
3202+ /// * Both `x` and `y` must be [valid] for both reads and writes.
31933203///
3194- /// `x` and `y` are readable and writable as `T`, and non-overlapping.
3204+ /// * Both `x` and `y` must be properly aligned.
3205+ ///
3206+ /// * The region of memory beginning at `x` must *not* overlap with the region of memory
3207+ /// beginning at `y`.
3208+ ///
3209+ /// * The memory pointed by `x` and `y` must contain correct value of type `T`.
3210+ ///
3211+ /// [valid]: crate::ptr#safety
31953212#[ rustc_nounwind]
31963213#[ inline]
31973214#[ rustc_intrinsic]
0 commit comments