about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-07 17:18:59 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-07 17:18:59 -0800
commita204dc56c97f35632575b1baa008f2e069b1bed9 (patch)
treeb55c302f46d0adb457d3ce2f250bc0b1209d0996 /src/libcore
parenta6bf7676a545f72cef2e3d042b6d0409f295693a (diff)
parent9851b4fbbf327bb1baab3182ce92970d4db22c6c (diff)
downloadrust-a204dc56c97f35632575b1baa008f2e069b1bed9.tar.gz
rust-a204dc56c97f35632575b1baa008f2e069b1bed9.zip
rollup merge of #20722: alexcrichton/audit-show
Conflicts:
	src/libcollections/vec.rs
	src/libcore/fmt/mod.rs
	src/librustdoc/html/format.rs
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/borrow.rs1
-rw-r--r--src/libcore/fmt/mod.rs39
-rw-r--r--src/libcore/option.rs12
3 files changed, 13 insertions, 39 deletions
diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs
index 484b816413b..4363a0a4441 100644
--- a/src/libcore/borrow.rs
+++ b/src/libcore/borrow.rs
@@ -238,6 +238,7 @@ impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwne
     }
 }
 
+#[stable]
 impl<'a, T, B: ?Sized> fmt::String for Cow<'a, T, B> where
     B: fmt::String + ToOwned<T>,
     T: fmt::String,
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index cd6e9dafca3..a9da1903d69 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -219,6 +219,7 @@ impl<'a> Show for Arguments<'a> {
     }
 }
 
+#[stable]
 impl<'a> String for Arguments<'a> {
     fn fmt(&self, fmt: &mut Formatter) -> Result {
         write(fmt.buf, *self)
@@ -627,6 +628,7 @@ impl Show for bool {
     }
 }
 
+#[stable]
 impl String for bool {
     fn fmt(&self, f: &mut Formatter) -> Result {
         String::fmt(if *self { "true" } else { "false" }, f)
@@ -643,6 +645,7 @@ impl Show for str {
     }
 }
 
+#[stable]
 impl String for str {
     fn fmt(&self, f: &mut Formatter) -> Result {
         f.pad(self)
@@ -660,6 +663,7 @@ impl Show for char {
     }
 }
 
+#[stable]
 impl String for char {
     fn fmt(&self, f: &mut Formatter) -> Result {
         let mut utf8 = [0u8; 4];
@@ -705,6 +709,7 @@ macro_rules! floating { ($ty:ident) => {
         }
     }
 
+    #[stable]
     impl String for $ty {
         fn fmt(&self, fmt: &mut Formatter) -> Result {
             use num::Float;
@@ -776,15 +781,9 @@ floating! { f64 }
 impl<T> Show for *const T {
     fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
 }
-impl<T> String for *const T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
-}
 impl<T> Show for *mut T {
     fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
 }
-impl<T> String for *mut T {
-    fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
-}
 
 macro_rules! peel {
     ($name:ident, $($other:ident,)*) => (tuple! { $($other,)* })
@@ -843,39 +842,12 @@ impl<T: Show> Show for [T] {
     }
 }
 
-impl<T: String> String for [T] {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
-            try!(write!(f, "["));
-        }
-        let mut is_first = true;
-        for x in self.iter() {
-            if is_first {
-                is_first = false;
-            } else {
-                try!(write!(f, ", "));
-            }
-            try!(write!(f, "{}", *x))
-        }
-        if f.flags & (1 << (rt::FlagAlternate as uint)) == 0 {
-            try!(write!(f, "]"));
-        }
-        Ok(())
-    }
-}
-
 impl Show for () {
     fn fmt(&self, f: &mut Formatter) -> Result {
         f.pad("()")
     }
 }
 
-impl String for () {
-    fn fmt(&self, f: &mut Formatter) -> Result {
-        f.pad("()")
-    }
-}
-
 impl<T: Copy + Show> Show for Cell<T> {
     fn fmt(&self, f: &mut Formatter) -> Result {
         write!(f, "Cell {{ value: {:?} }}", self.get())
@@ -904,6 +876,7 @@ impl<'b, T: Show> Show for RefMut<'b, T> {
     }
 }
 
+#[stable]
 impl String for Utf8Error {
     fn fmt(&self, f: &mut Formatter) -> Result {
         match *self {
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 272570a0d5b..56e27e801af 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -145,17 +145,18 @@
 
 use self::Option::*;
 
+use clone::Clone;
 use cmp::{Eq, Ord};
 use default::Default;
-use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator};
+use fmt;
 use iter::{ExactSizeIterator};
+use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator};
 use mem;
-use result::Result;
+use ops::{Deref, FnOnce};
 use result::Result::{Ok, Err};
-use slice;
+use result::Result;
 use slice::AsSlice;
-use clone::Clone;
-use ops::{Deref, FnOnce};
+use slice;
 
 // Note that this is not a lang item per se, but it has a hidden dependency on
 // `Iterator`, which is one. The compiler assumes that the `next` method of
@@ -762,7 +763,6 @@ impl<T> AsSlice<T> for Option<T> {
 
 #[stable]
 impl<T> Default for Option<T> {
-    #[stable]
     #[inline]
     #[stable]
     fn default() -> Option<T> { None }