alloc: Add issues for all unstable features

This commit is contained in:
Alex Crichton 2015-08-12 22:19:08 -07:00
parent b7dcf272d9
commit 6734c933b5
5 changed files with 44 additions and 27 deletions

View File

@ -137,7 +137,8 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
/// used to break cycles between `Arc` pointers.
#[unsafe_no_drop_flag]
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
pub struct Weak<T: ?Sized> {
// FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref
@ -209,7 +210,8 @@ impl<T: ?Sized> Arc<T> {
/// let weak_five = five.downgrade();
/// ```
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
pub fn downgrade(&self) -> Weak<T> {
loop {
// This Relaxed is OK because we're checking the value in the CAS
@ -234,14 +236,14 @@ impl<T: ?Sized> Arc<T> {
/// Get the number of weak references to this value.
#[inline]
#[unstable(feature = "arc_counts")]
#[unstable(feature = "arc_counts", issue = "27718")]
pub fn weak_count(this: &Arc<T>) -> usize {
this.inner().weak.load(SeqCst) - 1
}
/// Get the number of strong references to this value.
#[inline]
#[unstable(feature = "arc_counts")]
#[unstable(feature = "arc_counts", issue = "27718")]
pub fn strong_count(this: &Arc<T>) -> usize {
this.inner().strong.load(SeqCst)
}
@ -349,7 +351,7 @@ impl<T: Clone> Arc<T> {
/// let mut_five = Arc::make_unique(&mut five);
/// ```
#[inline]
#[unstable(feature = "arc_unique")]
#[unstable(feature = "arc_unique", issue = "27718")]
pub fn make_unique(this: &mut Arc<T>) -> &mut T {
// Note that we hold both a strong reference and a weak reference.
// Thus, releasing our strong reference only will not, by itself, cause
@ -427,7 +429,7 @@ impl<T: ?Sized> Arc<T> {
/// # }
/// ```
#[inline]
#[unstable(feature = "arc_unique")]
#[unstable(feature = "arc_unique", issue = "27718")]
pub fn get_mut(this: &mut Arc<T>) -> Option<&mut T> {
if this.is_unique() {
// This unsafety is ok because we're guaranteed that the pointer
@ -541,7 +543,8 @@ impl<T: ?Sized> Drop for Arc<T> {
}
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
impl<T: ?Sized> Weak<T> {
/// Upgrades a weak reference to a strong reference.
///
@ -589,7 +592,8 @@ impl<T: ?Sized> Weak<T> {
}
#[unstable(feature = "arc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
impl<T: ?Sized> Clone for Weak<T> {
/// Makes a clone of the `Weak<T>`.
///

View File

@ -85,13 +85,15 @@ use core::raw::{TraitObject};
/// ```
#[lang = "exchange_heap"]
#[unstable(feature = "box_heap",
reason = "may be renamed; uncertain about custom allocator design")]
reason = "may be renamed; uncertain about custom allocator design",
issue = "27779")]
pub const HEAP: ExchangeHeapSingleton =
ExchangeHeapSingleton { _force_singleton: () };
/// This the singleton type used solely for `boxed::HEAP`.
#[unstable(feature = "box_heap",
reason = "may be renamed; uncertain about custom allocator design")]
reason = "may be renamed; uncertain about custom allocator design",
issue = "27779")]
#[derive(Copy, Clone)]
pub struct ExchangeHeapSingleton { _force_singleton: () }
@ -121,7 +123,9 @@ pub struct Box<T: ?Sized>(Unique<T>);
/// the fact that the `align_of` intrinsic currently requires the
/// input type to be Sized (which I do not think is strictly
/// necessary).
#[unstable(feature = "placement_in", reason = "placement box design is still being worked out.")]
#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
pub struct IntermediateBox<T: ?Sized>{
ptr: *mut u8,
size: usize,
@ -222,7 +226,8 @@ impl<T : ?Sized> Box<T> {
/// lead to memory problems like double-free, for example if the
/// function is called twice on the same raw pointer.
#[unstable(feature = "box_raw",
reason = "may be renamed or moved out of Box scope")]
reason = "may be renamed or moved out of Box scope",
issue = "27768")]
#[inline]
// NB: may want to be called from_ptr, see comments on CStr::from_ptr
pub unsafe fn from_raw(raw: *mut T) -> Self {
@ -245,7 +250,8 @@ impl<T : ?Sized> Box<T> {
/// let raw = Box::into_raw(seventeen);
/// let boxed_again = unsafe { Box::from_raw(raw) };
/// ```
#[unstable(feature = "box_raw", reason = "may be renamed")]
#[unstable(feature = "box_raw", reason = "may be renamed",
issue = "27768")]
#[inline]
// NB: may want to be called into_ptr, see comments on CStr::from_ptr
pub fn into_raw(b: Box<T>) -> *mut T {
@ -470,7 +476,7 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
/// }
/// ```
#[rustc_paren_sugar]
#[unstable(feature = "fnbox", reason = "Newly introduced")]
#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")]
pub trait FnBox<A> {
type Output;

View File

@ -12,7 +12,8 @@
reason = "the precise API and guarantees it provides may be tweaked \
slightly, especially to possibly take into account the \
types being stored to make room for a future \
tracing garbage collector")]
tracing garbage collector",
issue = "27700")]
use core::{isize, usize};

