diff options
| author | bors <bors@rust-lang.org> | 2022-07-15 21:38:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-15 21:38:02 +0000 |
| commit | 8c1cc82a82ebfbea731258063115992b2dd4adee (patch) | |
| tree | cc4119188b687cb7e8130a16b60f64b23389baf3 | |
| parent | 23e21bdd25026e2839ebe946c2a937c1904887d2 (diff) | |
| parent | ef8e322b1431e6d7a6253e52273c9788c3d82058 (diff) | |
| download | rust-8c1cc82a82ebfbea731258063115992b2dd4adee.tar.gz rust-8c1cc82a82ebfbea731258063115992b2dd4adee.zip | |
Auto merge of #99288 - Aaron1011:stable-intrinsics, r=yaahc
Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules` Fixes #99286 PR #95956 accidentally made these intrinsics unstable when accessed through the unstable path segment 'std::intrinsics'
| -rw-r--r-- | library/core/src/intrinsics.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 9097ffc2cc5..998f7be3f73 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -63,6 +63,7 @@ use crate::mem; use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering}; #[stable(feature = "drop_in_place", since = "1.8.0")] +#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)] #[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")] #[inline] pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) { @@ -2435,6 +2436,7 @@ pub(crate) fn is_nonoverlapping<T>(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")] +#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)] #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) { @@ -2520,6 +2522,7 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us /// ``` #[doc(alias = "memmove")] #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)] #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")] #[inline] pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { @@ -2609,6 +2612,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { /// ``` #[doc(alias = "memset")] #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)] #[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")] #[inline] pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) { diff --git a/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs b/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs new file mode 100644 index 00000000000..b9eee992266 --- /dev/null +++ b/src/test/ui/stability-attribute/issue-99286-stable-intrinsics.rs @@ -0,0 +1,17 @@ +// check-pass +// +// Regression test for issue #99286 +// Tests that stabilized intrinsics are accessible +// through 'std::intrinsics', even though the module +// is unstable. + +#![allow(unused_imports)] +#![allow(deprecated)] + +use std::intrinsics::drop_in_place as _; +use std::intrinsics::copy_nonoverlapping as _; +use std::intrinsics::copy as _; +use std::intrinsics::write_bytes as _; +use std::intrinsics::{drop_in_place, copy_nonoverlapping, copy, write_bytes}; + +fn main() {} |
