Skip to content

Commit

Permalink
Improvements to feature staging
Browse files Browse the repository at this point in the history
This gets rid of the 'experimental' level, removes the non-staged_api
case (i.e. stability levels for out-of-tree crates), and lets the
staged_api attributes use 'unstable' and 'deprecated' lints.

This makes the transition period to the full feature staging design
a bit nicer.
  • Loading branch information
brson committed Jan 8, 2015
1 parent 5364c48 commit 1f70acb
Show file tree
Hide file tree
Showing 105 changed files with 386 additions and 392 deletions.
16 changes: 8 additions & 8 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ unsafe impl<T: Sync + Send> Sync for Arc<T> { }
/// Weak pointers will not keep the data inside of the `Arc` alive, and can be used to break cycles
/// between `Arc` pointers.
#[unsafe_no_drop_flag]
#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
pub struct Weak<T> {
// FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref
Expand Down Expand Up @@ -179,7 +179,7 @@ impl<T> Arc<T> {
///
/// let weak_five = five.downgrade();
/// ```
#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
pub fn downgrade(&self) -> Weak<T> {
// See the clone() impl for why this is relaxed
self.inner().weak.fetch_add(1, Relaxed);
Expand All @@ -200,12 +200,12 @@ impl<T> Arc<T> {

/// Get the number of weak references to this value.
#[inline]
#[experimental]
#[unstable]
pub fn weak_count<T>(this: &Arc<T>) -> uint { this.inner().weak.load(SeqCst) - 1 }

/// Get the number of strong references to this value.
#[inline]
#[experimental]
#[unstable]
pub fn strong_count<T>(this: &Arc<T>) -> uint { this.inner().strong.load(SeqCst) }

#[stable]
Expand Down Expand Up @@ -271,7 +271,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
/// let mut_five = five.make_unique();
/// ```
#[inline]
#[experimental]
#[unstable]
pub fn make_unique(&mut self) -> &mut T {
// Note that we hold a strong reference, which also counts as a weak reference, so we only
// clone if there is an additional reference of either kind.
Expand Down Expand Up @@ -355,7 +355,7 @@ impl<T: Sync + Send> Drop for Arc<T> {
}
}

#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
impl<T: Sync + Send> Weak<T> {
/// Upgrades a weak reference to a strong reference.
///
Expand Down Expand Up @@ -393,7 +393,7 @@ impl<T: Sync + Send> Weak<T> {
}
}

#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
impl<T: Sync + Send> Clone for Weak<T> {
/// Makes a clone of the `Weak<T>`.
///
Expand Down Expand Up @@ -604,7 +604,7 @@ impl<H: Hasher, T: Hash<H>> Hash<H> for Arc<T> {
}

#[cfg(test)]
#[allow(experimental)]
#[allow(unstable)]
mod tests {
use std::clone::Clone;
use std::sync::mpsc::channel;
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use core::ops::{Deref, DerefMut};
/// }
/// ```
#[lang = "exchange_heap"]
#[experimental = "may be renamed; uncertain about custom allocator design"]
#[unstable = "may be renamed; uncertain about custom allocator design"]
pub static HEAP: () = ();

/// A type that represents a uniquely-owned value.
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
//! default global allocator. It is not compatible with the libc allocator API.
#![crate_name = "alloc"]
#![experimental]
#![unstable]
#![staged_api]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
Expand Down
26 changes: 13 additions & 13 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<T> Rc<T> {
///
/// let weak_five = five.downgrade();
/// ```
#[experimental = "Weak pointers may not belong in this module"]
#[unstable = "Weak pointers may not belong in this module"]
pub fn downgrade(&self) -> Weak<T> {
self.inc_weak();
Weak {
Expand All @@ -234,12 +234,12 @@ impl<T> Rc<T> {

/// Get the number of weak references to this value.
#[inline]
#[experimental]
#[unstable]
pub fn weak_count<T>(this: &Rc<T>) -> uint { this.weak() - 1 }

/// Get the number of strong references to this value.
#[inline]
#[experimental]
#[unstable]
pub fn strong_count<T>(this: &Rc<T>) -> uint { this.strong() }

/// Returns true if there are no other `Rc` or `Weak<T>` values that share the same inner value.
Expand All @@ -255,7 +255,7 @@ pub fn strong_count<T>(this: &Rc<T>) -> uint { this.strong() }
/// rc::is_unique(&five);
/// ```
#[inline]
#[experimental]
#[unstable]
pub fn is_unique<T>(rc: &Rc<T>) -> bool {
weak_count(rc) == 0 && strong_count(rc) == 1
}
Expand All @@ -277,7 +277,7 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool {
/// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4u)));
/// ```
#[inline]
#[experimental]
#[unstable]
pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
if is_unique(&rc) {
unsafe {
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> {
/// assert!(rc::get_mut(&mut x).is_none());
/// ```
#[inline]
#[experimental]
#[unstable]
pub fn get_mut<'a, T>(rc: &'a mut Rc<T>) -> Option<&'a mut T> {
if is_unique(rc) {
let inner = unsafe { &mut **rc._ptr };
Expand All @@ -337,7 +337,7 @@ impl<T: Clone> Rc<T> {
/// let mut_five = five.make_unique();
/// ```
#[inline]
#[experimental]
#[unstable]
pub fn make_unique(&mut self) -> &mut T {
if !is_unique(self) {
*self = Rc::new((**self).clone())
Expand Down Expand Up @@ -615,7 +615,7 @@ impl<S: hash::Hasher, T: Hash<S>> Hash<S> for Rc<T> {
}
}

#[experimental = "Show is experimental."]
#[unstable = "Show is experimental."]
impl<T: fmt::Show> fmt::Show for Rc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Rc({:?})", **self)
Expand All @@ -635,7 +635,7 @@ impl<T: fmt::String> fmt::String for Rc<T> {
///
/// See the [module level documentation](../index.html) for more.
#[unsafe_no_drop_flag]
#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
pub struct Weak<T> {
// FIXME #12808: strange names to try to avoid interfering with
// field accesses of the contained type via Deref
Expand All @@ -644,7 +644,7 @@ pub struct Weak<T> {
_noshare: marker::NoSync
}

#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
impl<T> Weak<T> {
/// Upgrades a weak reference to a strong reference.
///
Expand Down Expand Up @@ -717,7 +717,7 @@ impl<T> Drop for Weak<T> {
}
}

#[experimental = "Weak pointers may not belong in this module."]
#[unstable = "Weak pointers may not belong in this module."]
impl<T> Clone for Weak<T> {
/// Makes a clone of the `Weak<T>`.
///
Expand All @@ -739,7 +739,7 @@ impl<T> Clone for Weak<T> {
}
}

#[experimental = "Show is experimental."]
#[unstable = "Show is experimental."]
impl<T: fmt::Show> fmt::Show for Weak<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "(Weak)")
Expand Down Expand Up @@ -780,7 +780,7 @@ impl<T> RcBoxPtr<T> for Weak<T> {
}

#[cfg(test)]
#[allow(experimental)]
#[allow(unstable)]
mod tests {
use super::{Rc, Weak, weak_count, strong_count};
use std::cell::RefCell;
Expand Down
2 changes: 1 addition & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! more complex, slower arena which can hold objects of any type.
#![crate_name = "arena"]
#![experimental]
#![unstable]
#![staged_api]
#![crate_type = "rlib"]
#![crate_type = "dylib"]
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#![crate_name = "collections"]
#![experimental]
#![unstable]
#![staged_api]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
Expand Down
34 changes: 17 additions & 17 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub trait SliceExt {
/// assert_eq!(num_moved, 3);
/// assert!(a == [6i, 7, 8, 4, 5]);
/// ```
#[experimental = "uncertain about this API approach"]
#[unstable = "uncertain about this API approach"]
fn move_from(&mut self, src: Vec<Self::Item>, start: uint, end: uint) -> uint;

/// Returns a subslice spanning the interval [`start`, `end`).
Expand All @@ -175,23 +175,23 @@ pub trait SliceExt {
/// original slice (i.e. when `end > self.len()`) or when `start > end`.
///
/// Slicing with `start` equal to `end` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice(&self, start: uint, end: uint) -> &[Self::Item];

/// Returns a subslice from `start` to the end of the slice.
///
/// Panics when `start` is strictly greater than the length of the original slice.
///
/// Slicing from `self.len()` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice_from(&self, start: uint) -> &[Self::Item];

/// Returns a subslice from the start of the slice to `end`.
///
/// Panics when `end` is strictly greater than the length of the original slice.
///
/// Slicing to `0` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice_to(&self, end: uint) -> &[Self::Item];

/// Divides one slice into two at an index.
Expand Down Expand Up @@ -284,11 +284,11 @@ pub trait SliceExt {
fn first(&self) -> Option<&Self::Item>;

/// Returns all but the first element of a slice.
#[experimental = "likely to be renamed"]
#[unstable = "likely to be renamed"]
fn tail(&self) -> &[Self::Item];

/// Returns all but the last element of a slice.
#[experimental = "likely to be renamed"]
#[unstable = "likely to be renamed"]
fn init(&self) -> &[Self::Item];

/// Returns the last element of a slice, or `None` if it is empty.
Expand Down Expand Up @@ -384,23 +384,23 @@ pub trait SliceExt {
/// original slice (i.e. when `end > self.len()`) or when `start > end`.
///
/// Slicing with `start` equal to `end` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice_mut(&mut self, start: uint, end: uint) -> &mut [Self::Item];

/// Returns a mutable subslice from `start` to the end of the slice.
///
/// Panics when `start` is strictly greater than the length of the original slice.
///
/// Slicing from `self.len()` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice_from_mut(&mut self, start: uint) -> &mut [Self::Item];

/// Returns a mutable subslice from the start of the slice to `end`.
///
/// Panics when `end` is strictly greater than the length of the original slice.
///
/// Slicing to `0` yields an empty slice.
#[experimental = "will be replaced by slice syntax"]
#[unstable = "will be replaced by slice syntax"]
fn slice_to_mut(&mut self, end: uint) -> &mut [Self::Item];

/// Returns an iterator that allows modifying each value
Expand All @@ -412,11 +412,11 @@ pub trait SliceExt {
fn first_mut(&mut self) -> Option<&mut Self::Item>;

/// Returns all but the first element of a mutable slice
#[experimental = "likely to be renamed or removed"]
#[unstable = "likely to be renamed or removed"]
fn tail_mut(&mut self) -> &mut [Self::Item];

/// Returns all but the last element of a mutable slice
#[experimental = "likely to be renamed or removed"]
#[unstable = "likely to be renamed or removed"]
fn init_mut(&mut self) -> &mut [Self::Item];

/// Returns a mutable pointer to the last item in the slice.
Expand Down Expand Up @@ -588,7 +588,7 @@ pub trait SliceExt {
/// assert!(dst.clone_from_slice(&src2) == 3);
/// assert!(dst == [3i, 4, 5]);
/// ```
#[experimental]
#[unstable]
fn clone_from_slice(&mut self, &[Self::Item]) -> uint where Self::Item: Clone;

/// Sorts the slice, in place.
Expand Down Expand Up @@ -677,11 +677,11 @@ pub trait SliceExt {
fn prev_permutation(&mut self) -> bool where Self::Item: Ord;

/// Find the first index containing a matching value.
#[experimental]
#[unstable]
fn position_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;

/// Find the last index containing a matching value.
#[experimental]
#[unstable]
fn rposition_elem(&self, t: &Self::Item) -> Option<uint> where Self::Item: PartialEq;

/// Return true if the slice contains an element with the given value.
Expand All @@ -697,7 +697,7 @@ pub trait SliceExt {
fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;

/// Convert `self` into a vector without clones or allocation.
#[experimental]
#[unstable]
fn into_vec(self: Box<Self>) -> Vec<Self::Item>;
}

Expand Down Expand Up @@ -1034,7 +1034,7 @@ impl<T: Clone, V: AsSlice<T>> SliceConcatExt<T, Vec<T>> for [V] {
///
/// The last generated swap is always (0, 1), and it returns the
/// sequence to its initial order.
#[experimental]
#[unstable]
#[derive(Clone)]
pub struct ElementSwaps {
sdir: Vec<SizeDirection>,
Expand All @@ -1046,7 +1046,7 @@ pub struct ElementSwaps {

impl ElementSwaps {
/// Creates an `ElementSwaps` iterator for a sequence of `length` elements.
#[experimental]
#[unstable]
pub fn new(length: uint) -> ElementSwaps {
// Initialize `sdir` with a direction that position should move in
// (all negative at the beginning) and the `size` of the
Expand Down
Loading

11 comments on commit 1f70acb

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at brson@1f70acb

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/feature-staging2 = 1f70acb into auto

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "f255d26d1c0f3ee6379c454f22a4f8eb04fd326f"}

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/feature-staging2 = 1f70acb merged ok, testing candidate = f255d26d

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at brson@1f70acb

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/feature-staging2 = 1f70acb into auto

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "544a45aee98eeb1531813a091bc9bc90a1e5bcff"}

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/feature-staging2 = 1f70acb merged ok, testing candidate = 544a45ae

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 1f70acb Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.