@@ -3969,6 +3969,21 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
3969
3969
false
3970
3970
}
3971
3971
3972
+ #[ rustc_nounwind]
3973
+ #[ inline]
3974
+ #[ rustc_intrinsic]
3975
+ #[ rustc_intrinsic_const_stable_indirect]
3976
+ #[ rustc_allow_const_fn_unstable( const_swap_nonoverlapping) ] // this is anyway not called since CTFE implements the intrinsic
3977
+ #[ cfg( bootstrap) ]
3978
+ pub const unsafe fn typed_swap < T > ( x : * mut T , y : * mut T ) {
3979
+ // SAFETY: The caller provided single non-overlapping items behind
3980
+ // pointers, so swapping them with `count: 1` is fine.
3981
+ unsafe { ptr:: swap_nonoverlapping ( x, y, 1 ) } ;
3982
+ }
3983
+
3984
+ #[ cfg( bootstrap) ]
3985
+ pub use typed_swap as typed_swap_nonoverlapping;
3986
+
3972
3987
/// Non-overlapping *typed* swap of a single value.
3973
3988
///
3974
3989
/// The codegen backends will replace this with a better implementation when
@@ -3982,10 +3997,10 @@ pub const fn is_val_statically_known<T: Copy>(_arg: T) -> bool {
3982
3997
#[ rustc_nounwind]
3983
3998
#[ inline]
3984
3999
#[ rustc_intrinsic]
3985
- // Const-unstable because `swap_nonoverlapping` is const-unstable.
3986
4000
#[ rustc_intrinsic_const_stable_indirect]
3987
4001
#[ rustc_allow_const_fn_unstable( const_swap_nonoverlapping) ] // this is anyway not called since CTFE implements the intrinsic
3988
- pub const unsafe fn typed_swap < T > ( x : * mut T , y : * mut T ) {
4002
+ #[ cfg( not( bootstrap) ) ]
4003
+ pub const unsafe fn typed_swap_nonoverlapping < T > ( x : * mut T , y : * mut T ) {
3989
4004
// SAFETY: The caller provided single non-overlapping items behind
3990
4005
// pointers, so swapping them with `count: 1` is fine.
3991
4006
unsafe { ptr:: swap_nonoverlapping ( x, y, 1 ) } ;
0 commit comments