@@ -1846,20 +1846,22 @@ pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -
1846
1846
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
1847
1847
#[ doc( alias = "memcpy" ) ]
1848
1848
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1849
+ #[ rustc_const_unstable( feature = "const_intrinsic_copy" , issue = "none" ) ]
1849
1850
#[ inline]
1850
- pub unsafe fn copy_nonoverlapping < T > ( src : * const T , dst : * mut T , count : usize ) {
1851
+ pub const unsafe fn copy_nonoverlapping < T > ( src : * const T , dst : * mut T , count : usize ) {
1851
1852
extern "rust-intrinsic" {
1852
1853
fn copy_nonoverlapping < T > ( src : * const T , dst : * mut T , count : usize ) ;
1853
1854
}
1854
1855
1855
- if cfg ! ( debug_assertions)
1856
+ // FIXME: Perform these checks only at run time
1857
+ /*if cfg!(debug_assertions)
1856
1858
&& !(is_aligned_and_not_null(src)
1857
1859
&& is_aligned_and_not_null(dst)
1858
1860
&& is_nonoverlapping(src, dst, count))
1859
1861
{
1860
1862
// Not panicking to keep codegen impact smaller.
1861
1863
abort();
1862
- }
1864
+ }*/
1863
1865
1864
1866
// SAFETY: the safety contract for `copy_nonoverlapping` must be
1865
1867
// upheld by the caller.
@@ -1928,16 +1930,19 @@ pub unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
1928
1930
/// ```
1929
1931
#[ doc( alias = "memmove" ) ]
1930
1932
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1933
+ #[ rustc_const_unstable( feature = "const_intrinsic_copy" , issue = "none" ) ]
1931
1934
#[ inline]
1932
- pub unsafe fn copy < T > ( src : * const T , dst : * mut T , count : usize ) {
1935
+ pub const unsafe fn copy < T > ( src : * const T , dst : * mut T , count : usize ) {
1933
1936
extern "rust-intrinsic" {
1937
+ #[ rustc_const_unstable( feature = "const_intrinsic_copy" , issue = "none" ) ]
1934
1938
fn copy < T > ( src : * const T , dst : * mut T , count : usize ) ;
1935
1939
}
1936
1940
1937
- if cfg ! ( debug_assertions) && !( is_aligned_and_not_null ( src) && is_aligned_and_not_null ( dst) ) {
1941
+ // FIXME: Perform these checks only at run time
1942
+ /*if cfg!(debug_assertions) && !(is_aligned_and_not_null(src) && is_aligned_and_not_null(dst)) {
1938
1943
// Not panicking to keep codegen impact smaller.
1939
1944
abort();
1940
- }
1945
+ }*/
1941
1946
1942
1947
// SAFETY: the safety contract for `copy` must be upheld by the caller.
1943
1948
unsafe { copy ( src, dst, count) }
0 commit comments