diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-01-28 23:03:36 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-01-28 23:31:03 +0530 |
| commit | c709ed2faf4ea28df1395a924453b5298b87fa57 (patch) | |
| tree | 9567cea197e37b96607f471b18dd1c77908c8965 /src/libstd | |
| parent | 249c29fe2746d251dc8aab63cd8730df9ff8434c (diff) | |
| parent | a45e117733b866302fa99390553d1c548508dcca (diff) | |
| download | rust-c709ed2faf4ea28df1395a924453b5298b87fa57.tar.gz rust-c709ed2faf4ea28df1395a924453b5298b87fa57.zip | |
Merge remote-tracking branch 'origin/master' into rollup
Conflicts: src/libcollections/slice.rs src/libcore/nonzero.rs src/libcore/ops.rs
Diffstat (limited to 'src/libstd')
74 files changed, 632 insertions, 498 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 77c2315194b..9aa38e711e7 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -12,7 +12,8 @@ //! Operations on ASCII strings and characters -#![unstable = "unsure about placement and naming"] +#![unstable(feature = "std_misc", + reason = "unsure about placement and naming")] use iter::IteratorExt; use ops::FnMut; @@ -22,7 +23,8 @@ use string::String; use vec::Vec; /// Extension methods for ASCII-subset only operations on owned strings -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] pub trait OwnedAsciiExt { /// Convert the string to ASCII upper case: /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z', @@ -36,7 +38,8 @@ pub trait OwnedAsciiExt { } /// Extension methods for ASCII-subset only operations on string slices -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] pub trait AsciiExt<T = Self> { /// Check if within the ASCII range. fn is_ascii(&self) -> bool; @@ -57,7 +60,8 @@ pub trait AsciiExt<T = Self> { fn eq_ignore_ascii_case(&self, other: &Self) -> bool; } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl AsciiExt<String> for str { #[inline] fn is_ascii(&self) -> bool { @@ -82,7 +86,8 @@ impl AsciiExt<String> for str { } } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl OwnedAsciiExt for String { #[inline] fn into_ascii_uppercase(self) -> String { @@ -97,7 +102,8 @@ impl OwnedAsciiExt for String { } } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl AsciiExt<Vec<u8>> for [u8] { #[inline] fn is_ascii(&self) -> bool { @@ -123,7 +129,8 @@ impl AsciiExt<Vec<u8>> for [u8] { } } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl OwnedAsciiExt for Vec<u8> { #[inline] fn into_ascii_uppercase(mut self) -> Vec<u8> { @@ -142,7 +149,8 @@ impl OwnedAsciiExt for Vec<u8> { } } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl AsciiExt for u8 { #[inline] fn is_ascii(&self) -> bool { @@ -165,7 +173,8 @@ impl AsciiExt for u8 { } } -#[unstable = "would prefer to do this in a more general way"] +#[unstable(feature = "std_misc", + reason = "would prefer to do this in a more general way")] impl AsciiExt for char { #[inline] fn is_ascii(&self) -> bool { @@ -207,7 +216,8 @@ impl AsciiExt for char { /// - Any other chars in the range [0x20,0x7e] are not escaped. /// - Any other chars are given hex escapes. /// - Unicode escapes are never generated by this function. -#[unstable = "needs to be updated to use an iterator"] +#[unstable(feature = "std_misc", + reason = "needs to be updated to use an iterator")] pub fn escape_default<F>(c: u8, mut f: F) where F: FnMut(u8), { diff --git a/src/libstd/bool.rs b/src/libstd/bool.rs index bbaab5ee3db..0d8b233a169 100644 --- a/src/libstd/bool.rs +++ b/src/libstd/bool.rs @@ -11,5 +11,5 @@ //! The boolean type #![doc(primitive = "bool")] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 342d00a23c8..ae295c3e8e4 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -296,7 +296,7 @@ fn test_resize_policy() { /// } /// ``` #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct HashMap<K, V, S = RandomState> { // All hashes are keyed on these values, to prevent hash collision attacks. hash_state: S, @@ -499,7 +499,7 @@ impl<K: Hash<Hasher> + Eq, V> HashMap<K, V, RandomState> { /// let mut map: HashMap<&str, int> = HashMap::new(); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> HashMap<K, V, RandomState> { Default::default() } @@ -513,7 +513,7 @@ impl<K: Hash<Hasher> + Eq, V> HashMap<K, V, RandomState> { /// let mut map: HashMap<&str, int> = HashMap::with_capacity(10); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn with_capacity(capacity: uint) -> HashMap<K, V, RandomState> { HashMap::with_capacity_and_hash_state(capacity, Default::default()) } @@ -539,7 +539,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// map.insert(1i, 2u); /// ``` #[inline] - #[unstable = "hasher stuff is unclear"] + #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub fn with_hash_state(hash_state: S) -> HashMap<K, V, S> { HashMap { hash_state: hash_state, @@ -567,7 +567,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// map.insert(1i, 2u); /// ``` #[inline] - #[unstable = "hasher stuff is unclear"] + #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S) -> HashMap<K, V, S> { let resize_policy = DefaultResizePolicy::new(); @@ -591,7 +591,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert!(map.capacity() >= 100); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn capacity(&self) -> uint { self.resize_policy.usable_capacity(self.table.capacity()) } @@ -611,7 +611,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// let mut map: HashMap<&str, int> = HashMap::new(); /// map.reserve(10); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn reserve(&mut self, additional: uint) { let new_size = self.len().checked_add(additional).expect("capacity overflow"); let min_cap = self.resize_policy.min_capacity(new_size); @@ -723,7 +723,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// map.shrink_to_fit(); /// assert!(map.capacity() >= 2); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn shrink_to_fit(&mut self) { let min_capacity = self.resize_policy.min_capacity(self.len()); let min_capacity = max(min_capacity.next_power_of_two(), INITIAL_CAPACITY); @@ -817,7 +817,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// println!("{}", key); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn keys<'a>(&'a self) -> Keys<'a, K, V> { fn first<A, B>((a, _): (A, B)) -> A { a } let first: fn((&'a K,&'a V)) -> &'a K = first; // coerce to fn ptr @@ -842,7 +842,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// println!("{}", val); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn values<'a>(&'a self) -> Values<'a, K, V> { fn second<A, B>((_, b): (A, B)) -> B { b } let second: fn((&'a K,&'a V)) -> &'a V = second; // coerce to fn ptr @@ -867,7 +867,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// println!("key: {} val: {}", key, val); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<K, V> { Iter { inner: self.table.iter() } } @@ -895,7 +895,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// println!("key: {} val: {}", key, val); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter_mut(&mut self) -> IterMut<K, V> { IterMut { inner: self.table.iter_mut() } } @@ -917,7 +917,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// // Not possible with .iter() /// let vec: Vec<(&str, int)> = map.into_iter().collect(); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn into_iter(self) -> IntoIter<K, V> { fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) } let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; @@ -928,7 +928,8 @@ impl<K, V, S, H> HashMap<K, V, S> } /// Gets the given key's corresponding entry in the map for in-place manipulation. - #[unstable = "precise API still being fleshed out"] + #[unstable(feature = "std_misc", + reason = "precise API still being fleshed out")] pub fn entry<'a>(&'a mut self, key: K) -> Entry<'a, K, V> { // Gotta resize now. @@ -950,7 +951,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// a.insert(1u, "a"); /// assert_eq!(a.len(), 1); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> uint { self.table.size() } /// Returns true if the map contains no elements. @@ -966,7 +967,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert!(!a.is_empty()); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.len() == 0 } /// Clears the map, returning all key-value pairs as an iterator. Keeps the @@ -989,7 +990,8 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert!(a.is_empty()); /// ``` #[inline] - #[unstable = "matches collection reform specification, waiting for dust to settle"] + #[unstable(feature = "std_misc", + reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain(&mut self) -> Drain<K, V> { fn last_two<A, B, C>((_, b, c): (A, B, C)) -> (B, C) { (b, c) } let last_two: fn((SafeHash, K, V)) -> (K, V) = last_two; // coerce to fn pointer @@ -1012,7 +1014,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// a.clear(); /// assert!(a.is_empty()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn clear(&mut self) { self.drain(); @@ -1034,7 +1036,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert_eq!(map.get(&1), Some(&"a")); /// assert_eq!(map.get(&2), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V> where Q: Hash<H> + Eq + BorrowFrom<K> { @@ -1057,7 +1059,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert_eq!(map.contains_key(&1), true); /// assert_eq!(map.contains_key(&2), false); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool where Q: Hash<H> + Eq + BorrowFrom<K> { @@ -1083,7 +1085,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// } /// assert_eq!(map[1], "b"); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V> where Q: Hash<H> + Eq + BorrowFrom<K> { @@ -1106,7 +1108,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert_eq!(map.insert(37, "c"), Some("b")); /// assert_eq!(map[37], "c"); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn insert(&mut self, k: K, v: V) -> Option<V> { let hash = self.make_hash(&k); self.reserve(1); @@ -1135,7 +1137,7 @@ impl<K, V, S, H> HashMap<K, V, S> /// assert_eq!(map.remove(&1), Some("a")); /// assert_eq!(map.remove(&1), None); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V> where Q: Hash<H> + Eq + BorrowFrom<K> { @@ -1208,14 +1210,14 @@ impl<K, V, S, H> PartialEq for HashMap<K, V, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H> Eq for HashMap<K, V, S> where K: Eq + Hash<H>, V: Eq, S: HashState<Hasher=H>, H: hash::Hasher<Output=u64> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H> Debug for HashMap<K, V, S> where K: Eq + Hash<H> + Debug, V: Debug, S: HashState<Hasher=H>, @@ -1233,7 +1235,7 @@ impl<K, V, S, H> Debug for HashMap<K, V, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H> Default for HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H> + Default, @@ -1244,7 +1246,7 @@ impl<K, V, S, H> Default for HashMap<K, V, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, Q: ?Sized, V, S, H> Index<Q> for HashMap<K, V, S> where K: Eq + Hash<H>, Q: Eq + Hash<H> + BorrowFrom<K>, @@ -1259,7 +1261,7 @@ impl<K, Q: ?Sized, V, S, H> Index<Q> for HashMap<K, V, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S> where K: Eq + Hash<H>, Q: Eq + Hash<H> + BorrowFrom<K>, @@ -1275,7 +1277,7 @@ impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S> } /// HashMap iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, K: 'a, V: 'a> { inner: table::Iter<'a, K, V> } @@ -1290,13 +1292,13 @@ impl<'a, K, V> Clone for Iter<'a, K, V> { } /// HashMap mutable values iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, K: 'a, V: 'a> { inner: table::IterMut<'a, K, V> } /// HashMap move iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter<K, V> { inner: iter::Map< (SafeHash, K, V), @@ -1307,7 +1309,7 @@ pub struct IntoIter<K, V> { } /// HashMap keys iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Keys<'a, K: 'a, V: 'a> { inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K> } @@ -1322,7 +1324,7 @@ impl<'a, K, V> Clone for Keys<'a, K, V> { } /// HashMap values iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Values<'a, K: 'a, V: 'a> { inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V> } @@ -1337,7 +1339,8 @@ impl<'a, K, V> Clone for Values<'a, K, V> { } /// HashMap drain iterator. -#[unstable = "matches collection reform specification, waiting for dust to settle"] +#[unstable(feature = "std_misc", + reason = "matches collection reform specification, waiting for dust to settle")] pub struct Drain<'a, K: 'a, V: 'a> { inner: iter::Map< (SafeHash, K, V), @@ -1348,13 +1351,15 @@ pub struct Drain<'a, K: 'a, V: 'a> { } /// A view into a single occupied location in a HashMap. -#[unstable = "precise API still being fleshed out"] +#[unstable(feature = "std_misc", + reason = "precise API still being fleshed out")] pub struct OccupiedEntry<'a, K: 'a, V: 'a> { elem: FullBucket<K, V, &'a mut RawTable<K, V>>, } /// A view into a single empty location in a HashMap. -#[unstable = "precise API still being fleshed out"] +#[unstable(feature = "std_misc", + reason = "precise API still being fleshed out")] pub struct VacantEntry<'a, K: 'a, V: 'a> { hash: SafeHash, key: K, @@ -1362,7 +1367,8 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> { } /// A view into a single location in a map, which may be vacant or occupied. -#[unstable = "precise API still being fleshed out"] +#[unstable(feature = "std_misc", + reason = "precise API still being fleshed out")] pub enum Entry<'a, K: 'a, V: 'a> { /// An occupied Entry. Occupied(OccupiedEntry<'a, K, V>), @@ -1379,79 +1385,80 @@ enum VacantEntryState<K, V, M> { NoElem(EmptyBucket<K, V, M>), } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for Iter<'a, K, V> { type Item = (&'a K, &'a V); #[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for IterMut<'a, K, V> { type Item = (&'a K, &'a mut V); #[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V> Iterator for IntoIter<K, V> { type Item = (K, V); #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V> ExactSizeIterator for IntoIter<K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for Keys<'a, K, V> { type Item = &'a K; #[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for Values<'a, K, V> { type Item = &'a V; #[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for Drain<'a, K, V> { type Item = (K, V); #[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.inner.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> { #[inline] fn len(&self) -> usize { self.inner.len() } } -#[unstable = "matches collection reform v2 specification, waiting for dust to settle"] +#[unstable(feature = "std_misc", + reason = "matches collection reform v2 specification, waiting for dust to settle")] impl<'a, K, V> Entry<'a, K, V> { /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant. pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> { @@ -1462,7 +1469,8 @@ impl<'a, K, V> Entry<'a, K, V> { } } -#[unstable = "matches collection reform v2 specification, waiting for dust to settle"] +#[unstable(feature = "std_misc", + reason = "matches collection reform v2 specification, waiting for dust to settle")] impl<'a, K, V> OccupiedEntry<'a, K, V> { /// Gets a reference to the value in the entry. pub fn get(&self) -> &V { @@ -1493,7 +1501,8 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> { } } -#[unstable = "matches collection reform v2 specification, waiting for dust to settle"] +#[unstable(feature = "std_misc", + reason = "matches collection reform v2 specification, waiting for dust to settle")] impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { /// Sets the value of the entry with the VacantEntry's key, /// and returns a mutable reference to it @@ -1509,7 +1518,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H> + Default, @@ -1524,7 +1533,7 @@ impl<K, V, S, H> FromIterator<(K, V)> for HashMap<K, V, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -1545,13 +1554,15 @@ impl<K, V, S, H> Extend<(K, V)> for HashMap<K, V, S> /// instances are unlikely to produce the same result for the same values. #[derive(Clone)] #[allow(missing_copy_implementations)] -#[unstable = "hashing an hash maps may be altered"] +#[unstable(feature = "std_misc", + reason = "hashing an hash maps may be altered")] pub struct RandomState { k0: u64, k1: u64, } -#[unstable = "hashing an hash maps may be altered"] +#[unstable(feature = "std_misc", + reason = "hashing an hash maps may be altered")] impl RandomState { /// Construct a new `RandomState` that is initialized with random keys. #[inline] @@ -1561,7 +1572,8 @@ impl RandomState { } } -#[unstable = "hashing an hash maps may be altered"] +#[unstable(feature = "std_misc", + reason = "hashing an hash maps may be altered")] impl HashState for RandomState { type Hasher = Hasher; fn hasher(&self) -> Hasher { @@ -1569,7 +1581,8 @@ impl HashState for RandomState { } } -#[unstable = "hashing an hash maps may be altered"] +#[unstable(feature = "std_misc", + reason = "hashing an hash maps may be altered")] impl Default for RandomState { #[inline] fn default() -> RandomState { diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 29e247d96d2..84f01f70c3e 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -90,7 +90,7 @@ use super::state::HashState; /// } /// ``` #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct HashSet<T, S = RandomState> { map: HashMap<T, (), S> } @@ -105,7 +105,7 @@ impl<T: Hash<Hasher> + Eq> HashSet<T, RandomState> { /// let mut set: HashSet<int> = HashSet::new(); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> HashSet<T, RandomState> { HashSet::with_capacity(INITIAL_CAPACITY) } @@ -120,7 +120,7 @@ impl<T: Hash<Hasher> + Eq> HashSet<T, RandomState> { /// let mut set: HashSet<int> = HashSet::with_capacity(10); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn with_capacity(capacity: uint) -> HashSet<T, RandomState> { HashSet { map: HashMap::with_capacity(capacity) } } @@ -147,7 +147,7 @@ impl<T, S, H> HashSet<T, S> /// set.insert(2u); /// ``` #[inline] - #[unstable = "hasher stuff is unclear"] + #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub fn with_hash_state(hash_state: S) -> HashSet<T, S> { HashSet::with_capacity_and_hash_state(INITIAL_CAPACITY, hash_state) } @@ -171,7 +171,7 @@ impl<T, S, H> HashSet<T, S> /// set.insert(1i); /// ``` #[inline] - #[unstable = "hasher stuff is unclear"] + #[unstable(feature = "std_misc", reason = "hasher stuff is unclear")] pub fn with_capacity_and_hash_state(capacity: uint, hash_state: S) -> HashSet<T, S> { HashSet { @@ -189,7 +189,7 @@ impl<T, S, H> HashSet<T, S> /// assert!(set.capacity() >= 100); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn capacity(&self) -> uint { self.map.capacity() } @@ -209,7 +209,7 @@ impl<T, S, H> HashSet<T, S> /// let mut set: HashSet<int> = HashSet::new(); /// set.reserve(10); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn reserve(&mut self, additional: uint) { self.map.reserve(additional) } @@ -230,7 +230,7 @@ impl<T, S, H> HashSet<T, S> /// set.shrink_to_fit(); /// assert!(set.capacity() >= 2); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn shrink_to_fit(&mut self) { self.map.shrink_to_fit() } @@ -251,7 +251,7 @@ impl<T, S, H> HashSet<T, S> /// println!("{}", x); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<T> { Iter { iter: self.map.keys() } } @@ -276,7 +276,7 @@ impl<T, S, H> HashSet<T, S> /// println!("{}", x); /// } /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn into_iter(self) -> IntoIter<T> { fn first<A, B>((a, _): (A, B)) -> A { a } let first: fn((T, ())) -> T = first; @@ -306,7 +306,7 @@ impl<T, S, H> HashSet<T, S> /// let diff: HashSet<int> = b.difference(&a).map(|&x| x).collect(); /// assert_eq!(diff, [4i].iter().map(|&x| x).collect()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S> { Difference { iter: self.iter(), @@ -334,7 +334,7 @@ impl<T, S, H> HashSet<T, S> /// assert_eq!(diff1, diff2); /// assert_eq!(diff1, [1i, 4].iter().map(|&x| x).collect()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn symmetric_difference<'a>(&'a self, other: &'a HashSet<T, S>) -> SymmetricDifference<'a, T, S> { SymmetricDifference { iter: self.difference(other).chain(other.difference(self)) } @@ -357,7 +357,7 @@ impl<T, S, H> HashSet<T, S> /// let diff: HashSet<int> = a.intersection(&b).map(|&x| x).collect(); /// assert_eq!(diff, [2i, 3].iter().map(|&x| x).collect()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> { Intersection { iter: self.iter(), @@ -382,7 +382,7 @@ impl<T, S, H> HashSet<T, S> /// let diff: HashSet<int> = a.union(&b).map(|&x| x).collect(); /// assert_eq!(diff, [1i, 2, 3, 4].iter().map(|&x| x).collect()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> { Union { iter: self.iter().chain(other.difference(self)) } } @@ -399,7 +399,7 @@ impl<T, S, H> HashSet<T, S> /// v.insert(1u); /// assert_eq!(v.len(), 1); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn len(&self) -> uint { self.map.len() } /// Returns true if the set contains no elements @@ -414,12 +414,13 @@ impl<T, S, H> HashSet<T, S> /// v.insert(1u); /// assert!(!v.is_empty()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_empty(&self) -> bool { self.map.len() == 0 } /// Clears the set, returning all elements in an iterator. #[inline] - #[unstable = "matches collection reform specification, waiting for dust to settle"] + #[unstable(feature = "std_misc", + reason = "matches collection reform specification, waiting for dust to settle")] pub fn drain(&mut self) -> Drain<T> { fn first<A, B>((a, _): (A, B)) -> A { a } let first: fn((T, ())) -> T = first; // coerce to fn pointer @@ -439,7 +440,7 @@ impl<T, S, H> HashSet<T, S> /// v.clear(); /// assert!(v.is_empty()); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn clear(&mut self) { self.map.clear() } /// Returns `true` if the set contains a value. @@ -457,7 +458,7 @@ impl<T, S, H> HashSet<T, S> /// assert_eq!(set.contains(&1), true); /// assert_eq!(set.contains(&4), false); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where Q: BorrowFrom<T> + Hash<H> + Eq { @@ -481,7 +482,7 @@ impl<T, S, H> HashSet<T, S> /// b.insert(1); /// assert_eq!(a.is_disjoint(&b), false); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool { self.iter().all(|v| !other.contains(v)) } @@ -502,7 +503,7 @@ impl<T, S, H> HashSet<T, S> /// set.insert(4); /// assert_eq!(set.is_subset(&sup), false); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_subset(&self, other: &HashSet<T, S>) -> bool { self.iter().all(|v| other.contains(v)) } @@ -527,7 +528,7 @@ impl<T, S, H> HashSet<T, S> /// assert_eq!(set.is_superset(&sub), true); /// ``` #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_superset(&self, other: &HashSet<T, S>) -> bool { other.is_subset(self) } @@ -546,7 +547,7 @@ impl<T, S, H> HashSet<T, S> /// assert_eq!(set.insert(2), false); /// assert_eq!(set.len(), 1); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()).is_none() } /// Removes a value from the set. Returns `true` if the value was @@ -567,7 +568,7 @@ impl<T, S, H> HashSet<T, S> /// assert_eq!(set.remove(&2), true); /// assert_eq!(set.remove(&2), false); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where Q: BorrowFrom<T> + Hash<H> + Eq { @@ -575,7 +576,7 @@ impl<T, S, H> HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> PartialEq for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -588,14 +589,14 @@ impl<T, S, H> PartialEq for HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> Eq for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, H: hash::Hasher<Output=u64> {} -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> fmt::Debug for HashSet<T, S> where T: Eq + Hash<H> + fmt::Debug, S: HashState<Hasher=H>, @@ -613,7 +614,7 @@ impl<T, S, H> fmt::Debug for HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> FromIterator<T> for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H> + Default, @@ -627,7 +628,7 @@ impl<T, S, H> FromIterator<T> for HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> Extend<T> for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -640,19 +641,19 @@ impl<T, S, H> Extend<T> for HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T, S, H> Default for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H> + Default, H: hash::Hasher<Output=u64> { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn default() -> HashSet<T, S> { HashSet::with_hash_state(Default::default()) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> where T: Eq + Hash<H> + Clone, S: HashState<Hasher=H> + Default, @@ -685,7 +686,7 @@ impl<'a, 'b, T, S, H> BitOr<&'b HashSet<T, S>> for &'a HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> where T: Eq + Hash<H> + Clone, S: HashState<Hasher=H> + Default, @@ -718,7 +719,7 @@ impl<'a, 'b, T, S, H> BitAnd<&'b HashSet<T, S>> for &'a HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> where T: Eq + Hash<H> + Clone, S: HashState<Hasher=H> + Default, @@ -751,7 +752,7 @@ impl<'a, 'b, T, S, H> BitXor<&'b HashSet<T, S>> for &'a HashSet<T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S> where T: Eq + Hash<H> + Clone, S: HashState<Hasher=H> + Default, @@ -785,25 +786,25 @@ impl<'a, 'b, T, S, H> Sub<&'b HashSet<T, S>> for &'a HashSet<T, S> } /// HashSet iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, K: 'a> { iter: Keys<'a, K, ()> } /// HashSet move iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter<K> { iter: Map<(K, ()), K, map::IntoIter<K, ()>, fn((K, ())) -> K> } /// HashSet drain iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Drain<'a, K: 'a> { iter: Map<(K, ()), K, map::Drain<'a, K, ()>, fn((K, ())) -> K>, } /// Intersection iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Intersection<'a, T: 'a, S: 'a> { // iterator of the first set iter: Iter<'a, T>, @@ -812,7 +813,7 @@ pub struct Intersection<'a, T: 'a, S: 'a> { } /// Difference iterator -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Difference<'a, T: 'a, S: 'a> { // iterator of the first set iter: Iter<'a, T>, @@ -821,54 +822,54 @@ pub struct Difference<'a, T: 'a, S: 'a> { } /// Symmetric difference iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SymmetricDifference<'a, T: 'a, S: 'a> { iter: Chain<Difference<'a, T, S>, Difference<'a, T, S>> } /// Set union iterator. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Union<'a, T: 'a, S: 'a> { iter: Chain<Iter<'a, T>, Difference<'a, T, S>> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K> Iterator for Iter<'a, K> { type Item = &'a K; fn next(&mut self) -> Option<&'a K> { self.iter.next() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K> ExactSizeIterator for Iter<'a, K> { fn len(&self) -> usize { self.iter.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K> Iterator for IntoIter<K> { type Item = K; fn next(&mut self) -> Option<K> { self.iter.next() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<K> ExactSizeIterator for IntoIter<K> { fn len(&self) -> usize { self.iter.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K> Iterator for Drain<'a, K> { type Item = K; fn next(&mut self) -> Option<K> { self.iter.next() } fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, K> ExactSizeIterator for Drain<'a, K> { fn len(&self) -> usize { self.iter.len() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, S, H> Iterator for Intersection<'a, T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -893,7 +894,7 @@ impl<'a, T, S, H> Iterator for Intersection<'a, T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, S, H> Iterator for Difference<'a, T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -918,7 +919,7 @@ impl<'a, T, S, H> Iterator for Difference<'a, T, S> } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -930,7 +931,7 @@ impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, S> fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T, S, H> Iterator for Union<'a, T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index d810460a7d4..9e6a45d8bf0 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -629,7 +629,6 @@ impl<K, V> RawTable<K, V> { /// Creates a new raw table from a given capacity. All buckets are /// initially empty. - #[allow(unstable)] pub fn new(capacity: uint) -> RawTable<K, V> { unsafe { let ret = RawTable::new_uninitialized(capacity); diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 21bea5dcdcb..0c55850b32a 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -359,7 +359,7 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] pub use core_collections::Bound; pub use core_collections::{BinaryHeap, Bitv, BitvSet, BTreeMap, BTreeSet}; @@ -373,13 +373,13 @@ pub use self::hash_set::HashSet; mod hash; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub mod hash_map { //! A hashmap pub use super::hash::map::*; } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub mod hash_set { //! A hashset pub use super::hash::set::*; @@ -387,7 +387,7 @@ pub mod hash_set { /// Experimental support for providing custom hash algorithms to a HashMap and /// HashSet. -#[unstable = "module was recently added"] +#[unstable(feature = "std_misc", reason = "module was recently added")] pub mod hash_state { pub use super::hash::state::*; } diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index db1239ae5b5..f35f63143ef 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -12,7 +12,7 @@ //! //! A simple wrapper over the platform's dynamic library facilities -#![unstable] +#![unstable(feature = "std_misc")] #![allow(missing_docs)] use prelude::v1::*; diff --git a/src/libstd/failure.rs b/src/libstd/failure.rs index fdf522baf5c..c184d3f4661 100644 --- a/src/libstd/failure.rs +++ b/src/libstd/failure.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable] +#![unstable(feature = "std_misc")] use prelude::v1::*; diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 7d0e42e8e49..fdd7aa216d3 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -119,7 +119,7 @@ impl Deref for CString { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for CString { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { String::from_utf8_lossy(self.as_bytes()).fmt(f) diff --git a/src/libstd/ffi/mod.rs b/src/libstd/ffi/mod.rs index 95ad6178bab..69ada28a4b4 100644 --- a/src/libstd/ffi/mod.rs +++ b/src/libstd/ffi/mod.rs @@ -10,8 +10,9 @@ //! Utilities related to FFI bindings. -#![unstable = "module just underwent fairly large reorganization and the dust \ - still needs to settle"] +#![unstable(feature = "std_misc", + reason = "module just underwent fairly large reorganization and the dust \ + still needs to settle")] pub use self::c_str::CString; pub use self::c_str::c_str_to_bytes; diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 9c5cf62f853..8fdc5547e46 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -29,7 +29,8 @@ //! for conversion to/from various other string types. Eventually these types //! will offer a full-fledged string API. -#![unstable = "recently added as part of path/io reform"] +#![unstable(feature = "os", + reason = "recently added as part of path/io reform")] use core::prelude::*; diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 5965a0ceffb..4ab43e875cd 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -401,7 +401,7 @@ //! them with the same character. For example, the `{` character is escaped with //! `{{` and the `}` character is escaped with `}}`. -#![unstable] +#![unstable(feature = "std_misc")] use string; @@ -431,8 +431,9 @@ pub use core::fmt::{argument, argumentuint}; /// let s = fmt::format(format_args!("Hello, {}!", "world")); /// assert_eq!(s, "Hello, world!".to_string()); /// ``` -#[unstable = "this is an implementation detail of format! and should not \ - be called directly"] +#[unstable(feature = "std_misc", + reason = "this is an implementation detail of format! and should not \ + be called directly")] pub fn format(args: Arguments) -> string::String { let mut output = string::String::new(); let _ = write!(&mut output, "{}", args); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 119e7c50196..3a745389e1e 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -96,7 +96,8 @@ //! and `format!`, also available to all Rust code. #![crate_name = "std"] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] +#![feature(staged_api)] #![staged_api] #![crate_type = "rlib"] #![crate_type = "dylib"] @@ -114,7 +115,14 @@ #![feature(optin_builtin_traits)] #![feature(int_uint)] #![feature(int_uint)] -#![allow(unstable)] +#![feature(core)] +#![feature(libc)] +#![feature(alloc)] +#![feature(unicode)] +#![feature(collections)] +#![feature(rand)] +#![feature(hash)] +#![cfg_attr(test, feature(test))] // Don't link to std. We are std. #![no_std] @@ -177,7 +185,7 @@ pub use alloc::rc; pub use core_collections::slice; pub use core_collections::str; pub use core_collections::string; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub use core_collections::vec; pub use unicode::char; diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 9f0276c744b..9c3285a9d08 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -14,7 +14,7 @@ //! library. Each macro is available for use when linking against the standard //! library. -#![unstable] +#![unstable(feature = "std_misc")] /// The entry point for panic of Rust tasks. /// @@ -36,7 +36,7 @@ /// panic!("this is a {} {message}", "fancy", message = "message"); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! panic { () => ({ panic!("explicit panic") @@ -71,7 +71,7 @@ macro_rules! panic { /// format!("x = {}, y = {y}", 10i, y = 30i); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! format { ($($arg:tt)*) => ($crate::fmt::format(format_args!($($arg)*))) } @@ -79,7 +79,7 @@ macro_rules! format { /// Equivalent to the `println!` macro except that a newline is not printed at /// the end of the message. #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! print { ($($arg:tt)*) => ($crate::old_io::stdio::print_args(format_args!($($arg)*))) } @@ -97,7 +97,7 @@ macro_rules! print { /// println!("format {} arguments", "some"); /// ``` #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! println { ($($arg:tt)*) => ($crate::old_io::stdio::println_args(format_args!($($arg)*))) } @@ -106,7 +106,7 @@ macro_rules! println { /// error if the value of the expression is `Err`. For more information, see /// `std::io`. #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! try { ($expr:expr) => (match $expr { $crate::result::Result::Ok(val) => val, @@ -148,7 +148,7 @@ macro_rules! try { /// /// For more information about select, see the `std::sync::mpsc::Select` structure. #[macro_export] -#[unstable] +#[unstable(feature = "std_misc")] macro_rules! select { ( $($name:pat = $rx:ident.$meth:ident() => $code:expr),+ diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index adbce893887..9b5b0e62a3c 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -10,7 +10,7 @@ //! Operations and constants for 32-bits floats (`f32` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] #![allow(unsigned_negation)] #![doc(primitive = "f32")] @@ -73,7 +73,7 @@ mod cmath { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Float for f32 { #[inline] fn nan() -> f32 { num::Float::nan() } @@ -366,7 +366,7 @@ impl Float for f32 { /// /// * num - The float value #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f32) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigAll, ExpNone, false); @@ -379,7 +379,7 @@ pub fn to_string(num: f32) -> String { /// /// * num - The float value #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f32) -> String { let (r, _) = strconv::float_to_str_common( num, 16u, true, SignNeg, DigAll, ExpNone, false); @@ -394,7 +394,7 @@ pub fn to_str_hex(num: f32) -> String { /// * num - The float value /// * radix - The base to use #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -407,7 +407,7 @@ pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { /// * num - The float value /// * digits - The number of significant digits #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); @@ -422,7 +422,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> String { /// * num - The float value /// * digits - The number of significant digits #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); @@ -438,7 +438,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> String { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); @@ -454,7 +454,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index baff14125ee..1c955832529 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -10,7 +10,7 @@ //! Operations and constants for 64-bits floats (`f64` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] #![doc(primitive = "f64")] @@ -81,7 +81,7 @@ mod cmath { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Float for f64 { // inlined methods from `num::Float` #[inline] @@ -375,7 +375,7 @@ impl Float for f64 { /// /// * num - The float value #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f64) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigAll, ExpNone, false); @@ -388,7 +388,7 @@ pub fn to_string(num: f64) -> String { /// /// * num - The float value #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f64) -> String { let (r, _) = strconv::float_to_str_common( num, 16u, true, SignNeg, DigAll, ExpNone, false); @@ -403,7 +403,7 @@ pub fn to_str_hex(num: f64) -> String { /// * num - The float value /// * radix - The base to use #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -416,7 +416,7 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { /// * num - The float value /// * digits - The number of significant digits #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); @@ -431,7 +431,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> String { /// * num - The float value /// * digits - The number of significant digits #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); @@ -447,7 +447,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> String { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); @@ -463,7 +463,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { /// * digits - The number of digits after the decimal point /// * upper - Use `E` instead of `e` for the exponent sign #[inline] -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); diff --git a/src/libstd/num/float_macros.rs b/src/libstd/num/float_macros.rs index ec168eaaa9d..2b730cd6f9a 100644 --- a/src/libstd/num/float_macros.rs +++ b/src/libstd/num/float_macros.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable] +#![unstable(feature = "std_misc")] #![doc(hidden)] macro_rules! assert_approx_eq { diff --git a/src/libstd/num/i16.rs b/src/libstd/num/i16.rs index 367147b84be..498f19b9b83 100644 --- a/src/libstd/num/i16.rs +++ b/src/libstd/num/i16.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 16-bits integers (`i16` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i16")] pub use core::i16::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i32.rs b/src/libstd/num/i32.rs index 19fb40c9644..aea1e92117b 100644 --- a/src/libstd/num/i32.rs +++ b/src/libstd/num/i32.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 32-bits integers (`i32` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i32")] pub use core::i32::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i64.rs b/src/libstd/num/i64.rs index 2379b03c64f..43794345fe7 100644 --- a/src/libstd/num/i64.rs +++ b/src/libstd/num/i64.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 64-bits integers (`i64` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i64")] pub use core::i64::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/i8.rs b/src/libstd/num/i8.rs index a09ceefc6a0..1b03bf6f4f0 100644 --- a/src/libstd/num/i8.rs +++ b/src/libstd/num/i8.rs @@ -10,7 +10,7 @@ //! Operations and constants for signed 8-bits integers (`i8` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "i8")] pub use core::i8::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/int.rs b/src/libstd/num/int.rs index 69439f85115..669952eee39 100644 --- a/src/libstd/num/int.rs +++ b/src/libstd/num/int.rs @@ -14,7 +14,8 @@ //! alpha cycle along with the development of clearer conventions //! around integer types. -#![deprecated = "replaced by isize"] +#![unstable(feature = "std_misc")] +#![deprecated(since = "1.0.0", reason = "replaced by isize")] pub use core::int::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 5bc54152874..af1976d5750 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable] +#![unstable(feature = "std_misc")] #![doc(hidden)] macro_rules! int_module { ($T:ty) => ( diff --git a/src/libstd/num/isize.rs b/src/libstd/num/isize.rs index 22395a1c0ff..7fb2cd81aba 100644 --- a/src/libstd/num/isize.rs +++ b/src/libstd/num/isize.rs @@ -14,7 +14,7 @@ //! new type will gradually take place over the alpha cycle along with //! the development of clearer conventions around integer types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "isize")] pub use core::isize::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 9ced1a7e130..dad8b70ceac 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -13,7 +13,7 @@ //! These are implemented for the primitive numeric types in `std::{u8, u16, //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![allow(missing_docs)] #[cfg(test)] use fmt::Debug; @@ -33,11 +33,11 @@ pub use core::num::{FpCategory}; use option::Option; -#[unstable = "may be removed or relocated"] +#[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub mod strconv; /// Mathematical operations on primitive floating point numbers. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub trait Float : Copy + Clone + NumCast @@ -52,172 +52,200 @@ pub trait Float { // inlined methods from `num::Float` /// Returns the NaN value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn nan() -> Self; /// Returns the infinite value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn infinity() -> Self; /// Returns the negative infinite value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn neg_infinity() -> Self; /// Returns the `0` value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn zero() -> Self; /// Returns -0.0. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn neg_zero() -> Self; /// Returns the `1` value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn one() -> Self; // FIXME (#5527): These should be associated constants /// Returns the number of binary digits of mantissa that this type supports. - #[deprecated = "use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MANTISSA_DIGITS` or \ + `std::f64::MANTISSA_DIGITS` as appropriate")] fn mantissa_digits(unused_self: Option<Self>) -> uint; /// Returns the number of base-10 digits of precision that this type supports. - #[deprecated = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")] fn digits(unused_self: Option<Self>) -> uint; /// Returns the difference between 1.0 and the smallest representable number larger than 1.0. - #[deprecated = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate")] fn epsilon() -> Self; /// Returns the minimum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")] fn min_exp(unused_self: Option<Self>) -> int; /// Returns the maximum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")] fn max_exp(unused_self: Option<Self>) -> int; /// Returns the minimum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")] fn min_10_exp(unused_self: Option<Self>) -> int; /// Returns the maximum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")] fn max_10_exp(unused_self: Option<Self>) -> int; /// Returns the smallest finite value that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn min_value() -> Self; /// Returns the smallest normalized positive number that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn min_pos_value(unused_self: Option<Self>) -> Self; /// Returns the largest finite value that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn max_value() -> Self; /// Returns true if this value is NaN and false otherwise. - #[unstable = "position is undecided"] + #[unstable(feature = "std_misc", reason = "position is undecided")] fn is_nan(self) -> bool; /// Returns true if this value is positive infinity or negative infinity and /// false otherwise. - #[unstable = "position is undecided"] + #[unstable(feature = "std_misc", reason = "position is undecided")] fn is_infinite(self) -> bool; /// Returns true if this number is neither infinite nor NaN. - #[unstable = "position is undecided"] + #[unstable(feature = "std_misc", reason = "position is undecided")] fn is_finite(self) -> bool; /// Returns true if this number is neither zero, infinite, denormal, or NaN. - #[unstable = "position is undecided"] + #[unstable(feature = "std_misc", reason = "position is undecided")] fn is_normal(self) -> bool; /// Returns the category that this number falls into. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn classify(self) -> FpCategory; /// Returns the mantissa, exponent and sign as integers, respectively. - #[unstable = "signature is undecided"] + #[unstable(feature = "std_misc", reason = "signature is undecided")] fn integer_decode(self) -> (u64, i16, i8); /// Return the largest integer less than or equal to a number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn floor(self) -> Self; /// Return the smallest integer greater than or equal to a number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn ceil(self) -> Self; /// Return the nearest integer to a number. Round half-way cases away from /// `0.0`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn round(self) -> Self; /// Return the integer part of a number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn trunc(self) -> Self; /// Return the fractional part of a number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn fract(self) -> Self; /// Computes the absolute value of `self`. Returns `Float::nan()` if the /// number is `Float::nan()`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn abs(self) -> Self; /// Returns a number that represents the sign of `self`. /// /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()` /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()` /// - `Float::nan()` if the number is `Float::nan()` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn signum(self) -> Self; /// Returns `true` if `self` is positive, including `+0.0` and /// `Float::infinity()`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_positive(self) -> bool; /// Returns `true` if `self` is negative, including `-0.0` and /// `Float::neg_infinity()`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn is_negative(self) -> bool; /// Fused multiply-add. Computes `(self * a) + b` with only one rounding /// error. This produces a more accurate result with better performance than /// a separate multiplication operation followed by an add. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn mul_add(self, a: Self, b: Self) -> Self; /// Take the reciprocal (inverse) of a number, `1/x`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn recip(self) -> Self; /// Raise a number to an integer power. /// /// Using this function is generally faster than using `powf` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn powi(self, n: i32) -> Self; /// Raise a number to a floating point power. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn powf(self, n: Self) -> Self; /// Take the square root of a number. /// /// Returns NaN if `self` is a negative number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn sqrt(self) -> Self; /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn rsqrt(self) -> Self; /// Returns `e^(self)`, (the exponential function). - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn exp(self) -> Self; /// Returns 2 raised to the power of the number, `2^(self)`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn exp2(self) -> Self; /// Returns the natural logarithm of the number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn ln(self) -> Self; /// Returns the logarithm of the number with respect to an arbitrary base. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn log(self, base: Self) -> Self; /// Returns the base 2 logarithm of the number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn log2(self) -> Self; /// Returns the base 10 logarithm of the number. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn log10(self) -> Self; /// Convert radians to degrees. - #[unstable = "desirability is unclear"] + #[unstable(feature = "std_misc", reason = "desirability is unclear")] fn to_degrees(self) -> Self; /// Convert degrees to radians. - #[unstable = "desirability is unclear"] + #[unstable(feature = "std_misc", reason = "desirability is unclear")] fn to_radians(self) -> Self; /// Constructs a floating point number created by multiplying `x` by 2 /// raised to the power of `exp`. - #[unstable = "pending integer conventions"] + #[unstable(feature = "std_misc", + reason = "pending integer conventions")] fn ldexp(x: Self, exp: int) -> Self; /// Breaks the number into a normalized fraction and a base-2 exponent, /// satisfying: @@ -225,94 +253,97 @@ pub trait Float /// * `self = x * pow(2, exp)` /// /// * `0.5 <= abs(x) < 1.0` - #[unstable = "pending integer conventions"] + #[unstable(feature = "std_misc", + reason = "pending integer conventions")] fn frexp(self) -> (Self, int); /// Returns the next representable floating-point value in the direction of /// `other`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn next_after(self, other: Self) -> Self; /// Returns the maximum of the two numbers. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn max(self, other: Self) -> Self; /// Returns the minimum of the two numbers. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn min(self, other: Self) -> Self; /// The positive difference of two numbers. Returns `0.0` if the number is /// less than or equal to `other`, otherwise the difference between`self` /// and `other` is returned. - #[unstable = "may be renamed"] + #[unstable(feature = "std_misc", reason = "may be renamed")] fn abs_sub(self, other: Self) -> Self; /// Take the cubic root of a number. - #[unstable = "may be renamed"] + #[unstable(feature = "std_misc", reason = "may be renamed")] fn cbrt(self) -> Self; /// Calculate the length of the hypotenuse of a right-angle triangle given /// legs of length `x` and `y`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "std_misc", + reason = "unsure about its place in the world")] fn hypot(self, other: Self) -> Self; /// Computes the sine of a number (in radians). - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn sin(self) -> Self; /// Computes the cosine of a number (in radians). - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn cos(self) -> Self; /// Computes the tangent of a number (in radians). - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn tan(self) -> Self; /// Computes the arcsine of a number. Return value is in radians in /// the range [-pi/2, pi/2] or NaN if the number is outside the range /// [-1, 1]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn asin(self) -> Self; /// Computes the arccosine of a number. Return value is in radians in /// the range [0, pi] or NaN if the number is outside the range /// [-1, 1]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn acos(self) -> Self; /// Computes the arctangent of a number. Return value is in radians in the /// range [-pi/2, pi/2]; - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn atan(self) -> Self; /// Computes the four quadrant arctangent of a number, `y`, and another /// number `x`. Return value is in radians in the range [-pi, pi]. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn atan2(self, other: Self) -> Self; /// Simultaneously computes the sine and cosine of the number, `x`. Returns /// `(sin(x), cos(x))`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn sin_cos(self) -> (Self, Self); /// Returns the exponential of the number, minus 1, in a way that is /// accurate even if the number is close to zero. - #[unstable = "may be renamed"] + #[unstable(feature = "std_misc", reason = "may be renamed")] fn exp_m1(self) -> Self; /// Returns the natural logarithm of the number plus 1 (`ln(1+n)`) more /// accurately than if the operations were performed separately. - #[unstable = "may be renamed"] + #[unstable(feature = "std_misc", reason = "may be renamed")] fn ln_1p(self) -> Self; /// Hyperbolic sine function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn sinh(self) -> Self; /// Hyperbolic cosine function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn cosh(self) -> Self; /// Hyperbolic tangent function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn tanh(self) -> Self; /// Inverse hyperbolic sine function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn asinh(self) -> Self; /// Inverse hyperbolic cosine function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn acosh(self) -> Self; /// Inverse hyperbolic tangent function. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] fn atanh(self) -> Self; } diff --git a/src/libstd/num/u16.rs b/src/libstd/num/u16.rs index 7cb6a8ffe07..3fda77fb69c 100644 --- a/src/libstd/num/u16.rs +++ b/src/libstd/num/u16.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 16-bits integers (`u16` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u16")] pub use core::u16::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u32.rs b/src/libstd/num/u32.rs index 43b01ddb16b..8610f0c0147 100644 --- a/src/libstd/num/u32.rs +++ b/src/libstd/num/u32.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 32-bits integers (`u32` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u32")] pub use core::u32::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u64.rs b/src/libstd/num/u64.rs index 79e7f237051..3587b069656 100644 --- a/src/libstd/num/u64.rs +++ b/src/libstd/num/u64.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 64-bits integer (`u64` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u64")] pub use core::u64::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/u8.rs b/src/libstd/num/u8.rs index 3da2fabe3f2..6a285e8299c 100644 --- a/src/libstd/num/u8.rs +++ b/src/libstd/num/u8.rs @@ -10,7 +10,7 @@ //! Operations and constants for unsigned 8-bits integers (`u8` type) -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "u8")] pub use core::u8::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs index 0e12eff205f..c7b491381f3 100644 --- a/src/libstd/num/uint.rs +++ b/src/libstd/num/uint.rs @@ -14,7 +14,8 @@ //! alpha cycle along with the development of clearer conventions //! around integer types. -#![deprecated = "replaced by usize"] +#![unstable(feature = "std_misc")] +#![deprecated(since = "1.0.0", reason = "replaced by usize")] pub use core::uint::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index f480a3b420f..82c55d7b5b8 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable] +#![unstable(feature = "std_misc")] #![doc(hidden)] #![allow(unsigned_negation)] diff --git a/src/libstd/num/usize.rs b/src/libstd/num/usize.rs index 74dd38e13c5..19964c306a7 100644 --- a/src/libstd/num/usize.rs +++ b/src/libstd/num/usize.rs @@ -14,7 +14,7 @@ //! new type will gradually take place over the alpha cycle along with //! the development of clearer conventions around integer types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] #![doc(primitive = "usize")] pub use core::usize::{BITS, BYTES, MIN, MAX}; diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 768cec129a9..1590598c0b8 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -52,7 +52,7 @@ pub struct BufferedReader<R> { cap: uint, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<R> fmt::Debug for BufferedReader<R> where R: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "BufferedReader {{ reader: {:?}, buffer: {}/{} }}", @@ -151,7 +151,7 @@ pub struct BufferedWriter<W> { pos: uint } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<W> fmt::Debug for BufferedWriter<W> where W: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "BufferedWriter {{ writer: {:?}, buffer: {}/{} }}", @@ -251,7 +251,7 @@ pub struct LineBufferedWriter<W> { inner: BufferedWriter<W>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<W> fmt::Debug for LineBufferedWriter<W> where W: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "LineBufferedWriter {{ writer: {:?}, buffer: {}/{} }}", @@ -342,7 +342,7 @@ pub struct BufferedStream<S> { inner: BufferedReader<InternalBufferedWriter<S>> } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<S> fmt::Debug for BufferedStream<S> where S: fmt::Debug { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let reader = &self.inner; diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs index a1f2efdb28a..feb2ef6f4f3 100644 --- a/src/libstd/old_io/comm_adapters.rs +++ b/src/libstd/old_io/comm_adapters.rs @@ -134,7 +134,7 @@ impl ChanWriter { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Clone for ChanWriter { fn clone(&self) -> ChanWriter { ChanWriter { tx: self.tx.clone() } diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index be965d9cf2d..254daf3202a 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -62,7 +62,9 @@ impl Writer for Vec<u8> { /// /// assert_eq!(w.into_inner(), vec!(0, 1, 2)); /// ``` -#[deprecated = "use the Vec<u8> Writer implementation directly"] +#[unstable(feature = "io")] +#[deprecated(since = "1.0.0", + reason = "use the Vec<u8> Writer implementation directly")] #[derive(Clone)] pub struct MemWriter { buf: Vec<u8>, diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 3d1c8a0b86c..6c5ce129a33 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -237,7 +237,7 @@ //! concerned with error handling; instead its caller is responsible for //! responding to errors that may occur while attempting to read the numbers. -#![unstable] +#![unstable(feature = "io")] #![deny(unused_must_use)] pub use self::SeekStyle::*; @@ -357,7 +357,7 @@ impl IoError { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for IoError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -1000,7 +1000,8 @@ pub trait Writer { fn write_all(&mut self, buf: &[u8]) -> IoResult<()>; /// Deprecated, this method was renamed to `write_all` - #[deprecated = "renamed to `write_all`"] + #[unstable(feature = "io")] + #[deprecated(since = "1.0.0", reason = "renamed to `write_all`")] fn write(&mut self, buf: &[u8]) -> IoResult<()> { self.write_all(buf) } /// Flush this output stream, ensuring that all intermediately buffered @@ -1711,7 +1712,6 @@ pub enum FileType { /// # Examples /// /// ```no_run -/// # #![allow(unstable)] /// /// use std::old_io::fs::PathExtensions; /// @@ -1752,7 +1752,7 @@ pub struct FileStat { /// /// Usage of this field is discouraged, but if access is desired then the /// fields are located here. - #[unstable] + #[unstable(feature = "io")] pub unstable: UnstableFileStat, } @@ -1760,7 +1760,7 @@ pub struct FileStat { /// returned from a `stat` syscall which is not contained in the `FileStat` /// structure. This information is not necessarily platform independent, and may /// have different meanings or no meaning at all on some platforms. -#[unstable] +#[unstable(feature = "io")] #[derive(Copy, Hash)] pub struct UnstableFileStat { /// The ID of the device containing the file. @@ -1824,14 +1824,14 @@ bitflags! { } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Default for FilePermission { - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn default() -> FilePermission { FilePermission::empty() } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for FilePermission { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:04o}", self.bits) diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index 26eb068b151..e60b455aecd 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -38,7 +38,7 @@ pub enum IpAddr { Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for IpAddr { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -70,7 +70,7 @@ pub struct SocketAddr { pub port: Port, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for SocketAddr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.ip { diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index 760e778fd7c..71b77adcd96 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -68,7 +68,8 @@ impl UnixStream { /// /// If a `timeout` with zero or negative duration is specified then /// the function returns `Err`, with the error kind set to `TimedOut`. - #[unstable = "the timeout argument is likely to change types"] + #[unstable(feature = "io", + reason = "the timeout argument is likely to change types")] pub fn connect_timeout<P>(path: P, timeout: Duration) -> IoResult<UnixStream> where P: BytesContainer { @@ -107,7 +108,8 @@ impl UnixStream { /// Sets the read/write timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_timeout(timeout_ms) } @@ -115,7 +117,8 @@ impl UnixStream { /// Sets the read timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_read_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_read_timeout(timeout_ms) } @@ -123,7 +126,8 @@ impl UnixStream { /// Sets the write timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_write_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_write_timeout(timeout_ms) } @@ -217,8 +221,9 @@ impl UnixAcceptor { /// When using this method, it is likely necessary to reset the timeout as /// appropriate, the timeout specified is specific to this object, not /// specific to the next request. - #[unstable = "the name and arguments to this function are likely \ - to change"] + #[unstable(feature = "io", + reason = "the name and arguments to this function are likely \ + to change")] pub fn set_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_timeout(timeout_ms) } @@ -227,7 +232,7 @@ impl UnixAcceptor { /// /// This function has the same semantics as `TcpAcceptor::close_accept`, and /// more information can be found in that documentation. - #[unstable] + #[unstable(feature = "io")] pub fn close_accept(&mut self) -> IoResult<()> { self.inner.close_accept() } diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index f01f6e1a87c..1e76bb3ab0d 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -85,7 +85,8 @@ impl TcpStream { /// /// If a `timeout` with zero or negative duration is specified then /// the function returns `Err`, with the error kind set to `TimedOut`. - #[unstable = "the timeout argument may eventually change types"] + #[unstable(feature = "io", + reason = "the timeout argument may eventually change types")] pub fn connect_timeout<A: ToSocketAddr>(addr: A, timeout: Duration) -> IoResult<TcpStream> { if timeout <= Duration::milliseconds(0) { @@ -109,7 +110,7 @@ impl TcpStream { } /// Sets the nodelay flag on this connection to the boolean specified - #[unstable] + #[unstable(feature = "io")] pub fn set_nodelay(&mut self, nodelay: bool) -> IoResult<()> { self.inner.set_nodelay(nodelay) } @@ -119,7 +120,7 @@ impl TcpStream { /// If the value specified is `None`, then the keepalive flag is cleared on /// this connection. Otherwise, the keepalive timeout will be set to the /// specified time, in seconds. - #[unstable] + #[unstable(feature = "io")] pub fn set_keepalive(&mut self, delay_in_seconds: Option<uint>) -> IoResult<()> { self.inner.set_keepalive(delay_in_seconds) } @@ -187,7 +188,8 @@ impl TcpStream { /// /// For clarification on the semantics of interrupting a read and a write, /// take a look at `set_read_timeout` and `set_write_timeout`. - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_timeout(timeout_ms) } @@ -204,7 +206,8 @@ impl TcpStream { /// action is taken. Otherwise, the read operation will be scheduled to /// promptly return. If a timeout error is returned, then no data was read /// during the timeout period. - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_read_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_read_timeout(timeout_ms) } @@ -231,7 +234,8 @@ impl TcpStream { /// does not know how many bytes were written as part of the timeout /// operation. It may be the case that bytes continue to be written in an /// asynchronous fashion after the call to write returns. - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_write_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_write_timeout(timeout_ms) } @@ -372,7 +376,6 @@ impl TcpAcceptor { /// # Example /// /// ```no_run - /// # #![allow(unstable)] /// use std::old_io::TcpListener; /// use std::old_io::{Listener, Acceptor, TimedOut}; /// @@ -395,8 +398,9 @@ impl TcpAcceptor { /// a.set_timeout(None); /// let socket = a.accept(); /// ``` - #[unstable = "the type of the argument and name of this function are \ - subject to change"] + #[unstable(feature = "io", + reason = "the type of the argument and name of this function are \ + subject to change")] pub fn set_timeout(&mut self, ms: Option<u64>) { self.inner.set_timeout(ms); } /// Closes the accepting capabilities of this acceptor. @@ -416,7 +420,6 @@ impl TcpAcceptor { /// # Example /// /// ``` - /// # #![allow(unstable)] /// use std::old_io::{TcpListener, Listener, Acceptor, EndOfFile}; /// use std::thread::Thread; /// @@ -442,7 +445,7 @@ impl TcpAcceptor { /// // Signal our accept loop to exit /// assert!(a.close_accept().is_ok()); /// ``` - #[unstable] + #[unstable(feature = "io")] pub fn close_accept(&mut self) -> IoResult<()> { self.inner.close_accept() } @@ -480,7 +483,6 @@ impl sys_common::AsInner<TcpAcceptorImp> for TcpAcceptor { } #[cfg(test)] -#[allow(unstable)] mod test { use prelude::v1::*; diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index d7fc760951e..9055a089eec 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -92,13 +92,13 @@ impl UdpSocket { } /// Joins a multicast IP address (becomes a member of it) - #[unstable] + #[unstable(feature = "io")] pub fn join_multicast(&mut self, multi: IpAddr) -> IoResult<()> { self.inner.join_multicast(multi) } /// Leaves a multicast IP address (drops membership from it) - #[unstable] + #[unstable(feature = "io")] pub fn leave_multicast(&mut self, multi: IpAddr) -> IoResult<()> { self.inner.leave_multicast(multi) } @@ -106,25 +106,25 @@ impl UdpSocket { /// Set the multicast loop flag to the specified value /// /// This lets multicast packets loop back to local sockets (if enabled) - #[unstable] + #[unstable(feature = "io")] pub fn set_multicast_loop(&mut self, on: bool) -> IoResult<()> { self.inner.set_multicast_loop(on) } /// Sets the multicast TTL - #[unstable] + #[unstable(feature = "io")] pub fn set_multicast_ttl(&mut self, ttl: int) -> IoResult<()> { self.inner.multicast_time_to_live(ttl) } /// Sets this socket's TTL - #[unstable] + #[unstable(feature = "io")] pub fn set_ttl(&mut self, ttl: int) -> IoResult<()> { self.inner.time_to_live(ttl) } /// Sets the broadcast flag on or off - #[unstable] + #[unstable(feature = "io")] pub fn set_broadcast(&mut self, broadcast: bool) -> IoResult<()> { self.inner.set_broadcast(broadcast) } @@ -132,7 +132,8 @@ impl UdpSocket { /// Sets the read/write timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_timeout(timeout_ms) } @@ -140,7 +141,8 @@ impl UdpSocket { /// Sets the read timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_read_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_read_timeout(timeout_ms) } @@ -148,7 +150,8 @@ impl UdpSocket { /// Sets the write timeout for this socket. /// /// For more information, see `TcpStream::set_timeout` - #[unstable = "the timeout argument may change in type and value"] + #[unstable(feature = "io", + reason = "the timeout argument may change in type and value")] pub fn set_write_timeout(&mut self, timeout_ms: Option<u64>) { self.inner.set_write_timeout(timeout_ms) } @@ -176,7 +179,6 @@ impl sys_common::AsInner<UdpSocketImp> for UdpSocket { } #[cfg(test)] -#[allow(unstable)] mod test { use prelude::v1::*; diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 280d2a8add5..78910882467 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -10,7 +10,6 @@ //! Bindings for executing child processes -#![allow(unstable)] #![allow(non_upper_case_globals)] pub use self::StdioContainer::*; @@ -502,7 +501,7 @@ pub enum ProcessExit { ExitSignal(int), } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ProcessExit { /// Format a ProcessExit enum, to nicely present the information. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -653,7 +652,6 @@ impl Process { /// # Example /// /// ```no_run - /// # #![allow(unstable)] /// use std::old_io::{Command, IoResult}; /// use std::old_io::process::ProcessExit; /// @@ -681,7 +679,8 @@ impl Process { /// p.wait() /// } /// ``` - #[unstable = "the type of the timeout is likely to change"] + #[unstable(feature = "io", + reason = "the type of the timeout is likely to change")] pub fn set_timeout(&mut self, timeout_ms: Option<u64>) { self.deadline = timeout_ms.map(|i| i + sys::timer::now()).unwrap_or(0); } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 6dde65854d7..979a61d20d5 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -24,7 +24,7 @@ //! which OS the user is on -- they should be given the opportunity to write //! OS-ignorant code by default. -#![unstable] +#![unstable(feature = "os")] #![allow(missing_docs)] #![allow(non_snake_case)] @@ -902,7 +902,7 @@ pub enum MapError { ErrMapViewOfFile(uint) } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for MapError { fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result { let str = match *self { diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 1b09fb92737..b42353e964c 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -59,7 +59,7 @@ //! println!("path exists: {}", path.exists()); //! ``` -#![unstable] +#![unstable(feature = "path")] use core::marker::Sized; use ffi::CString; @@ -823,14 +823,14 @@ pub struct Display<'a, P:'a> { filename: bool } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, P: GenericPath> fmt::Debug for Display<'a, P> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self.as_cow(), f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, P: GenericPath> fmt::Display for Display<'a, P> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.as_cow().fmt(f) diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 202d81f5696..39138e14803 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -57,7 +57,7 @@ pub fn is_sep(c: char) -> bool { c == SEP } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Path { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self.display(), f) diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 9f5ed177918..34faa65af75 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -85,7 +85,7 @@ pub struct Path { sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Path { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self.display(), f) diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index 0496944dbaf..09fa10dacf9 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -35,7 +35,6 @@ //! pervasive that it would be obnoxious to import for every use, particularly //! those that define methods on primitive types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] -#[stable] pub mod v1; diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index aa4db7b6b70..51c9f9de83c 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -10,35 +10,54 @@ //! The first version of the prelude of the standard library. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] // Reexported core operators -#[stable] #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync}; -#[stable] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; // TEMPORARY -#[unstable] #[doc(no_inline)] pub use ops::FullRange; +#[unstable(feature = "std_misc")] +#[doc(no_inline)] pub use ops::FullRange; // Reexported functions -#[stable] #[doc(no_inline)] pub use mem::drop; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use mem::drop; // Reexported types and traits -#[stable] #[doc(no_inline)] pub use boxed::Box; -#[stable] #[doc(no_inline)] pub use char::CharExt; -#[stable] #[doc(no_inline)] pub use clone::Clone; -#[stable] #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; -#[stable] #[doc(no_inline)] pub use iter::DoubleEndedIterator; -#[stable] #[doc(no_inline)] pub use iter::ExactSizeIterator; -#[stable] #[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; -#[stable] #[doc(no_inline)] pub use option::Option::{self, Some, None}; -#[stable] #[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt}; -#[stable] #[doc(no_inline)] pub use result::Result::{self, Ok, Err}; -#[stable] #[doc(no_inline)] pub use slice::AsSlice; -#[stable] #[doc(no_inline)] pub use slice::{SliceExt, SliceConcatExt}; -#[stable] #[doc(no_inline)] pub use str::{Str, StrExt}; -#[stable] #[doc(no_inline)] pub use string::{String, ToString}; -#[stable] #[doc(no_inline)] pub use vec::Vec; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use boxed::Box; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use char::CharExt; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use clone::Clone; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use iter::DoubleEndedIterator; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use iter::ExactSizeIterator; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use iter::{Iterator, IteratorExt, Extend}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use option::Option::{self, Some, None}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use ptr::{PtrExt, MutPtrExt}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use result::Result::{self, Ok, Err}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use slice::AsSlice; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use slice::{SliceExt, SliceConcatExt}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use str::{Str, StrExt}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use string::{String, ToString}; +#[stable(feature = "rust1", since = "1.0.0")] +#[doc(no_inline)] pub use vec::Vec; // NB: remove when path reform lands #[doc(no_inline)] pub use path::{Path, GenericPath}; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 01111462eaa..0a6dc386edf 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -219,7 +219,7 @@ //! } //! ``` -#![unstable] +#![unstable(feature = "rand")] use cell::RefCell; use clone::Clone; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index e3e4e132b81..7e19f1cac2c 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -16,7 +16,7 @@ //! and should be considered as private implementation details for the //! time being. -#![unstable] +#![unstable(feature = "std_misc")] // FIXME: this should not be here. #![allow(missing_docs)] diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index b313a5312bc..18298f1c7f4 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -582,7 +582,7 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> /// Only a limited number of callbacks can be registered, and this function /// returns whether the callback was successfully registered or not. It is not /// currently possible to unregister a callback once it has been registered. -#[unstable] +#[unstable(feature = "std_misc")] pub unsafe fn register(f: Callback) -> bool { match CALLBACK_CNT.fetch_add(1, Ordering::SeqCst) { // The invocation code has knowledge of this window where the count has diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs index f4fbd378899..06b68162487 100644 --- a/src/libstd/rtdeps.rs +++ b/src/libstd/rtdeps.rs @@ -12,7 +12,7 @@ //! the standard library This varies per-platform, but these libraries are //! necessary for running libstd. -#![unstable] +#![unstable(feature = "std_misc")] // All platforms need to link to rustrt #[cfg(not(test))] diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index 70939879400..40710d627c0 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -29,7 +29,7 @@ use sync::{Mutex, Condvar}; /// }); /// } /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Barrier { lock: Mutex<BarrierState>, cvar: Condvar, @@ -54,7 +54,7 @@ impl Barrier { /// /// A barrier will block `n`-1 threads which call `wait` and then wake up /// all threads at once when the `n`th thread calls `wait`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(n: uint) -> Barrier { Barrier { lock: Mutex::new(BarrierState { @@ -75,7 +75,7 @@ impl Barrier { /// returns `true` from `is_leader` when returning from this function, and /// all other threads will receive a result that will return `false` from /// `is_leader` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn wait(&self) -> BarrierWaitResult { let mut lock = self.lock.lock().unwrap(); let local_gen = lock.generation_id; @@ -102,7 +102,7 @@ impl BarrierWaitResult { /// /// Only one thread will have `true` returned from their result, all other /// threads will have `false` returned. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn is_leader(&self) -> bool { self.0 } } diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index d2d5335078e..a7a5b084582 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -58,7 +58,7 @@ use sync::{mutex, MutexGuard}; /// started = cvar.wait(started).unwrap(); /// } /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Condvar { inner: Box<StaticCondvar> } unsafe impl Send for Condvar {} @@ -76,7 +76,8 @@ unsafe impl Sync for Condvar {} /// /// static CVAR: StaticCondvar = CONDVAR_INIT; /// ``` -#[unstable = "may be merged with Condvar in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub struct StaticCondvar { inner: sys::Condvar, mutex: AtomicUsize, @@ -86,7 +87,8 @@ unsafe impl Send for StaticCondvar {} unsafe impl Sync for StaticCondvar {} /// Constant initializer for a statically allocated condition variable. -#[unstable = "may be merged with Condvar in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub const CONDVAR_INIT: StaticCondvar = StaticCondvar { inner: sys::CONDVAR_INIT, mutex: ATOMIC_USIZE_INIT, @@ -95,7 +97,7 @@ pub const CONDVAR_INIT: StaticCondvar = StaticCondvar { impl Condvar { /// Creates a new condition variable which is ready to be waited on and /// notified. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> Condvar { Condvar { inner: box StaticCondvar { @@ -131,7 +133,7 @@ impl Condvar { /// over time. Each condition variable is dynamically bound to exactly one /// mutex to ensure defined behavior across platforms. If this functionality /// is not desired, then unsafe primitives in `sys` are provided. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn wait<'a, T>(&self, guard: MutexGuard<'a, T>) -> LockResult<MutexGuard<'a, T>> { unsafe { @@ -154,7 +156,7 @@ impl Condvar { /// /// Like `wait`, the lock specified will be re-acquired when this function /// returns, regardless of whether the timeout elapsed or not. - #[unstable] + #[unstable(feature = "std_misc")] pub fn wait_timeout<'a, T>(&self, guard: MutexGuard<'a, T>, dur: Duration) -> LockResult<(MutexGuard<'a, T>, bool)> { unsafe { @@ -169,7 +171,7 @@ impl Condvar { /// The semantics of this function are equivalent to `wait_timeout` except /// that the implementation will repeatedly wait while the duration has not /// passed and the provided function returns `false`. - #[unstable] + #[unstable(feature = "std_misc")] pub fn wait_timeout_with<'a, T, F>(&self, guard: MutexGuard<'a, T>, dur: Duration, @@ -189,7 +191,7 @@ impl Condvar { /// `notify_one` are not buffered in any way. /// /// To wake up all threads, see `notify_all()`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn notify_one(&self) { unsafe { self.inner.inner.notify_one() } } /// Wake up all blocked threads on this condvar. @@ -199,11 +201,11 @@ impl Condvar { /// way. /// /// To wake up only one thread, see `notify_one()`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn notify_all(&self) { unsafe { self.inner.inner.notify_all() } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl Drop for Condvar { fn drop(&mut self) { unsafe { self.inner.inner.destroy() } @@ -215,7 +217,8 @@ impl StaticCondvar { /// notification. /// /// See `Condvar::wait`. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub fn wait<'a, T>(&'static self, guard: MutexGuard<'a, T>) -> LockResult<MutexGuard<'a, T>> { let poisoned = unsafe { @@ -235,7 +238,8 @@ impl StaticCondvar { /// specified duration. /// /// See `Condvar::wait_timeout`. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub fn wait_timeout<'a, T>(&'static self, guard: MutexGuard<'a, T>, dur: Duration) -> LockResult<(MutexGuard<'a, T>, bool)> { let (poisoned, success) = unsafe { @@ -258,7 +262,8 @@ impl StaticCondvar { /// passed and the function returns `false`. /// /// See `Condvar::wait_timeout_with`. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub fn wait_timeout_with<'a, T, F>(&'static self, guard: MutexGuard<'a, T>, dur: Duration, @@ -298,13 +303,15 @@ impl StaticCondvar { /// Wake up one blocked thread on this condvar. /// /// See `Condvar::notify_one`. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub fn notify_one(&'static self) { unsafe { self.inner.notify_one() } } /// Wake up all blocked threads on this condvar. /// /// See `Condvar::notify_all`. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub fn notify_all(&'static self) { unsafe { self.inner.notify_all() } } /// Deallocate all resources associated with this static condvar. @@ -313,7 +320,8 @@ impl StaticCondvar { /// active users of the condvar, and this also doesn't prevent any future /// users of the condvar. This method is required to be called to not leak /// memory on all platforms. - #[unstable = "may be merged with Condvar in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Condvar in the future")] pub unsafe fn destroy(&'static self) { self.inner.destroy() } diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index 36bbc5ff5b4..a79fb684f47 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -27,9 +27,10 @@ //! ``` #![allow(missing_docs)] -#![unstable = "futures as-is have yet to be deeply reevaluated with recent \ - core changes to Rust's synchronization story, and will likely \ - become stable in the future but are unstable until that time"] +#![unstable(feature = "std_misc", + reason = "futures as-is have yet to be deeply reevaluated with recent \ + core changes to Rust's synchronization story, and will likely \ + become stable in the future but are unstable until that time")] use core::prelude::*; use core::mem::replace; diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 6fff6765bd3..f3b721438d8 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -15,7 +15,7 @@ //! and/or blocking at all, but rather provide the necessary tools to build //! other types of concurrent primitives. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] pub use alloc::arc::{Arc, Weak}; pub use core::atomic; diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 6140e3fd36c..322c6137984 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -163,7 +163,7 @@ //! } //! ``` -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] // A description of how Rust's channel implementation works // @@ -338,7 +338,7 @@ mod spsc_queue; /// The receiving-half of Rust's channel type. This half can only be owned by /// one task -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Receiver<T> { inner: UnsafeCell<Flavor<T>>, } @@ -350,14 +350,14 @@ unsafe impl<T:Send> Send for Receiver<T> { } /// An iterator over messages on a receiver, this iterator will block /// whenever `next` is called, waiting for a new message, and `None` will be /// returned when the corresponding channel has hung up. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T:'a> { rx: &'a Receiver<T> } /// The sending-half of Rust's asynchronous channel type. This half can only be /// owned by one task, but it can be cloned to send to other tasks. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Sender<T> { inner: UnsafeCell<Flavor<T>>, } @@ -368,7 +368,7 @@ unsafe impl<T:Send> Send for Sender<T> { } /// The sending-half of Rust's synchronous channel type. This half can only be /// owned by one task, but it can be cloned to send to other tasks. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SyncSender<T> { inner: Arc<UnsafeCell<sync::Packet<T>>>, } @@ -383,7 +383,7 @@ impl<T> !Sync for SyncSender<T> {} /// disconnected, implying that the data could never be received. The error /// contains the data being sent as a payload so it can be recovered. #[derive(PartialEq, Eq)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct SendError<T>(pub T); /// An error returned from the `recv` function on a `Receiver`. @@ -391,29 +391,29 @@ pub struct SendError<T>(pub T); /// The `recv` operation can only fail if the sending half of a channel is /// disconnected, implying that no further messages will ever be received. #[derive(PartialEq, Eq, Clone, Copy, Show)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RecvError; /// This enumeration is the list of the possible reasons that try_recv could not /// return data when called. #[derive(PartialEq, Clone, Copy, Show)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum TryRecvError { /// This channel is currently empty, but the sender(s) have not yet /// disconnected, so data may yet become available. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Empty, /// This channel's sending half has become disconnected, and there will /// never be any more data received on this channel - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Disconnected, } /// This enumeration is the list of the possible error outcomes for the /// `SyncSender::try_send` method. #[derive(PartialEq, Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum TrySendError<T> { /// The data could not be sent on the channel because it would require that /// the callee block to send the data. @@ -421,12 +421,12 @@ pub enum TrySendError<T> { /// If this is a buffered channel, then the buffer is full at this time. If /// this is not a buffered channel, then there is no receiver available to /// acquire the data. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Full(T), /// This channel's receiving half has disconnected, so the data could not be /// sent. The data is returned back to the callee in this case. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Disconnected(T), } @@ -484,7 +484,7 @@ impl<T> UnsafeFlavor<T> for Receiver<T> { /// // Let's see what that answer was /// println!("{:?}", rx.recv().unwrap()); /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { let a = Arc::new(UnsafeCell::new(oneshot::Packet::new())); (Sender::new(Flavor::Oneshot(a.clone())), Receiver::new(Flavor::Oneshot(a))) @@ -524,7 +524,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { /// assert_eq!(rx.recv().unwrap(), 1i); /// assert_eq!(rx.recv().unwrap(), 2i); /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub fn sync_channel<T: Send>(bound: uint) -> (SyncSender<T>, Receiver<T>) { let a = Arc::new(UnsafeCell::new(sync::Packet::new(bound))); (SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a))) @@ -568,7 +568,7 @@ impl<T: Send> Sender<T> { /// drop(rx); /// assert_eq!(tx.send(1i).err().unwrap().0, 1); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn send(&self, t: T) -> Result<(), SendError<T>> { let (new_inner, ret) = match *unsafe { self.inner() } { Flavor::Oneshot(ref p) => { @@ -615,7 +615,7 @@ impl<T: Send> Sender<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Clone for Sender<T> { fn clone(&self) -> Sender<T> { let (packet, sleeper, guard) = match *unsafe { self.inner() } { @@ -661,7 +661,7 @@ impl<T: Send> Clone for Sender<T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Drop for Sender<T> { fn drop(&mut self) { match *unsafe { self.inner_mut() } { @@ -696,7 +696,7 @@ impl<T: Send> SyncSender<T> { /// This function will never panic, but it may return `Err` if the /// `Receiver` has disconnected and is no longer able to receive /// information. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn send(&self, t: T) -> Result<(), SendError<T>> { unsafe { (*self.inner.get()).send(t).map_err(SendError) } } @@ -710,13 +710,13 @@ impl<T: Send> SyncSender<T> { /// /// See `SyncSender::send` for notes about guarantees of whether the /// receiver has received the data or not if this function is successful. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn try_send(&self, t: T) -> Result<(), TrySendError<T>> { unsafe { (*self.inner.get()).try_send(t) } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Clone for SyncSender<T> { fn clone(&self) -> SyncSender<T> { unsafe { (*self.inner.get()).clone_chan(); } @@ -725,7 +725,7 @@ impl<T: Send> Clone for SyncSender<T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Drop for SyncSender<T> { fn drop(&mut self) { unsafe { (*self.inner.get()).drop_chan(); } @@ -749,7 +749,7 @@ impl<T: Send> Receiver<T> { /// /// This is useful for a flavor of "optimistic check" before deciding to /// block on a receiver. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn try_recv(&self) -> Result<T, TryRecvError> { loop { let new_port = match *unsafe { self.inner() } { @@ -810,7 +810,7 @@ impl<T: Send> Receiver<T> { /// If the corresponding `Sender` has disconnected, or it disconnects while /// this call is blocking, this call will wake up and return `Err` to /// indicate that no more messages can ever be received on this channel. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn recv(&self) -> Result<T, RecvError> { loop { let new_port = match *unsafe { self.inner() } { @@ -849,7 +849,7 @@ impl<T: Send> Receiver<T> { /// Returns an iterator that will block waiting for messages, but never /// `panic!`. It will return `None` when the channel has hung up. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn iter(&self) -> Iter<T> { Iter { rx: self } } @@ -941,7 +941,7 @@ impl<T: Send> select::Packet for Receiver<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: Send> Iterator for Iter<'a, T> { type Item = T; @@ -949,7 +949,7 @@ impl<'a, T: Send> Iterator for Iter<'a, T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Drop for Receiver<T> { fn drop(&mut self) { match *unsafe { self.inner_mut() } { @@ -961,21 +961,21 @@ impl<T: Send> Drop for Receiver<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Debug for SendError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "SendError(..)".fmt(f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Display for SendError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "sending on a closed channel".fmt(f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Debug for TrySendError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -985,7 +985,7 @@ impl<T> fmt::Debug for TrySendError<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Display for TrySendError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -999,14 +999,14 @@ impl<T> fmt::Display for TrySendError<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for RecvError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "receiving on a closed channel".fmt(f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for TryRecvError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index ea81ed30a9c..c222c313ba6 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -35,7 +35,7 @@ //! method, and see the method for more information about it. Due to this //! caveat, this queue may not be appropriate for all use-cases. -#![unstable] +#![unstable(feature = "std_misc")] // http://www.1024cores.net/home/lock-free-algorithms // /queues/non-intrusive-mpsc-node-based-queue @@ -139,7 +139,7 @@ impl<T: Send> Queue<T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Drop for Queue<T> { fn drop(&mut self) { unsafe { diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index f5bacbb8ce2..e97c82a5b1b 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -46,12 +46,13 @@ //! ``` #![allow(dead_code)] -#![unstable = "This implementation, while likely sufficient, is unsafe and \ - likely to be error prone. At some point in the future this \ - module will likely be replaced, and it is currently \ - unknown how much API breakage that will cause. The ability \ - to select over a number of channels will remain forever, \ - but no guarantees beyond this are being made"] +#![unstable(feature = "std_misc", + reason = "This implementation, while likely sufficient, is unsafe and \ + likely to be error prone. At some point in the future this \ + module will likely be replaced, and it is currently \ + unknown how much API breakage that will cause. The ability \ + to select over a number of channels will remain forever, \ + but no guarantees beyond this are being made")] use core::prelude::*; diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index 8cd88cedf6b..c1983fcab19 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -33,7 +33,7 @@ //! concurrently between two tasks. This data structure is safe to use and //! enforces the semantics that there is one pusher and one popper. -#![unstable] +#![unstable(feature = "std_misc")] use core::prelude::*; diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 6ddfe3e075b..f7fdd60eb8c 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -109,7 +109,7 @@ use sys_common::mutex as sys; /// /// *guard += 1; /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Mutex<T> { // Note that this static mutex is in a *box*, not inlined into the struct // itself. Once a native mutex has been used once, its address can never @@ -145,7 +145,8 @@ unsafe impl<T:Send> Sync for Mutex<T> { } /// } /// // lock is unlocked here. /// ``` -#[unstable = "may be merged with Mutex in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with Mutex in the future")] pub struct StaticMutex { lock: sys::Mutex, poison: poison::Flag, @@ -159,7 +160,7 @@ unsafe impl Sync for StaticMutex {} /// The data protected by the mutex can be access through this guard via its /// Deref and DerefMut implementations #[must_use] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct MutexGuard<'a, T: 'a> { // funny underscores due to how Deref/DerefMut currently work (they // disregard field privacy). @@ -172,7 +173,8 @@ impl<'a, T> !marker::Send for MutexGuard<'a, T> {} /// Static initialization of a mutex. This constant can be used to initialize /// other mutex constants. -#[unstable = "may be merged with Mutex in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with Mutex in the future")] pub const MUTEX_INIT: StaticMutex = StaticMutex { lock: sys::MUTEX_INIT, poison: poison::FLAG_INIT, @@ -180,7 +182,7 @@ pub const MUTEX_INIT: StaticMutex = StaticMutex { impl<T: Send> Mutex<T> { /// Creates a new mutex in an unlocked state ready for use. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(t: T) -> Mutex<T> { Mutex { inner: box MUTEX_INIT, @@ -199,7 +201,7 @@ impl<T: Send> Mutex<T> { /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return an error once the mutex is acquired. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> LockResult<MutexGuard<T>> { unsafe { self.inner.lock.lock() } MutexGuard::new(&*self.inner, &self.data) @@ -218,7 +220,7 @@ impl<T: Send> Mutex<T> { /// If another user of this mutex panicked while holding the mutex, then /// this call will return failure if the mutex would otherwise be /// acquired. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn try_lock(&self) -> TryLockResult<MutexGuard<T>> { if unsafe { self.inner.lock.try_lock() } { Ok(try!(MutexGuard::new(&*self.inner, &self.data))) @@ -229,7 +231,7 @@ impl<T: Send> Mutex<T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T: Send> Drop for Mutex<T> { fn drop(&mut self) { // This is actually safe b/c we know that there is no further usage of @@ -246,7 +248,8 @@ static DUMMY: Dummy = Dummy(UnsafeCell { value: () }); impl StaticMutex { /// Acquires this lock, see `Mutex::lock` #[inline] - #[unstable = "may be merged with Mutex in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Mutex in the future")] pub fn lock(&'static self) -> LockResult<MutexGuard<()>> { unsafe { self.lock.lock() } MutexGuard::new(self, &DUMMY.0) @@ -254,7 +257,8 @@ impl StaticMutex { /// Attempts to grab this lock, see `Mutex::try_lock` #[inline] - #[unstable = "may be merged with Mutex in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Mutex in the future")] pub fn try_lock(&'static self) -> TryLockResult<MutexGuard<()>> { if unsafe { self.lock.try_lock() } { Ok(try!(MutexGuard::new(self, &DUMMY.0))) @@ -273,7 +277,8 @@ impl StaticMutex { /// *all* platforms. It may be the case that some platforms do not leak /// memory if this method is not called, but this is not guaranteed to be /// true on all platforms. - #[unstable = "may be merged with Mutex in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with Mutex in the future")] pub unsafe fn destroy(&'static self) { self.lock.destroy() } @@ -293,7 +298,7 @@ impl<'mutex, T> MutexGuard<'mutex, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'mutex, T> Deref for MutexGuard<'mutex, T> { type Target = T; @@ -301,7 +306,7 @@ impl<'mutex, T> Deref for MutexGuard<'mutex, T> { unsafe { &*self.__data.get() } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> { fn deref_mut<'a>(&'a mut self) -> &'a mut T { unsafe { &mut *self.__data.get() } @@ -309,7 +314,7 @@ impl<'mutex, T> DerefMut for MutexGuard<'mutex, T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Drop for MutexGuard<'a, T> { #[inline] fn drop(&mut self) { diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 6231a91833d..1c489540581 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -36,7 +36,7 @@ use sync::{StaticMutex, MUTEX_INIT}; /// // run initialization here /// }); /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Once { mutex: StaticMutex, cnt: AtomicIsize, @@ -46,7 +46,7 @@ pub struct Once { unsafe impl Sync for Once {} /// Initialization value for static `Once` values. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub const ONCE_INIT: Once = Once { mutex: MUTEX_INIT, cnt: ATOMIC_ISIZE_INIT, @@ -63,7 +63,7 @@ impl Once { /// /// When this function returns, it is guaranteed that some initialization /// has run and completed (it may not be the closure specified). - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn call_once<F>(&'static self, f: F) where F: FnOnce() { // Optimize common path: load is much cheaper than fetch_add. if self.cnt.load(Ordering::SeqCst) < 0 { diff --git a/src/libstd/sync/poison.rs b/src/libstd/sync/poison.rs index d7fcee3ae2e..18680b96592 100644 --- a/src/libstd/sync/poison.rs +++ b/src/libstd/sync/poison.rs @@ -53,22 +53,22 @@ pub struct Guard { /// is held. The precise semantics for when a lock is poisoned is documented on /// each lock, but once a lock is poisoned then all future acquisitions will /// return this error. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct PoisonError<T> { guard: T, } /// An enumeration of possible errors which can occur while calling the /// `try_lock` method. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub enum TryLockError<T> { /// The lock could not be acquired because another task failed while holding /// the lock. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] Poisoned(PoisonError<T>), /// The lock could not be acquired at this time because the operation would /// otherwise block. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] WouldBlock, } @@ -79,7 +79,7 @@ pub enum TryLockError<T> { /// that the primitive was poisoned. Note that the `Err` variant *also* carries /// the associated guard, and it can be acquired through the `into_inner` /// method. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>; /// A type alias for the result of a nonblocking locking method. @@ -87,17 +87,17 @@ pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>; /// For more information, see `LockResult`. A `TryLockResult` doesn't /// necessarily hold the associated guard in the `Err` type as the lock may not /// have been acquired for other reasons. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>; -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Debug for PoisonError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "PoisonError { inner: .. }".fmt(f) } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Display for PoisonError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.description().fmt(f) @@ -113,22 +113,23 @@ impl<T> Error for PoisonError<T> { impl<T> PoisonError<T> { /// Consumes this error indicating that a lock is poisoned, returning the /// underlying guard to allow access regardless. - #[deprecated="renamed to into_inner"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", reason = "renamed to into_inner")] pub fn into_guard(self) -> T { self.guard } /// Consumes this error indicating that a lock is poisoned, returning the /// underlying guard to allow access regardless. - #[unstable] + #[unstable(feature = "std_misc")] pub fn into_inner(self) -> T { self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// reference to the underlying guard to allow access regardless. - #[unstable] + #[unstable(feature = "std_misc")] pub fn get_ref(&self) -> &T { &self.guard } /// Reaches into this error indicating that a lock is poisoned, returning a /// mutable reference to the underlying guard to allow access regardless. - #[unstable] + #[unstable(feature = "std_misc")] pub fn get_mut(&mut self) -> &mut T { &mut self.guard } } @@ -138,7 +139,7 @@ impl<T> FromError<PoisonError<T>> for TryLockError<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Debug for TryLockError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -148,7 +149,7 @@ impl<T> fmt::Debug for TryLockError<T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> fmt::Display for TryLockError<T> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.description().fmt(f) diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 8cc2cac33ec..12befbf72e3 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -58,7 +58,7 @@ use sys_common::rwlock as sys; /// assert_eq!(*w, 6); /// } // write lock is dropped here /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RwLock<T> { inner: Box<StaticRwLock>, data: UnsafeCell<T>, @@ -90,7 +90,8 @@ unsafe impl<T> Sync for RwLock<T> {} /// } /// unsafe { LOCK.destroy() } // free all resources /// ``` -#[unstable = "may be merged with RwLock in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub struct StaticRwLock { lock: sys::RWLock, poison: poison::Flag, @@ -100,7 +101,8 @@ unsafe impl Send for StaticRwLock {} unsafe impl Sync for StaticRwLock {} /// Constant initialization for a statically-initialized rwlock. -#[unstable = "may be merged with RwLock in the future"] +#[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock { lock: sys::RWLOCK_INIT, poison: poison::FLAG_INIT, @@ -109,7 +111,7 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock { /// RAII structure used to release the shared read access of a lock when /// dropped. #[must_use] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockReadGuard<'a, T: 'a> { __lock: &'a StaticRwLock, __data: &'a UnsafeCell<T>, @@ -120,7 +122,7 @@ impl<'a, T> !marker::Send for RwLockReadGuard<'a, T> {} /// RAII structure used to release the exclusive write access of a lock when /// dropped. #[must_use] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockWriteGuard<'a, T: 'a> { __lock: &'a StaticRwLock, __data: &'a UnsafeCell<T>, @@ -139,7 +141,7 @@ impl<T: Send + Sync> RwLock<T> { /// /// let lock = RwLock::new(5); /// ``` - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new(t: T) -> RwLock<T> { RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) } } @@ -162,7 +164,7 @@ impl<T: Send + Sync> RwLock<T> { /// is poisoned whenever a writer panics while holding an exclusive lock. /// The failure will occur immediately after the lock has been acquired. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn read(&self) -> LockResult<RwLockReadGuard<T>> { unsafe { self.inner.lock.read() } RwLockReadGuard::new(&*self.inner, &self.data) @@ -184,7 +186,7 @@ impl<T: Send + Sync> RwLock<T> { /// error will only be returned if the lock would have otherwise been /// acquired. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> { if unsafe { self.inner.lock.try_read() } { Ok(try!(RwLockReadGuard::new(&*self.inner, &self.data))) @@ -208,7 +210,7 @@ impl<T: Send + Sync> RwLock<T> { /// is poisoned whenever a writer panics while holding an exclusive lock. /// An error will be returned when the lock is acquired. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> { unsafe { self.inner.lock.write() } RwLockWriteGuard::new(&*self.inner, &self.data) @@ -227,7 +229,7 @@ impl<T: Send + Sync> RwLock<T> { /// error will only be returned if the lock would have otherwise been /// acquired. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> { if unsafe { self.inner.lock.try_read() } { Ok(try!(RwLockWriteGuard::new(&*self.inner, &self.data))) @@ -238,7 +240,7 @@ impl<T: Send + Sync> RwLock<T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<T> Drop for RwLock<T> { fn drop(&mut self) { unsafe { self.inner.lock.destroy() } @@ -255,7 +257,8 @@ impl StaticRwLock { /// /// See `RwLock::read`. #[inline] - #[unstable = "may be merged with RwLock in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub fn read(&'static self) -> LockResult<RwLockReadGuard<'static, ()>> { unsafe { self.lock.read() } RwLockReadGuard::new(self, &DUMMY.0) @@ -265,7 +268,8 @@ impl StaticRwLock { /// /// See `RwLock::try_read`. #[inline] - #[unstable = "may be merged with RwLock in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub fn try_read(&'static self) -> TryLockResult<RwLockReadGuard<'static, ()>> { if unsafe { self.lock.try_read() } { @@ -280,7 +284,8 @@ impl StaticRwLock { /// /// See `RwLock::write`. #[inline] - #[unstable = "may be merged with RwLock in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub fn write(&'static self) -> LockResult<RwLockWriteGuard<'static, ()>> { unsafe { self.lock.write() } RwLockWriteGuard::new(self, &DUMMY.0) @@ -290,7 +295,8 @@ impl StaticRwLock { /// /// See `RwLock::try_write`. #[inline] - #[unstable = "may be merged with RwLock in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub fn try_write(&'static self) -> TryLockResult<RwLockWriteGuard<'static, ()>> { if unsafe { self.lock.try_write() } { @@ -306,7 +312,8 @@ impl StaticRwLock { /// active users of the lock, and this also doesn't prevent any future users /// of this lock. This method is required to be called to not leak memory on /// all platforms. - #[unstable = "may be merged with RwLock in the future"] + #[unstable(feature = "std_misc", + reason = "may be merged with RwLock in the future")] pub unsafe fn destroy(&'static self) { self.lock.destroy() } @@ -338,19 +345,19 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'rwlock, T> Deref for RwLockReadGuard<'rwlock, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.__data.get() } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'rwlock, T> Deref for RwLockWriteGuard<'rwlock, T> { type Target = T; fn deref(&self) -> &T { unsafe { &*self.__data.get() } } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> { fn deref_mut(&mut self) -> &mut T { unsafe { &mut *self.__data.get() } @@ -358,7 +365,7 @@ impl<'rwlock, T> DerefMut for RwLockWriteGuard<'rwlock, T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Drop for RwLockReadGuard<'a, T> { fn drop(&mut self) { unsafe { self.__lock.lock.read_unlock(); } @@ -366,7 +373,7 @@ impl<'a, T> Drop for RwLockReadGuard<'a, T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Drop for RwLockWriteGuard<'a, T> { fn drop(&mut self) { self.__lock.poison.done(&self.__poison); diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index 8d44084671a..0304b898884 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable = "the interaction between semaphores and the acquisition/release \ - of resources is currently unclear"] +#![unstable(feature = "std_misc", + reason = "the interaction between semaphores and the acquisition/release \ + of resources is currently unclear")] use ops::Drop; use sync::{Mutex, Condvar}; @@ -99,7 +100,7 @@ impl Semaphore { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> Drop for SemaphoreGuard<'a> { fn drop(&mut self) { self.sem.release(); diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 278528bdb38..3fac998d3e7 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -10,10 +10,11 @@ //! Abstraction of a thread pool for basic parallelism. -#![unstable = "the semantics of a failing task and whether a thread is \ - re-attached to a thread pool are somewhat unclear, and the \ - utility of this type in `std::sync` is questionable with \ - respect to the jobs of other primitives"] +#![unstable(feature = "std_misc", + reason = "the semantics of a failing task and whether a thread is \ + re-attached to a thread pool are somewhat unclear, and the \ + utility of this type in `std::sync` is questionable with \ + respect to the jobs of other primitives")] use core::prelude::*; diff --git a/src/libstd/sys/unix/ext.rs b/src/libstd/sys/unix/ext.rs index 37c47d593e0..4a82b2807e7 100644 --- a/src/libstd/sys/unix/ext.rs +++ b/src/libstd/sys/unix/ext.rs @@ -29,7 +29,7 @@ //! } //! ``` -#![unstable] +#![unstable(feature = "std_misc")] use vec::Vec; use sys::os_str::Buf; diff --git a/src/libstd/sys/windows/ext.rs b/src/libstd/sys/windows/ext.rs index 8e87f8cba36..a3bbf5c5fe7 100644 --- a/src/libstd/sys/windows/ext.rs +++ b/src/libstd/sys/windows/ext.rs @@ -14,7 +14,7 @@ //! descriptors, and sockets, but its functionality will grow over //! time. -#![unstable] +#![unstable(feature = "std_misc")] pub use sys_common::wtf8::{Wtf8Buf, EncodeWide}; diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index 4d932b3e777..c19ec8ea25c 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -144,7 +144,7 @@ //! //! * It can be implemented highly efficiently on many platforms. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use any::Any; use boxed::Box; @@ -166,7 +166,7 @@ use sys_common::{stack, thread_info}; /// Thread configuration. Provides detailed control over the properties /// and behavior of new threads. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Builder { // A name for the thread-to-be, for identification in panic messages name: Option<String>, @@ -181,7 +181,7 @@ pub struct Builder { impl Builder { /// Generate the base configuration for spawning a thread, from which /// configuration methods can be chained. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn new() -> Builder { Builder { name: None, @@ -193,28 +193,30 @@ impl Builder { /// Name the thread-to-be. Currently the name is used for identification /// only in panic messages. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn name(mut self, name: String) -> Builder { self.name = Some(name); self } /// Set the size of the stack for the new thread. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn stack_size(mut self, size: uint) -> Builder { self.stack_size = Some(size); self } /// Redirect thread-local stdout. - #[unstable = "Will likely go away after proc removal"] + #[unstable(feature = "std_misc", + reason = "Will likely go away after proc removal")] pub fn stdout(mut self, stdout: Box<Writer + Send>) -> Builder { self.stdout = Some(stdout); self } /// Redirect thread-local stderr. - #[unstable = "Will likely go away after proc removal"] + #[unstable(feature = "std_misc", + reason = "Will likely go away after proc removal")] pub fn stderr(mut self, stderr: Box<Writer + Send>) -> Builder { self.stderr = Some(stderr); self @@ -223,7 +225,8 @@ impl Builder { /// Spawn a new detached thread, and return a handle to it. /// /// See `Thead::spawn` and the module doc for more details. - #[unstable = "may change with specifics of new Send semantics"] + #[unstable(feature = "std_misc", + reason = "may change with specifics of new Send semantics")] pub fn spawn<F>(self, f: F) -> Thread where F: FnOnce(), F: Send + 'static { let (native, thread) = self.spawn_inner(Thunk::new(f), Thunk::with_arg(|_| {})); unsafe { imp::detach(native) }; @@ -234,7 +237,8 @@ impl Builder { /// scope, and return a `JoinGuard`. /// /// See `Thead::scoped` and the module doc for more details. - #[unstable = "may change with specifics of new Send semantics"] + #[unstable(feature = "std_misc", + reason = "may change with specifics of new Send semantics")] pub fn scoped<'a, T, F>(self, f: F) -> JoinGuard<'a, T> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { @@ -326,7 +330,7 @@ struct Inner { unsafe impl Sync for Inner {} #[derive(Clone)] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] /// A handle to a thread. pub struct Thread { inner: Arc<Inner>, @@ -350,7 +354,8 @@ impl Thread { /// main thread; the whole process is terminated when the main thread /// finishes.) The thread handle can be used for low-level /// synchronization. See the module documentation for additional details. - #[unstable = "may change with specifics of new Send semantics"] + #[unstable(feature = "std_misc", + reason = "may change with specifics of new Send semantics")] pub fn spawn<F>(f: F) -> Thread where F: FnOnce(), F: Send + 'static { Builder::new().spawn(f) } @@ -363,7 +368,8 @@ impl Thread { /// current thread's stack (hence the "scoped" name), it cannot be detached; /// it *must* be joined before the relevant stack frame is popped. See the /// module documentation for additional details. - #[unstable = "may change with specifics of new Send semantics"] + #[unstable(feature = "std_misc", + reason = "may change with specifics of new Send semantics")] pub fn scoped<'a, T, F>(f: F) -> JoinGuard<'a, T> where T: Send + 'a, F: FnOnce() -> T, F: Send + 'a { @@ -371,20 +377,20 @@ impl Thread { } /// Gets a handle to the thread that invokes it. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn current() -> Thread { thread_info::current_thread() } /// Cooperatively give up a timeslice to the OS scheduler. - #[unstable = "name may change"] + #[unstable(feature = "std_misc", reason = "name may change")] pub fn yield_now() { unsafe { imp::yield_now() } } /// Determines whether the current thread is unwinding because of panic. #[inline] - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn panicking() -> bool { unwind::panicking() } @@ -398,7 +404,7 @@ impl Thread { // future, this will be implemented in a more efficient way, perhaps along the lines of // http://cr.openjdk.java.net/~stefank/6989984.1/raw_files/new/src/os/linux/vm/os_linux.cpp // or futuxes, and in either case may allow spurious wakeups. - #[unstable = "recently introduced"] + #[unstable(feature = "std_misc", reason = "recently introduced")] pub fn park() { let thread = Thread::current(); let mut guard = thread.inner.lock.lock().unwrap(); @@ -411,7 +417,7 @@ impl Thread { /// Atomically makes the handle's token available if it is not already. /// /// See the module doc for more detail. - #[unstable = "recently introduced"] + #[unstable(feature = "std_misc", reason = "recently introduced")] pub fn unpark(&self) { let mut guard = self.inner.lock.lock().unwrap(); if !*guard { @@ -421,7 +427,7 @@ impl Thread { } /// Get the thread's name. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn name(&self) -> Option<&str> { self.inner.name.as_ref().map(|s| s.as_slice()) } @@ -435,7 +441,7 @@ impl thread_info::NewThread for Thread { /// Indicates the manner in which a thread exited. /// /// A thread that completes without panicking is considered to exit successfully. -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub type Result<T> = ::result::Result<T, Box<Any + Send>>; struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>); @@ -447,7 +453,8 @@ unsafe impl<T> Sync for Packet<T> {} /// /// The type `T` is the return type for the thread's main function. #[must_use] -#[unstable = "may change with specifics of new Send semantics"] +#[unstable(feature = "std_misc", + reason = "may change with specifics of new Send semantics")] pub struct JoinGuard<'a, T: 'a> { native: imp::rust_thread, thread: Thread, @@ -455,12 +462,12 @@ pub struct JoinGuard<'a, T: 'a> { packet: Packet<T>, } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl<'a, T: Send + 'a> Sync for JoinGuard<'a, T> {} impl<'a, T: Send + 'a> JoinGuard<'a, T> { /// Extract a handle to the thread this guard will join on. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn thread(&self) -> &Thread { &self.thread } @@ -470,7 +477,7 @@ impl<'a, T: Send + 'a> JoinGuard<'a, T> { /// /// If the child thread panics, `Err` is returned with the parameter given /// to `panic`. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn join(mut self) -> Result<T> { assert!(!self.joined); unsafe { imp::join(self.native) }; @@ -483,7 +490,8 @@ impl<'a, T: Send + 'a> JoinGuard<'a, T> { impl<T: Send> JoinGuard<'static, T> { /// Detaches the child thread, allowing it to outlive its parent. - #[unstable = "unsure whether this API imposes limitations elsewhere"] + #[unstable(feature = "std_misc", + reason = "unsure whether this API imposes limitations elsewhere")] pub fn detach(mut self) { unsafe { imp::detach(self.native) }; self.joined = true; // avoid joining in the destructor @@ -491,7 +499,7 @@ impl<T: Send> JoinGuard<'static, T> { } #[unsafe_destructor] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> { fn drop(&mut self) { if !self.joined { diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs index f7a2f8e10e9..2a9bf452329 100644 --- a/src/libstd/thread_local/mod.rs +++ b/src/libstd/thread_local/mod.rs @@ -34,7 +34,7 @@ //! will want to make use of some form of **interior mutability** through the //! `Cell` or `RefCell` types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use prelude::v1::*; @@ -93,7 +93,7 @@ pub mod __impl { /// assert_eq!(*f.borrow(), 2); /// }); /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Key<T> { // The key itself may be tagged with #[thread_local], and this `Key` is // stored as a `static`, and it's not valid for a static to reference the @@ -113,7 +113,7 @@ pub struct Key<T> { /// Declare a new thread local storage key of type `std::thread_local::Key`. #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! thread_local { (static $name:ident: $t:ty = $init:expr) => ( static $name: ::std::thread_local::Key<$t> = { @@ -218,7 +218,8 @@ macro_rules! __thread_local_inner { } /// Indicator of the state of a thread local storage key. -#[unstable = "state querying was recently added"] +#[unstable(feature = "std_misc", + reason = "state querying was recently added")] #[derive(Eq, PartialEq, Copy)] pub enum State { /// All keys are in this state whenever a thread starts. Keys will @@ -258,7 +259,7 @@ impl<T: 'static> Key<T> { /// This function will `panic!()` if the key currently has its /// destructor running, and it **may** panic if the destructor has /// previously been run for this thread. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn with<F, R>(&'static self, f: F) -> R where F: FnOnce(&T) -> R { let slot = (self.inner)(); @@ -301,7 +302,8 @@ impl<T: 'static> Key<T> { /// initialization does not panic. Keys in the `Valid` state are guaranteed /// to be able to be accessed. Keys in the `Destroyed` state will panic on /// any call to `with`. - #[unstable = "state querying was recently added"] + #[unstable(feature = "std_misc", + reason = "state querying was recently added")] pub fn state(&'static self) -> State { unsafe { match (self.inner)().get() { @@ -317,7 +319,9 @@ impl<T: 'static> Key<T> { } /// Deprecated - #[deprecated = "function renamed to state() and returns more info"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "function renamed to state() and returns more info")] pub fn destroyed(&'static self) -> bool { self.state() == State::Destroyed } } diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 1fb5652bc0c..1a20612d60a 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -38,8 +38,9 @@ //! }); //! ``` -#![unstable = "scoped TLS has yet to have wide enough use to fully consider \ - stabilizing its interface"] +#![unstable(feature = "std_misc", + reason = "scoped TLS has yet to have wide enough use to fully consider \ + stabilizing its interface")] use prelude::v1::*; diff --git a/src/libstd/thunk.rs b/src/libstd/thunk.rs index 1830a4df54a..2e53d0ceecb 100644 --- a/src/libstd/thunk.rs +++ b/src/libstd/thunk.rs @@ -10,6 +10,7 @@ // Because this module is temporary... #![allow(missing_docs)] +#![unstable(feature = "std_misc")] use alloc::boxed::Box; use core::marker::Send; diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 2d56a8bcddf..fdd9cbdccf5 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -10,7 +10,7 @@ //! Temporal quantification -#![unstable] +#![unstable(feature = "std_misc")] use {fmt, i64}; use ops::{Add, Sub, Mul, Div, Neg, FnOnce}; @@ -334,7 +334,7 @@ impl Div<i32> for Duration { } } -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for Duration { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // technically speaking, negative duration is not valid ISO 8601, diff --git a/src/libstd/tuple.rs b/src/libstd/tuple.rs index e76dcef226d..2a911557765 100644 --- a/src/libstd/tuple.rs +++ b/src/libstd/tuple.rs @@ -57,4 +57,4 @@ //! ``` #![doc(primitive = "tuple")] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/unit.rs b/src/libstd/unit.rs index 012b175b031..2c3ddcd9d49 100644 --- a/src/libstd/unit.rs +++ b/src/libstd/unit.rs @@ -9,7 +9,7 @@ // except according to those terms. #![doc(primitive = "unit")] -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] //! The `()` type, sometimes called "unit" or "nil". //! |
