From a712d828f93ca08c072808d57fb110b1f9d0ca72 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Sat, 23 Feb 2013 17:41:44 -0500 Subject: [PATCH] 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. --- src/libcore/to_str.rs | 26 +++++--------------------- 1 file 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 ToStr for ~[A] { } } -impl ToStr for @A { - #[inline(always)] - pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() } -} -impl 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]]"; } }