Skip to content

Commit 7a6df9c

Browse files
Bleigraydon
authored andcommitted
core: Implement ToStr for @str
1 parent 7568dd4 commit 7a6df9c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/to_str.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ impl ~str: ToStr {
4949
impl &str: ToStr {
5050
fn to_str() -> ~str { str::from_slice(self) }
5151
}
52+
impl @str: ToStr {
53+
fn to_str() -> ~str { str::from_slice(self) }
54+
}
5255

5356
impl<A: ToStr Copy, B: ToStr Copy> (A, B): ToStr {
5457
fn to_str() -> ~str {
@@ -96,6 +99,7 @@ mod tests {
9699
assert false.to_str() == ~"false";
97100
assert ().to_str() == ~"()";
98101
assert (~"hi").to_str() == ~"hi";
102+
assert (@"hi").to_str() == ~"hi";
99103
}
100104

101105
#[test]

0 commit comments

Comments
 (0)