Skip to content

Commit 436aaa0

Browse files
RalfJunggitbot
authored and
gitbot
committed
intrinsics: deprecate calling them via the unstable std::intrinsics path
1 parent fc41906 commit 436aaa0

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

core/src/intrinsics/mod.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,11 @@ pub const fn forget<T: ?Sized>(_: T) {
18971897
/// }
18981898
/// ```
18991899
#[stable(feature = "rust1", since = "1.0.0")]
1900-
#[rustc_allowed_through_unstable_modules]
1900+
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
1901+
#[cfg_attr(
1902+
not(bootstrap),
1903+
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
1904+
)]
19011905
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
19021906
#[rustc_diagnostic_item = "transmute"]
19031907
#[rustc_nounwind]
@@ -4325,7 +4329,11 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *cons
43254329
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
43264330
#[doc(alias = "memcpy")]
43274331
#[stable(feature = "rust1", since = "1.0.0")]
4328-
#[rustc_allowed_through_unstable_modules]
4332+
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4333+
#[cfg_attr(
4334+
not(bootstrap),
4335+
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4336+
)]
43294337
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
43304338
#[inline(always)]
43314339
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
@@ -4429,7 +4437,11 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
44294437
/// ```
44304438
#[doc(alias = "memmove")]
44314439
#[stable(feature = "rust1", since = "1.0.0")]
4432-
#[rustc_allowed_through_unstable_modules]
4440+
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4441+
#[cfg_attr(
4442+
not(bootstrap),
4443+
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4444+
)]
44334445
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
44344446
#[inline(always)]
44354447
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
@@ -4512,7 +4524,11 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
45124524
/// ```
45134525
#[doc(alias = "memset")]
45144526
#[stable(feature = "rust1", since = "1.0.0")]
4515-
#[rustc_allowed_through_unstable_modules]
4527+
#[cfg_attr(bootstrap, rustc_allowed_through_unstable_modules)]
4528+
#[cfg_attr(
4529+
not(bootstrap),
4530+
rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"
4531+
)]
45164532
#[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")]
45174533
#[inline(always)]
45184534
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces

0 commit comments

Comments
 (0)