about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Williams <peter@newton.cx>2013-02-23 17:41:44 -0500
committerPeter Williams <peter@newton.cx>2013-02-23 17:43:08 -0500
commita712d828f93ca08c072808d57fb110b1f9d0ca72 (patch)
tree9597dee1a5ab0b48f4c593792ac25d726d06a6f4
parent82062a63485b75b7476d078e722b49e3eb376795 (diff)
downloadrust-a712d828f93ca08c072808d57fb110b1f9d0ca72.tar.gz
rust-a712d828f93ca08c072808d57fb110b1f9d0ca72.zip
libcore: remove default to_str implementations for pointer types
These couldn't be overridden and so ended up being quite restrictive. This has
the side effect of changing the stringification of ~vecs, but nothing in
relied on this. Closes #4869.
-rw-r--r--src/libcore/to_str.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs
index 0145adc77b8..02192ec344f 100644
--- a/src/libcore/to_str.rs
+++ b/src/libcore/to_str.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -94,15 +94,6 @@ impl<A:ToStr> ToStr for ~[A] {
     }
 }
 
-impl<A:ToStr> ToStr for @A {
-    #[inline(always)]
-    pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() }
-}
-impl<A:ToStr> ToStr for ~A {
-    #[inline(always)]
-    pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() }
-}
-
 #[cfg(test)]
 #[allow(non_implicitly_copyable_typarams)]
 mod tests {
@@ -127,19 +118,12 @@ mod tests {
     }
 
     #[test]
-    #[ignore]
     fn test_vectors() {
         let x: ~[int] = ~[];
-        assert x.to_str() == ~"~[]";
-        assert (~[1]).to_str() == ~"~[1]";
-        assert (~[1, 2, 3]).to_str() == ~"~[1, 2, 3]";
+        assert x.to_str() == ~"[]";
+        assert (~[1]).to_str() == ~"[1]";
+        assert (~[1, 2, 3]).to_str() == ~"[1, 2, 3]";
         assert (~[~[], ~[1], ~[1, 1]]).to_str() ==
-               ~"~[~[], ~[1], ~[1, 1]]";
-    }
-
-    #[test]
-    fn test_pointer_types() {
-        assert (@1).to_str() == ~"@1";
-        assert (~(true, false)).to_str() == ~"~(true, false)";
+               ~"[[], [1], [1, 1]]";
     }
 }