@@ -430,7 +430,8 @@ pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
430
430
}
431
431
432
432
#[ inline]
433
- pub ( crate ) unsafe fn swap_nonoverlapping_one < T > ( x : * mut T , y : * mut T ) {
433
+ #[ rustc_const_unstable( feature = "const_swap" , issue = "83163" ) ]
434
+ pub ( crate ) const unsafe fn swap_nonoverlapping_one < T > ( x : * mut T , y : * mut T ) {
434
435
// NOTE(eddyb) SPIR-V's Logical addressing model doesn't allow for arbitrary
435
436
// reinterpretation of values as (chunkable) byte arrays, and the loop in the
436
437
// block optimization in `swap_nonoverlapping_bytes` is hard to rewrite back
@@ -563,7 +564,8 @@ const unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
563
564
/// ```
564
565
#[ inline]
565
566
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
566
- pub unsafe fn replace < T > ( dst : * mut T , mut src : T ) -> T {
567
+ #[ rustc_const_unstable( feature = "const_replace" , issue = "83164" ) ]
568
+ pub const unsafe fn replace < T > ( dst : * mut T , mut src : T ) -> T {
567
569
// SAFETY: the caller must guarantee that `dst` is valid to be
568
570
// cast to a mutable reference (valid for writes, aligned, initialized),
569
571
// and cannot overlap `src` since `dst` must point to a distinct
@@ -869,10 +871,12 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
869
871
/// ```
870
872
#[ inline]
871
873
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
872
- pub unsafe fn write < T > ( dst : * mut T , src : T ) {
874
+ #[ rustc_const_unstable( feature = "const_ptr_write" , issue = "none" ) ]
875
+ pub const unsafe fn write < T > ( dst : * mut T , src : T ) {
873
876
// We are calling the intrinsics directly to avoid function calls in the generated code
874
877
// as `intrinsics::copy_nonoverlapping` is a wrapper function.
875
878
extern "rust-intrinsic" {
879
+ #[ rustc_const_unstable( feature = "const_intrinsic_copy" , issue = "none" ) ]
876
880
fn copy_nonoverlapping < T > ( src : * const T , dst : * mut T , count : usize ) ;
877
881
}
878
882
0 commit comments