Skip to content

Commit 8c1cc82

Browse files
committed
Auto merge of rust-lang#99288 - Aaron1011:stable-intrinsics, r=yaahc
Mark stabilized intrinsics with `rustc_allowed_through_unstable_modules` Fixes rust-lang#99286 PR rust-lang#95956 accidentally made these intrinsics unstable when accessed through the unstable path segment 'std::intrinsics'
2 parents 23e21bd + ef8e322 commit 8c1cc82

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

library/core/src/intrinsics.rs

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ use crate::mem;
6363
use crate::sync::atomic::{self, AtomicBool, AtomicI32, AtomicIsize, AtomicU32, Ordering};
6464

6565
#[stable(feature = "drop_in_place", since = "1.8.0")]
66+
#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
6667
#[deprecated(note = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.52.0")]
6768
#[inline]
6869
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) -
24352436
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
24362437
#[doc(alias = "memcpy")]
24372438
#[stable(feature = "rust1", since = "1.0.0")]
2439+
#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
24382440
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
24392441
#[inline]
24402442
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
25202522
/// ```
25212523
#[doc(alias = "memmove")]
25222524
#[stable(feature = "rust1", since = "1.0.0")]
2525+
#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
25232526
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
25242527
#[inline]
25252528
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) {
26092612
/// ```
26102613
#[doc(alias = "memset")]
26112614
#[stable(feature = "rust1", since = "1.0.0")]
2615+
#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
26122616
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
26132617
#[inline]
26142618
pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// check-pass
2+
//
3+
// Regression test for issue #99286
4+
// Tests that stabilized intrinsics are accessible
5+
// through 'std::intrinsics', even though the module
6+
// is unstable.
7+
8+
#![allow(unused_imports)]
9+
#![allow(deprecated)]
10+
11+
use std::intrinsics::drop_in_place as _;
12+
use std::intrinsics::copy_nonoverlapping as _;
13+
use std::intrinsics::copy as _;
14+
use std::intrinsics::write_bytes as _;
15+
use std::intrinsics::{drop_in_place, copy_nonoverlapping, copy, write_bytes};
16+
17+
fn main() {}

0 commit comments

Comments
 (0)