]> git.lizzy.rs Git - rust.git/commitdiff
Update library functions with stability attributes
authorDylan MacKenzie <ecstaticmorse@gmail.com>
Thu, 17 Sep 2020 18:02:56 +0000 (11:02 -0700)
committerDylan MacKenzie <ecstaticmorse@gmail.com>
Tue, 22 Sep 2020 17:05:58 +0000 (10:05 -0700)
This may not be strictly minimal, but all unstable functions also need a
`rustc_const_unstable` attribute.

13 files changed:
library/alloc/src/borrow.rs
library/alloc/src/lib.rs
library/alloc/src/raw_vec.rs
library/alloc/tests/lib.rs
library/core/src/alloc/layout.rs
library/core/src/future/mod.rs
library/core/src/lib.rs
library/proc_macro/src/bridge/client.rs
library/proc_macro/src/bridge/scoped_cell.rs
library/proc_macro/src/lib.rs
library/std/src/lib.rs
library/std/src/sys_common/thread_local_key.rs
library/std/src/thread/local.rs

index e7260f3956c3833671ac771677956e6285c5e48d..f801c1ac75bc38af2383d67af98258c991b6dcb4 100644 (file)
@@ -217,6 +217,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
     /// assert!(!bull.is_borrowed());
     /// ```
     #[unstable(feature = "cow_is_borrowed", issue = "65143")]
