about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-14 13:42:09 +0000
committerbors <bors@rust-lang.org>2022-07-14 13:42:09 +0000
commit24699bcbadff59693a89a5184afed87f6416cdea (patch)
treed982a08c704d13e4ace62c79465e57dd4a6d6f38 /library
parentf1a8854f9be2e5cad764d630a53d26c7b72f8162 (diff)
parent3e2c5b5f751c3375c2ce4a2d2f54e4d8499e454d (diff)
downloadrust-24699bcbadff59693a89a5184afed87f6416cdea.tar.gz
rust-24699bcbadff59693a89a5184afed87f6416cdea.zip
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 https://github.com/rust-lang/rust/pull/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.
Diffstat (limited to 'library')
-rw-r--r--library/core/src/intrinsics.rs2
-rw-r--r--library/core/src/macros/mod.rs4
-rw-r--r--library/core/tests/unicode.rs2
-rw-r--r--library/std/src/lib.rs3
-rw-r--r--library/std/src/panic.rs2
5 files changed, 8 insertions, 5 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs
index 2895c923adc..9097ffc2cc5 100644
--- a/library/core/src/intrinsics.rs
+++ b/library/core/src/intrinsics.rs
@@ -1457,6 +1457,7 @@ extern "rust-intrinsic" {
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[cfg_attr(not(bootstrap), rustc_allowed_through_unstable_modules)]
     #[rustc_const_stable(feature = "const_transmute", since = "1.56.0")]
     #[rustc_diagnostic_item = "transmute"]
     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) {
 /// Here is an example of how this could cause a problem:
 /// ```no_run
 /// #![feature(const_eval_select)]
+/// #![feature(core_intrinsics)]
 /// use std::hint::unreachable_unchecked;
 /// use std::intrinsics::const_eval_select;
 ///
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 673a39c298f..bd62bc5c305 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -1537,7 +1537,7 @@ pub(crate) mod builtin {
     /// Unstable implementation detail of the `rustc` compiler, do not use.
     #[rustc_builtin_macro]
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
+    #[allow_internal_unstable(core_intrinsics, libstd_sys_internals, rt)]
     #[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
     #[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
     pub macro RustcDecodable($item:item) {
@@ -1547,7 +1547,7 @@ pub(crate) mod builtin {
     /// Unstable implementation detail of the `rustc` compiler, do not use.
     #[rustc_builtin_macro]
     #[stable(feature = "rust1", since = "1.0.0")]
-    #[allow_internal_unstable(core_intrinsics)]
+    #[allow_internal_unstable(core_intrinsics, rt)]
     #[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")]
     #[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it.
     pub macro RustcEncodable($item:item) {
diff --git a/library/core/tests/unicode.rs b/library/core/tests/unicode.rs
index c28ea859115..bbace0ef66c 100644
--- a/library/core/tests/unicode.rs
+++ b/library/core/tests/unicode.rs
@@ -1,5 +1,5 @@
 #[test]
 pub fn version() {
-    let (major, _minor, _update) = core::unicode::UNICODE_VERSION;
+    let (major, _minor, _update) = core::char::UNICODE_VERSION;
     assert!(major >= 10);
 }
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 244597950fa..aa309065c88 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -214,7 +214,7 @@
 #![cfg_attr(not(bootstrap), deny(ffi_unwind_calls))]
 // std may use features in a platform-specific way
 #![allow(unused_features)]
-#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count))]
+#![cfg_attr(test, feature(internal_output_capture, print_internals, update_panic_count, rt))]
 #![cfg_attr(
     all(target_vendor = "fortanix", target_env = "sgx"),
     feature(slice_index_methods, coerce_unsized, sgx_platform)
@@ -297,6 +297,7 @@
 // Library features (alloc):
 #![feature(alloc_layout_extra)]
 #![feature(alloc_c_string)]
+#![feature(alloc_ffi)]
 #![feature(allocator_api)]
 #![feature(get_mut_unchecked)]
 #![feature(map_try_insert)]
diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs
index ac16f476143..45bc56efb3b 100644
--- a/library/std/src/panic.rs
+++ b/library/std/src/panic.rs
@@ -11,7 +11,7 @@ use crate::thread::Result;
 
 #[doc(hidden)]
 #[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
-#[allow_internal_unstable(libstd_sys_internals, const_format_args, core_panic)]
+#[allow_internal_unstable(libstd_sys_internals, const_format_args, core_panic, rt)]
 #[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_2015_macro")]
 #[rustc_macro_transparency = "semitransparent"]
 pub macro panic_2015 {