about summary refs log tree commit diff
path: root/src/libcollections/string.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2015-01-12 18:40:19 -0800
committerBrian Anderson <banderson@mozilla.com>2015-01-21 16:16:18 -0800
commit94ca8a361026d1a622a961e8dc8cacc331ed1ac3 (patch)
tree58179e85714f0a1ee618a8a9982aadbeb65822cf /src/libcollections/string.rs
parent90aa581cff54ed1bb5f53ee2ead3764fca94fdf3 (diff)
downloadrust-94ca8a361026d1a622a961e8dc8cacc331ed1ac3.tar.gz
rust-94ca8a361026d1a622a961e8dc8cacc331ed1ac3.zip
Add 'feature' and 'since' to stability attributes
Diffstat (limited to 'src/libcollections/string.rs')
-rw-r--r--src/libcollections/string.rs112
1 files changed, 58 insertions, 54 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 5d35d8a8679..d23be315481 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -12,7 +12,7 @@
 
 //! An owned, growable string that enforces that its contents are valid UTF-8.
 
-#![stable]
+#![stable(feature = "grandfathered", since = "1.0.0")]
 
 use core::prelude::*;
 
@@ -33,20 +33,20 @@ use vec::{DerefVec, Vec, as_vec};
 
 /// A growable string stored as a UTF-8 encoded buffer.
 #[derive(Clone, PartialOrd, Eq, Ord)]
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 pub struct String {
     vec: Vec<u8>,
 }
 
 /// A possible error value from the `String::from_utf8` function.
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 pub struct FromUtf8Error {
     bytes: Vec<u8>,
     error: Utf8Error,
 }
 
 /// A possible error value from the `String::from_utf16` function.
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 #[allow(missing_copy_implementations)]
 pub struct FromUtf16Error(());
 