View File

@ -64,7 +64,8 @@
#![allow(unused_attributes)]
#![unstable(feature = "alloc",
reason = "this library is unlikely to be stabilized in its current \
form or name")]
form or name",
issue = "27783")]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
@ -131,7 +132,8 @@ pub mod raw_vec;
/// Common out-of-memory routine
#[cold]
#[inline(never)]
#[unstable(feature = "oom", reason = "not a scrutinized interface")]
#[unstable(feature = "oom", reason = "not a scrutinized interface",
issue = "27700")]
pub fn oom() -> ! {
// FIXME(#14674): This really needs to do something other than just abort
// here, but any printing done must be *guaranteed* to not

View File

@ -238,7 +238,7 @@ impl<T> Rc<T> {
/// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4)));
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
#[unstable(feature = "rc_unique", issue = "27718")]
pub fn try_unwrap(rc: Rc<T>) -> Result<T, Rc<T>> {
if Rc::is_unique(&rc) {
unsafe {
@ -271,7 +271,8 @@ impl<T: ?Sized> Rc<T> {
/// let weak_five = five.downgrade();
/// ```
#[unstable(feature = "rc_weak",
reason = "Weak pointers may not belong in this module")]
reason = "Weak pointers may not belong in this module",
issue = "27718")]
pub fn downgrade(&self) -> Weak<T> {
self.inc_weak();
Weak { _ptr: self._ptr }
@ -279,12 +280,12 @@ impl<T: ?Sized> Rc<T> {
/// Get the number of weak references to this value.
#[inline]
#[unstable(feature = "rc_counts")]
#[unstable(feature = "rc_counts", issue = "27718")]
pub fn weak_count(this: &Rc<T>) -> usize { this.weak() - 1 }
/// Get the number of strong references to this value.
#[inline]
#[unstable(feature = "rc_counts")]
#[unstable(feature = "rc_counts", issue= "27718")]
pub fn strong_count(this: &Rc<T>) -> usize { this.strong() }
/// Returns true if there are no other `Rc` or `Weak<T>` values that share
@ -302,7 +303,7 @@ impl<T: ?Sized> Rc<T> {
/// assert!(Rc::is_unique(&five));
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
#[unstable(feature = "rc_unique", issue = "27718")]
pub fn is_unique(rc: &Rc<T>) -> bool {
Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1
}
@ -327,7 +328,7 @@ impl<T: ?Sized> Rc<T> {
/// assert!(Rc::get_mut(&mut x).is_none());
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
#[unstable(feature = "rc_unique", issue = "27718")]
pub fn get_mut(rc: &mut Rc<T>) -> Option<&mut T> {
if Rc::is_unique(rc) {
let inner = unsafe { &mut **rc._ptr };
@ -356,7 +357,7 @@ impl<T: Clone> Rc<T> {
/// let mut_five = five.make_unique();
/// ```
#[inline]
#[unstable(feature = "rc_unique")]
#[unstable(feature = "rc_unique", issue = "27718")]
pub fn make_unique(&mut self) -> &mut T {
if !Rc::is_unique(self) {
*self = Rc::new((**self).clone())
@ -653,7 +654,8 @@ impl<T> fmt::Pointer for Rc<T> {
/// See the [module level documentation](./index.html) for more.
#[unsafe_no_drop_flag]
#[unstable(feature = "rc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
pub struct Weak<T: ?Sized> {
// FIXME #12808: strange names to try to avoid interfering with
// field accesses of the contained type via Deref
@ -666,7 +668,8 @@ impl<T: ?Sized> !marker::Sync for Weak<T> {}
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}
#[unstable(feature = "rc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
impl<T: ?Sized> Weak<T> {
/// Upgrades a weak reference to a strong reference.
@ -746,7 +749,8 @@ impl<T: ?Sized> Drop for Weak<T> {
}
#[unstable(feature = "rc_weak",
reason = "Weak pointers may not belong in this module.")]
reason = "Weak pointers may not belong in this module.",
issue = "27718")]
impl<T: ?Sized> Clone for Weak<T> {
/// Makes a clone of the `Weak<T>`.