@@ -1630,10 +1630,14 @@ pub fn ptr_mask<T>(_ptr: *const T, _mask: usize) -> *const T;
1630
1630
/// a size of `count` * `size_of::<T>()` and an alignment of
1631
1631
/// `min_align_of::<T>()`
1632
1632
///
1633
- /// The volatile parameter is set to `true`, so it will not be optimized out
1634
- /// unless size is equal to zero.
1635
- ///
1636
1633
/// 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
1637
1641
#[ rustc_intrinsic]
1638
1642
#[ rustc_nounwind]
1639
1643
pub 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
1652
1656
/// size of `count * size_of::<T>()` and an alignment of
1653
1657
/// `min_align_of::<T>()`.
1654
1658
///
1655
- /// The volatile parameter is set to `true`, so it will not be optimized out
1656
- /// unless size is equal to zero.
1657
- ///
1658
1659
/// 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
1659
1666
#[ rustc_intrinsic]
1660
1667
#[ rustc_nounwind]
1661
1668
pub 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 {
3197
3204
/// The stabilized form of this intrinsic is [`crate::mem::swap`].
3198
3205
///
3199
3206
/// # 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.
3200
3210
///
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
3202
3219
#[ rustc_nounwind]
3203
3220
#[ inline]
3204
3221
#[ rustc_intrinsic]
0 commit comments