From 23a0e3ee1b445f0a163cdd0104c05f6d977e8caf Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 22 May 2022 21:29:54 +0900 Subject: [PATCH] Stabilize `const_intrinsic_copy` --- library/alloc/tests/lib.rs | 1 - library/core/src/intrinsics.rs | 8 ++++---- library/core/src/lib.rs | 1 - library/core/src/ptr/const_ptr.rs | 4 ++-- library/core/src/ptr/mod.rs | 4 ++-- library/core/src/ptr/mut_ptr.rs | 8 ++++---- src/test/ui/consts/copy-intrinsic.rs | 6 +++--- src/test/ui/consts/intrinsic_without_const_stab.rs | 4 ++-- src/test/ui/consts/intrinsic_without_const_stab_fail.rs | 4 ++-- 9 files changed, 19 insertions(+), 21 deletions(-) diff --git a/library/alloc/tests/lib.rs b/library/alloc/tests/lib.rs index 601a87aa4ac89..af7b410c3b3f3 100644 --- a/library/alloc/tests/lib.rs +++ b/library/alloc/tests/lib.rs @@ -7,7 +7,6 @@ #![feature(const_convert)] #![feature(const_cow_is_borrowed)] #![feature(const_heap)] -#![feature(const_intrinsic_copy)] #![feature(const_mut_refs)] #![feature(const_nonnull_slice_from_raw_parts)] #![feature(const_ptr_write)] diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 88e4262922dc5..d6c79f64a410e 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -2116,11 +2116,11 @@ pub(crate) fn is_nonoverlapping(src: *const T, dst: *const T, count: usize) - /// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append #[doc(alias = "memcpy")] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize) { extern "rust-intrinsic" { - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] pub fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); } @@ -2198,11 +2198,11 @@ pub const unsafe fn copy_nonoverlapping(src: *const T, dst: *mut T, count: us /// ``` #[doc(alias = "memmove")] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) { extern "rust-intrinsic" { - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] fn copy(src: *const T, dst: *mut T, count: usize); } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 7b04e4423b782..783ce27d869bc 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -114,7 +114,6 @@ #![feature(const_convert)] #![feature(const_inherent_unchecked_arith)] #![feature(const_int_unchecked_arith)] -#![feature(const_intrinsic_copy)] #![feature(const_intrinsic_forget)] #![feature(const_likely)] #![feature(const_maybe_uninit_uninit_array)] diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index f26fdc74ce161..f2f26b36018b7 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1197,7 +1197,7 @@ impl *const T { /// See [`ptr::copy`] for safety concerns and examples. /// /// [`ptr::copy`]: crate::ptr::copy() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline] pub const unsafe fn copy_to(self, dest: *mut T, count: usize) @@ -1216,7 +1216,7 @@ impl *const T { /// See [`ptr::copy_nonoverlapping`] for safety concerns and examples. /// /// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline] pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index dc229c9ff9b44..b34c70f404da8 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1089,7 +1089,7 @@ pub const unsafe fn read(src: *const T) -> T { // We are calling the intrinsics directly to avoid function calls in the generated code // as `intrinsics::copy_nonoverlapping` is a wrapper function. extern "rust-intrinsic" { - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); } @@ -1284,7 +1284,7 @@ pub const unsafe fn write(dst: *mut T, src: T) { // We are calling the intrinsics directly to avoid function calls in the generated code // as `intrinsics::copy_nonoverlapping` is a wrapper function. extern "rust-intrinsic" { - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 37cf2ef4bfbb5..489ef7bf0a407 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -1309,7 +1309,7 @@ impl *mut T { /// See [`ptr::copy`] for safety concerns and examples. /// /// [`ptr::copy`]: crate::ptr::copy() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline(always)] pub const unsafe fn copy_to(self, dest: *mut T, count: usize) @@ -1328,7 +1328,7 @@ impl *mut T { /// See [`ptr::copy_nonoverlapping`] for safety concerns and examples. /// /// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline(always)] pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize) @@ -1347,7 +1347,7 @@ impl *mut T { /// See [`ptr::copy`] for safety concerns and examples. /// /// [`ptr::copy`]: crate::ptr::copy() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline(always)] pub const unsafe fn copy_from(self, src: *const T, count: usize) @@ -1366,7 +1366,7 @@ impl *mut T { /// See [`ptr::copy_nonoverlapping`] for safety concerns and examples. /// /// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping() - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] #[inline(always)] pub const unsafe fn copy_from_nonoverlapping(self, src: *const T, count: usize) diff --git a/src/test/ui/consts/copy-intrinsic.rs b/src/test/ui/consts/copy-intrinsic.rs index 5ab90324b8f86..249bbb5991cc9 100644 --- a/src/test/ui/consts/copy-intrinsic.rs +++ b/src/test/ui/consts/copy-intrinsic.rs @@ -2,14 +2,14 @@ // ignore-tidy-linelength #![feature(intrinsics, staged_api)] -#![feature(const_mut_refs, const_intrinsic_copy)] +#![feature(const_mut_refs)] use std::mem; extern "rust-intrinsic" { - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] fn copy_nonoverlapping(src: *const T, dst: *mut T, count: usize); - #[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] + #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] fn copy(src: *const T, dst: *mut T, count: usize); } diff --git a/src/test/ui/consts/intrinsic_without_const_stab.rs b/src/test/ui/consts/intrinsic_without_const_stab.rs index d5f694986fc89..40ec65d51beec 100644 --- a/src/test/ui/consts/intrinsic_without_const_stab.rs +++ b/src/test/ui/consts/intrinsic_without_const_stab.rs @@ -1,8 +1,8 @@ -#![feature(intrinsics, staged_api, const_intrinsic_copy)] +#![feature(intrinsics, staged_api)] #![stable(feature = "core", since = "1.6.0")] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) { // Const stability attributes are not inherited from parent items. diff --git a/src/test/ui/consts/intrinsic_without_const_stab_fail.rs b/src/test/ui/consts/intrinsic_without_const_stab_fail.rs index 8b37268b0b205..2b0745b3c110c 100644 --- a/src/test/ui/consts/intrinsic_without_const_stab_fail.rs +++ b/src/test/ui/consts/intrinsic_without_const_stab_fail.rs @@ -1,4 +1,4 @@ -#![feature(intrinsics, staged_api, const_intrinsic_copy)] +#![feature(intrinsics, staged_api)] #![stable(feature = "core", since = "1.6.0")] extern "rust-intrinsic" { @@ -6,7 +6,7 @@ extern "rust-intrinsic" { } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_intrinsic_copy", issue = "80697")] +#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn stuff(src: *const T, dst: *mut T, count: usize) { unsafe { copy(src, dst, count) } //~ ERROR cannot call non-const fn