@@ -59,7 +59,7 @@ impl String {
     /// let mut s = String::new();
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn new() -> String {
         String {
             vec: Vec::new(),
@@ -76,7 +76,7 @@ impl String {
     /// let mut s = String::with_capacity(10);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn with_capacity(capacity: uint) -> String {
         String {
             vec: Vec::with_capacity(capacity),
@@ -92,7 +92,8 @@ impl String {
     /// assert_eq!(s.as_slice(), "hello");
     /// ```
     #[inline]
-    #[unstable = "needs investigation to see if to_string() can match perf"]
+    #[unstable(feature = "unnamed_feature", since = "1.0.0",
+               reason = "needs investigation to see if to_string() can match perf")]
     pub fn from_str(string: &str) -> String {
         String { vec: ::slice::SliceExt::to_vec(string.as_bytes()) }
     }
@@ -120,7 +121,7 @@ impl String {
     /// assert_eq!(s.into_bytes(), vec![240, 144, 128]);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
         match str::from_utf8(vec.as_slice()) {
             Ok(..) => Ok(String { vec: vec }),
@@ -138,7 +139,7 @@ impl String {
     /// let output = String::from_utf8_lossy(input);
     /// assert_eq!(output.as_slice(), "Hello \u{FFFD}World");
     /// ```
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> {
         let mut i = 0;
         match str::from_utf8(v) {
@@ -276,7 +277,7 @@ impl String {
     /// v[4] = 0xD800;
     /// assert!(String::from_utf16(v).is_err());
     /// ```
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
         let mut s = String::with_capacity(v.len());
         for c in unicode_str::utf16_items(v) {
@@ -303,7 +304,7 @@ impl String {
     ///            "𝄞mus\u{FFFD}ic\u{FFFD}".to_string());
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn from_utf16_lossy(v: &[u16]) -> String {
         unicode_str::utf16_items(v).map(|c| c.to_char_lossy()).collect()
     }
@@ -314,7 +315,7 @@ impl String {
     /// * We call `Vec::from_raw_parts` to get a `Vec<u8>`;
     /// * We assume that the `Vec` contains valid UTF-8.
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub unsafe fn from_raw_parts(buf: *mut u8, length: uint, capacity: uint) -> String {
         String {
             vec: Vec::from_raw_parts(buf, length, capacity),
@@ -325,7 +326,7 @@ impl String {
     /// it contains valid UTF-8. This is unsafe because it assumes that
     /// the UTF-8-ness of the vector has already been validated.
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
         String { vec: bytes }
     }
@@ -340,7 +341,7 @@ impl String {
     /// assert_eq!(bytes, vec![104, 101, 108, 108, 111]);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn into_bytes(self) -> Vec<u8> {
         self.vec
     }
@@ -355,7 +356,7 @@ impl String {
     /// assert_eq!(s.as_slice(), "foobar");
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn push_str(&mut self, string: &str) {
         self.vec.push_all(string.as_bytes())
     }
@@ -370,7 +371,7 @@ impl String {
     /// assert!(s.capacity() >= 10);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn capacity(&self) -> uint {
         self.vec.capacity()
     }
@@ -391,7 +392,7 @@ impl String {
     /// assert!(s.capacity() >= 10);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn reserve(&mut self, additional: uint) {
         self.vec.reserve(additional)
     }
@@ -416,7 +417,7 @@ impl String {
     /// assert!(s.capacity() >= 10);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn reserve_exact(&mut self, additional: uint) {
         self.vec.reserve_exact(additional)
     }
@@ -433,7 +434,7 @@ impl String {
     /// assert_eq!(s.capacity(), 3);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn shrink_to_fit(&mut self) {
         self.vec.shrink_to_fit()
     }
@@ -450,7 +451,7 @@ impl String {
     /// assert_eq!(s.as_slice(), "abc123");
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn push(&mut self, ch: char) {
         if (ch as u32) < 0x80 {
             self.vec.push(ch as u8);
@@ -483,7 +484,7 @@ impl String {
     /// assert_eq!(s.as_bytes(), b);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn as_bytes<'a>(&'a self) -> &'a [u8] {
         self.vec.as_slice()
     }
@@ -503,7 +504,7 @@ impl String {
     /// assert_eq!(s.as_slice(), "he");
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn truncate(&mut self, new_len: uint) {
         assert!(self.is_char_boundary(new_len));
         self.vec.truncate(new_len)
@@ -522,7 +523,7 @@ impl String {
     /// assert_eq!(s.pop(), None);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn pop(&mut self) -> Option<char> {
         let len = self.len();
         if len == 0 {
@@ -558,7 +559,7 @@ impl String {
     /// assert_eq!(s.remove(0), 'o');
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn remove(&mut self, idx: uint) -> char {
         let len = self.len();
         assert!(idx <= len);
@@ -585,7 +586,7 @@ impl String {
     /// If `idx` does not lie on a character boundary or is out of bounds, then
     /// this function will panic.
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn insert(&mut self, idx: uint, ch: char) {
         let len = self.len();
         assert!(idx <= len);
@@ -622,7 +623,7 @@ impl String {
     /// assert_eq!(s.as_slice(), "olleh");
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub unsafe fn as_mut_vec<'a>(&'a mut self) -> &'a mut Vec<u8> {
         &mut self.vec
     }
@@ -636,7 +637,7 @@ impl String {
     /// assert_eq!(a.len(), 3);
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn len(&self) -> uint { self.vec.len() }
 
     /// Returns true if the string contains no bytes
@@ -650,7 +651,7 @@ impl String {
     /// assert!(!v.is_empty());
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn is_empty(&self) -> bool { self.len() == 0 }
 
     /// Truncates the string, returning it to 0 length.
@@ -663,7 +664,7 @@ impl String {
     /// assert!(s.is_empty());
     /// ```
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn clear(&mut self) {
         self.vec.clear()
     }
@@ -672,11 +673,11 @@ impl String {
 impl FromUtf8Error {
     /// Consume this error, returning the bytes that were attempted to make a
     /// `String` with.
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn into_bytes(self) -> Vec<u8> { self.bytes }
 
     /// Access the underlying UTF8-error that was the cause of this error.
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     pub fn utf8_error(&self) -> Utf8Error { self.error }
 }
 
@@ -686,7 +687,7 @@ impl fmt::Show for FromUtf8Error {
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl fmt::String for FromUtf8Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::String::fmt(&self.error, f)
@@ -699,14 +700,14 @@ impl fmt::Show for FromUtf16Error {
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl fmt::String for FromUtf16Error {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::String::fmt("invalid utf-16: lone surrogate found", f)
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl FromIterator<char> for String {
     fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String {
         let mut buf = String::new();
@@ -715,7 +716,7 @@ impl FromIterator<char> for String {
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl<'a> FromIterator<&'a str> for String {
     fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String {
         let mut buf = String::new();
@@ -724,7 +725,8 @@ impl<'a> FromIterator<&'a str> for String {
     }
 }
 
-#[unstable = "waiting on Extend stabilization"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0",
+           reason = "waiting on Extend stabilization")]
 impl Extend<char> for String {
     fn extend<I:Iterator<Item=char>>(&mut self, mut iterator: I) {
         let (lower_bound, _) = iterator.size_hint();
@@ -735,7 +737,8 @@ impl Extend<char> for String {
     }
 }
 
-#[unstable = "waiting on Extend stabilization"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0",
+           reason = "waiting on Extend stabilization")]
 impl<'a> Extend<&'a str> for String {
     fn extend<I: Iterator<Item=&'a str>>(&mut self, mut iterator: I) {
         // A guess that at least one byte per iterator element will be needed.
@@ -747,7 +750,7 @@ impl<'a> Extend<&'a str> for String {
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl PartialEq for String {
     #[inline]
     fn eq(&self, other: &String) -> bool { PartialEq::eq(&**self, &**other) }
@@ -757,7 +760,7 @@ impl PartialEq for String {
 
 macro_rules! impl_eq {
     ($lhs:ty, $rhs: ty) => {
-        #[stable]
+        #[stable(feature = "grandfathered", since = "1.0.0")]
         impl<'a> PartialEq<$rhs> for $lhs {
             #[inline]
             fn eq(&self, other: &$rhs) -> bool { PartialEq::eq(&**self, &**other) }
@@ -765,7 +768,7 @@ macro_rules! impl_eq {
             fn ne(&self, other: &$rhs) -> bool { PartialEq::ne(&**self, &**other) }
         }
 
-        #[stable]
+        #[stable(feature = "grandfathered", since = "1.0.0")]
         impl<'a> PartialEq<$lhs> for $rhs {
             #[inline]
             fn eq(&self, other: &$lhs) -> bool { PartialEq::eq(&**self, &**other) }
@@ -779,7 +782,7 @@ macro_rules! impl_eq {
 impl_eq! { String, &'a str }
 impl_eq! { CowString<'a>, String }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl<'a, 'b> PartialEq<&'b str> for CowString<'a> {
     #[inline]
     fn eq(&self, other: &&'b str) -> bool { PartialEq::eq(&**self, &**other) }
@@ -787,7 +790,7 @@ impl<'a, 'b> PartialEq<&'b str> for CowString<'a> {
     fn ne(&self, other: &&'b str) -> bool { PartialEq::ne(&**self, &**other) }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl<'a, 'b> PartialEq<CowString<'a>> for &'b str {
     #[inline]
     fn eq(&self, other: &CowString<'a>) -> bool { PartialEq::eq(&**self, &**other) }
@@ -795,25 +798,25 @@ impl<'a, 'b> PartialEq<CowString<'a>> for &'b str {
     fn ne(&self, other: &CowString<'a>) -> bool { PartialEq::ne(&**self, &**other) }
 }
 
-#[unstable = "waiting on Str stabilization"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "waiting on Str stabilization")]
 impl Str for String {
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     fn as_slice<'a>(&'a self) -> &'a str {
         unsafe { mem::transmute(self.vec.as_slice()) }
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl Default for String {
     #[inline]
-    #[stable]
+    #[stable(feature = "grandfathered", since = "1.0.0")]
     fn default() -> String {
         String::new()
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl fmt::String for String {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -821,7 +824,7 @@ impl fmt::String for String {
     }
 }
 
-#[unstable = "waiting on fmt stabilization"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "waiting on fmt stabilization")]
 impl fmt::Show for String {
     #[inline]
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -829,7 +832,7 @@ impl fmt::Show for String {
     }
 }
 
-#[unstable = "waiting on Hash stabilization"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "waiting on Hash stabilization")]
 impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for String {
     #[inline]
     fn hash(&self, hasher: &mut H) {
@@ -837,7 +840,8 @@ impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for String {
     }
 }
 
-#[unstable = "recent addition, needs more experience"]
+#[unstable(feature = "unnamed_feature", since = "1.0.0",
+           reason = "recent addition, needs more experience")]
 impl<'a> Add<&'a str> for String {
     type Output = String;
 
@@ -877,7 +881,7 @@ impl ops::Index<ops::FullRange> for String {
     }
 }
 
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 impl ops::Deref for String {
     type Target = str;
 
@@ -888,7 +892,7 @@ impl ops::Deref for String {
 }
 
 /// Wrapper type providing a `&String` reference via `Deref`.
-#[unstable]
+#[unstable(feature = "unnamed_feature", since = "1.0.0")]
 pub struct DerefString<'a> {
     x: DerefVec<'a, u8>
 }
@@ -916,7 +920,7 @@ impl<'a> Deref for DerefString<'a> {
 /// let string = as_string("foo").clone();
 /// string_consumer(string);
 /// ```
-#[unstable]
+#[unstable(feature = "unnamed_feature", since = "1.0.0")]
 pub fn as_string<'a>(x: &'a str) -> DerefString<'a> {
     DerefString { x: as_vec(x.as_bytes()) }
 }
@@ -960,7 +964,7 @@ impl<'a> IntoCow<'a, String, str> for &'a str {
 }
 
 /// A clone-on-write string
-#[stable]
+#[stable(feature = "grandfathered", since = "1.0.0")]
 pub type CowString<'a> = Cow<'a, String, str>;
 
 impl<'a> Str for CowString<'a> {