Skip to content

Commit 715b2d4

Browse files
committed
Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot
Support unstable moves via stable in unstable items part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of rust-lang/rust#90328. The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge. This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.
2 parents 1ef97fe + 4788150 commit 715b2d4

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

core/src/intrinsics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,7 @@ extern "rust-intrinsic" {
14571457
/// }
14581458
/// ```
14591459
#[stable(feature = "rust1", since = "1.0.0")]
1460+
#[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
14601461
#[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
14611462
#[rustc_diagnostic_item = "transmute"]
14621463
pub fn transmute<T, U>(e: T) -> U;
@@ -2649,6 +2650,7 @@ pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
26492650
/// Here is an example of how this could cause a problem:
26502651
/// ```no_run
26512652
/// #![feature(const_eval_select)]
2653+
/// #![feature(core_intrinsics)]
26522654
/// use std::hint::unreachable_unchecked;
26532655
/// use std::intrinsics::const_eval_select;
26542656
///

core/src/macros/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ pub(crate) mod builtin {
15371537
/// Unstable implementation detail of the `rustc` compiler, do not use.
15381538
#[rustc_builtin_macro]
15391539
#[stable(feature = "rust1", since = "1.0.0")]
1540-
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
1540+
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals, rt)]
15411541
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
15421542
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
15431543
pub macro RustcDecodable($item:item) {
@@ -1547,7 +1547,7 @@ pub(crate) mod builtin {
15471547
/// Unstable implementation detail of the `rustc` compiler, do not use.
15481548
#[rustc_builtin_macro]
15491549
#[stable(feature = "rust1", since = "1.0.0")]
1550-
#[allow_internal_unstable(core_intrinsics)]
1550+
#[allow_internal_unstable(core_intrinsics, rt)]
15511551
#[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
15521552
#[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
15531553
pub macro RustcEncodable($item:item) {

core/tests/unicode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[test]
22
pub fn version() {
3-
let (major, _minor, _update) = core::unicode::UNICODE_VERSION;
3+
let (major, _minor, _update) = core::char::UNICODE_VERSION;
44
assert!(major >= 10);
55
}

std/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
#![cfg_attr(not(bootstrap), deny(ffi_unwind_calls))]
215215
// std may use features in a platform-specific way
216216
#![allow(unused_features)]
217-
#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count))]
217+
#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count, rt))]
218218
#![cfg_attr(
219219
all(target_vendor = "fortanix", target_env = "sgx"),
220220
feature(slice_index_methods, coerce_unsized, sgx_platform)
@@ -297,6 +297,7 @@
297297
// Library features (alloc):
298298
#![feature(alloc_layout_extra)]
299299
#![feature(alloc_c_string)]
300+
#![feature(alloc_ffi)]
300301
#![feature(allocator_api)]
301302
#![feature(get_mut_unchecked)]
302303
#![feature(map_try_insert)]

std/src/panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::thread::Result;
1111

1212
#[doc(hidden)]
1313
#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
14-
#[allow_internal_unstable(libstd_sys_internals, const_format_args, core_panic)]
14+
#[allow_internal_unstable(libstd_sys_internals, const_format_args, core_panic, rt)]
1515
#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_2015_macro")]
1616
#[rustc_macro_transparency = "semitransparent"]
1717
pub macro panic_2015 {

0 commit comments

Comments
 (0)