+    #[rustc_const_unstable(feature = "const_cow_is_borrowed", issue = "65143")]
     pub const fn is_borrowed(&self) -> bool {
         match *self {
             Borrowed(_) => true,
@@ -239,6 +240,7 @@ pub const fn is_borrowed(&self) -> bool {
     /// assert!(!bull.is_owned());
     /// ```
     #[unstable(feature = "cow_is_borrowed", issue = "65143")]
+    #[rustc_const_unstable(feature = "const_cow_is_borrowed", issue = "65143")]
     pub const fn is_owned(&self) -> bool {
         !self.is_borrowed()
     }
index 5ae4b7cf36adc46bb108a78f8e90315af3b79dda..b33cb3ad8e8399486561f98f065615dcdb706d57 100644 (file)
 #![feature(cfg_target_has_atomic)]
 #![feature(coerce_unsized)]
 #![feature(const_btree_new)]
+#![feature(const_fn)]
 #![feature(const_generics)]
 #![feature(const_in_array_repeat_expressions)]
 #![feature(cow_is_borrowed)]
+#![feature(const_cow_is_borrowed)]
 #![feature(dispatch_from_dyn)]
 #![feature(core_intrinsics)]
 #![feature(dropck_eyepatch)]
index e33dddc4f984183730d669885632f07828704c0d..e6da599006000dbdeef4f570fc993cab3d45372d 100644 (file)
@@ -150,6 +150,7 @@ pub unsafe fn into_box(self, len: usize) -> Box<[MaybeUninit<T>]> {
 impl<T, A: AllocRef> RawVec<T, A> {
     /// Like `new`, but parameterized over the choice of allocator for
     /// the returned `RawVec`.
+    #[allow_internal_unstable(const_fn)]
     pub const fn new_in(alloc: A) -> Self {
         // `cap: 0` means "unallocated". zero-sized types are ignored.
         Self { ptr: Unique::dangling(), cap: 0, alloc }
index 3ee0cfbe74759862a6da591141abb1b85a931808..cff8ff9ac7ad9a20bcdddab15ef4a0b09523577c 100644 (file)
@@ -1,6 +1,7 @@
 #![feature(allocator_api)]
 #![feature(box_syntax)]
 #![feature(cow_is_borrowed)]
+#![feature(const_cow_is_borrowed)]
 #![feature(drain_filter)]
 #![feature(exact_size_is_empty)]
 #![feature(new_uninit)]
index a5ddf7619b6dc7c23b9be4d8dd06628fdcfc82a2..a3fbed2ec1254d09c8aca3d891d0127acfe2105b 100644 (file)
@@ -177,6 +177,7 @@ pub unsafe fn for_value_raw<T: ?Sized>(t: *const T) -> Self {
     /// sentinel value. Types that lazily allocate must track initialization by
     /// some other means.
     #[unstable(feature = "alloc_layout_extra", issue = "55724")]
+    #[rustc_const_unstable(feature = "alloc_layout_extra", issue = "55724")]
     #[inline]
     pub const fn dangling(&self) -> NonNull<u8> {
         // SAFETY: align is guaranteed to be non-zero
index bec3adfa984221422ebfcdbaad69ef53f6e85eed..fa5655ca35f41b2f97e14ded32efd1ee464b1869 100644 (file)
@@ -56,6 +56,7 @@ unsafe impl Sync for ResumeTy {}
 #[lang = "from_generator"]
 #[doc(hidden)]
 #[unstable(feature = "gen_future", issue = "50547")]
+#[rustc_const_unstable(feature = "gen_future", issue = "50547")]
 #[inline]
 pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
 where
index 9de0f76cbdd2cdb565add1abd273b7263d7a4e68..86eda843c5bc32903d6187d4b74e595d6da07cbf 100644 (file)
 #![feature(const_float_bits_conv)]
 #![feature(const_overflowing_int_methods)]
 #![feature(const_int_unchecked_arith)]
+#![feature(const_mut_refs)]
 #![feature(const_int_pow)]
 #![feature(constctlz)]
 #![feature(const_panic)]
 #![feature(const_pin)]
 #![feature(const_fn_union)]
+#![feature(const_fn)]
 #![feature(const_generics)]
 #![feature(const_option)]
 #![feature(const_precise_live_drops)]
index 39daad4da127d3392e93d86b99d740fb89377f29..ba3d4c075e11f9e2830a8ea97c73361abac6ed78 100644 (file)
@@ -401,6 +401,7 @@ fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
 }
 
 impl Client<fn(crate::TokenStream) -> crate::TokenStream> {
+    #[allow_internal_unstable(const_fn)]
     pub const fn expand1(f: fn(crate::TokenStream) -> crate::TokenStream) -> Self {
         extern "C" fn run(
             bridge: Bridge<'_>,
@@ -413,6 +414,7 @@ extern "C" fn run(
 }
 
 impl Client<fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream> {
+    #[allow_internal_unstable(const_fn)]
     pub const fn expand2(
         f: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
     ) -> Self {
@@ -457,6 +459,7 @@ pub fn name(&self) -> &'static str {
         }
     }
 
+    #[allow_internal_unstable(const_fn)]
     pub const fn custom_derive(
         trait_name: &'static str,
         attributes: &'static [&'static str],
@@ -465,6 +468,7 @@ pub const fn custom_derive(
         ProcMacro::CustomDerive { trait_name, attributes, client: Client::expand1(expand) }
     }
 
+    #[allow_internal_unstable(const_fn)]
     pub const fn attr(
         name: &'static str,
         expand: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
@@ -472,6 +476,7 @@ pub const fn attr(
         ProcMacro::Attr { name, client: Client::expand2(expand) }
     }
 
+    #[allow_internal_unstable(const_fn)]
     pub const fn bang(
         name: &'static str,
         expand: fn(crate::TokenStream) -> crate::TokenStream,
index 2cde1f65adf9c484ab0aee45fe6c978fda30cbb9..daa577f74bac3af4de376dbc8d8de2f6a234a1a5 100644 (file)
@@ -35,6 +35,7 @@ fn deref_mut(&mut self) -> &mut Self::Target {
 pub struct ScopedCell<T: LambdaL>(Cell<<T as ApplyL<'static>>::Out>);
 
 impl<T: LambdaL> ScopedCell<T> {
+    #[allow_internal_unstable(const_fn)]
     pub const fn new(value: <T as ApplyL<'static>>::Out) -> Self {
         ScopedCell(Cell::new(value))
     }
index c5a871e09a6ea61aeab55cb964d9fc14388d917a..f81ffd2bb9429811b26d67c77e16f9db2735ca97 100644 (file)
@@ -20,6 +20,7 @@
 )]
 #![feature(nll)]
 #![feature(staged_api)]
+#![feature(const_fn)]
 #![feature(allow_internal_unstable)]
 #![feature(decl_macro)]
 #![feature(extern_types)]
index 70533189d8e0b9de487121c31d82bcdfe3b8791c..309657e70424b1e5b0ff9df86181088cd1eb5dfd 100644 (file)
 #![feature(concat_idents)]
 #![feature(const_cstr_unchecked)]
 #![feature(const_fn_transmute)]
+#![feature(const_fn)]
 #![feature(const_ipv6)]
 #![feature(const_raw_ptr_deref)]
 #![feature(const_ipv4)]
 #![feature(str_internals)]
 #![feature(test)]
 #![feature(thread_local)]
+#![feature(thread_local_internals)]
 #![feature(toowned_clone_into)]
 #![feature(total_cmp)]
 #![feature(trace_macros)]
index 3a2218854a7300c71e802a1db195170f2da81524..676eadd1fac3b56cee5363441cd6c17ddc11e5c3 100644 (file)
@@ -117,6 +117,7 @@ pub struct Key {
 pub const INIT: StaticKey = StaticKey::new(None);
 
 impl StaticKey {
+    #[rustc_const_unstable(feature = "thread_local_internals", issue = "none")]
     pub const fn new(dtor: Option<unsafe extern "C" fn(*mut u8)>) -> StaticKey {
         StaticKey { key: atomic::AtomicUsize::new(0), dtor }
     }
index 60a05dc5d545b74ea168a0a3c9d2b54251ead303..784b376fcdc06185fa8aca1f8094806eaf266639 100644 (file)
@@ -225,6 +225,7 @@ impl<T: 'static> LocalKey<T> {
         reason = "recently added to create a key",
         issue = "none"
     )]
+    #[rustc_const_unstable(feature = "thread_local_internals", issue = "none")]
     pub const unsafe fn new(inner: unsafe fn() -> Option<&'static T>) -> LocalKey<T> {
         LocalKey { inner }
     }
@@ -497,6 +498,7 @@ struct Value<T: 'static> {
     }
 
     impl<T: 'static> Key<T> {
+        #[rustc_const_unstable(feature = "thread_local_internals", issue = "none")]
         pub const fn new() -> Key<T> {
             Key { os: OsStaticKey::new(Some(destroy_value::<T>)), marker: marker::PhantomData }
         }