Skip to content

Commit a712d82

Browse files
committed
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.
1 parent 82062a6 commit a712d82

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/libcore/to_str.rs

+5-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -94,15 +94,6 @@ impl<A:ToStr> ToStr for ~[A] {
9494
}
9595
}
9696
97-
impl<A:ToStr> ToStr for @A {
98-
#[inline(always)]
99-
pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() }
100-
}
101-
impl<A:ToStr> ToStr for ~A {
102-
#[inline(always)]
103-
pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() }
104-
}
105-
10697
#[cfg(test)]
10798
#[allow(non_implicitly_copyable_typarams)]
10899
mod tests {
@@ -127,19 +118,12 @@ mod tests {
127118
}
128119

129120
#[test]
130-
#[ignore]
131121
fn test_vectors() {
132122
let x: ~[int] = ~[];
133-
assert x.to_str() == ~"~[]";
134-
assert (~[1]).to_str() == ~"~[1]";
135-
assert (~[1, 2, 3]).to_str() == ~"~[1, 2, 3]";
123+
assert x.to_str() == ~"[]";
124+
assert (~[1]).to_str() == ~"[1]";
125+
assert (~[1, 2, 3]).to_str() == ~"[1, 2, 3]";
136126
assert (~[~[], ~[1], ~[1, 1]]).to_str() ==
137-
~"~[~[], ~[1], ~[1, 1]]";
138-
}
139-
140-
#[test]
141-
fn test_pointer_types() {
142-
assert (@1).to_str() == ~"@1";
143-
assert (~(true, false)).to_str() == ~"~(true, false)";
127+
~"[[], [1], [1, 1]]";
144128
}
145129
}

0 commit comments

Comments
 (0)