about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-08 20:06:40 +0000
committerbors <bors@rust-lang.org>2014-07-08 20:06:40 +0000
commit8bb34a3146e6ba4bc7902a85de90cf4f8064ace0 (patch)
treef5dd9ae1066eb755649fcced85e998d72147de19 /src/libstd
parent35e21346216cc4c5a3b22bb6fb316f8c867f8c92 (diff)
parent12c334a77b897f7b1cb6cff3c56a71ecb89c82af (diff)
downloadrust-8bb34a3146e6ba4bc7902a85de90cf4f8064ace0.tar.gz
rust-8bb34a3146e6ba4bc7902a85de90cf4f8064ace0.zip
auto merge of #15493 : brson/rust/tostr, r=pcwalton
This updates https://github.com/rust-lang/rust/pull/15075.

Rename `ToStr::to_str` to `ToString::to_string`. The naive renaming ends up with two `to_string` functions defined on strings in the prelude (the other defined via `collections::str::StrAllocating`). To remedy this I removed `StrAllocating::to_string`, making all conversions from `&str` to `String` go through `Show`. This has a measurable impact on the speed of this conversion, but the sense I get from others is that it's best to go ahead and unify `to_string` and address performance for all `to_string` conversions in `core::fmt`. `String::from_str(...)` still works as a manual fast-path.

Note that the patch was done with a script, and ended up renaming a number of other `*_to_str` functions, particularly inside of rustc. All the ones I saw looked correct, and I didn't notice any additional API breakage.

Closes #15046.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ascii.rs38
-rw-r--r--src/libstd/collections/lru_cache.rs14
-rw-r--r--src/libstd/dynamic_lib.rs7
-rw-r--r--src/libstd/from_str.rs3
-rw-r--r--src/libstd/io/fs.rs4
-rw-r--r--src/libstd/io/mem.rs6
-rw-r--r--src/libstd/io/mod.rs12
-rw-r--r--src/libstd/io/net/ip.rs9
-rw-r--r--src/libstd/io/net/tcp.rs90
-rw-r--r--src/libstd/io/process.rs2
-rw-r--r--src/libstd/io/stdio.rs4
-rw-r--r--src/libstd/io/util.rs8
-rw-r--r--src/libstd/num/f32.rs2
-rw-r--r--src/libstd/num/f64.rs2
-rw-r--r--src/libstd/num/int_macros.rs20
-rw-r--r--src/libstd/num/strconv.rs8
-rw-r--r--src/libstd/num/uint_macros.rs20
-rw-r--r--src/libstd/os.rs6
-rw-r--r--src/libstd/path/posix.rs2
-rw-r--r--src/libstd/path/windows.rs4
-rw-r--r--src/libstd/prelude.rs2
-rw-r--r--src/libstd/task.rs2
-rw-r--r--src/libstd/to_str.rs36
23 files changed, 149 insertions, 152 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index fae1b933210..796147ce7a0 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -345,10 +345,10 @@ impl<'a> AsciiStr for &'a [Ascii] {
 
 impl IntoStr for Vec<Ascii> {
     #[inline]
-    fn into_str(self) -> String {
+    fn into_string(self) -> String {
         unsafe {
             let s: &str = mem::transmute(self.as_slice());
-            s.to_string()
+            String::from_str(s)
         }
     }
 }
@@ -438,12 +438,12 @@ unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String {
         *b = map[*b as uint];
     }
 
-    str::from_utf8(bytes.as_slice()).unwrap().to_string()
+    String::from_str(str::from_utf8(bytes.as_slice()).unwrap())
 }
 
 #[inline]
 unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> String {
-    let mut s = string.to_string();
+    let mut s = String::from_str(string);
     for b in s.as_mut_bytes().mut_iter() {
         *b = map[*b as uint];
     }
@@ -578,12 +578,12 @@ mod tests {
         assert_eq!(v.as_slice().to_ascii(), v2ascii!([40, 32, 59]));
         assert_eq!("( ;".to_string().as_slice().to_ascii(), v2ascii!([40, 32, 59]));
 
-        assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string());
-        assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string());
+        assert_eq!("abCDef&?#".to_ascii().to_lower().into_string(), "abcdef&?#".to_string());
+        assert_eq!("abCDef&?#".to_ascii().to_upper().into_string(), "ABCDEF&?#".to_string());
 
-        assert_eq!("".to_ascii().to_lower().into_str(), "".to_string());
-        assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string());
-        assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string());
+        assert_eq!("".to_ascii().to_lower().into_string(), "".to_string());
+        assert_eq!("YMCA".to_ascii().to_lower().into_string(), "ymca".to_string());
+        assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_string(), "ABCDEFXYZ:.;".to_string());
 
         assert!("aBcDeF&?#".to_ascii().eq_ignore_case("AbCdEf&?#".to_ascii()));
 
@@ -595,11 +595,11 @@ mod tests {
 
     #[test]
     fn test_ascii_vec_ng() {
-        assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string());
-        assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string());
-        assert_eq!("".to_ascii().to_lower().into_str(), "".to_string());
-        assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string());
-        assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string());
+        assert_eq!("abCDef&?#".to_ascii().to_lower().into_string(), "abcdef&?#".to_string());
+        assert_eq!("abCDef&?#".to_ascii().to_upper().into_string(), "ABCDEF&?#".to_string());
+        assert_eq!("".to_ascii().to_lower().into_string(), "".to_string());
+        assert_eq!("YMCA".to_ascii().to_lower().into_string(), "ymca".to_string());
+        assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_string(), "ABCDEFXYZ:.;".to_string());
     }
 
     #[test]
@@ -615,9 +615,9 @@ mod tests {
     }
 
     #[test]
-    fn test_ascii_into_str() {
-        assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_string());
-        assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_string());
+    fn test_ascii_into_string() {
+        assert_eq!(vec2ascii![40, 32, 59].into_string(), "( ;".to_string());
+        assert_eq!(vec2ascii!(40, 32, 59).into_string(), "( ;".to_string());
     }
 
     #[test]
@@ -757,8 +757,8 @@ mod tests {
     }
 
     #[test]
-    fn test_to_str() {
-        let s = Ascii{ chr: 't' as u8 }.to_str();
+    fn test_to_string() {
+        let s = Ascii{ chr: 't' as u8 }.to_string();
         assert_eq!(s, "t".to_string());
     }
 
diff --git a/src/libstd/collections/lru_cache.rs b/src/libstd/collections/lru_cache.rs
index 08f11581e83..a02402271d0 100644
--- a/src/libstd/collections/lru_cache.rs
+++ b/src/libstd/collections/lru_cache.rs
@@ -319,20 +319,20 @@ mod tests {
     }
 
     #[test]
-    fn test_to_str() {
+    fn test_to_string() {
         let mut cache: LruCache<int, int> = LruCache::new(3);
         cache.put(1, 10);
         cache.put(2, 20);
         cache.put(3, 30);
-        assert_eq!(cache.to_str(), "{3: 30, 2: 20, 1: 10}".to_string());
+        assert_eq!(cache.to_string(), "{3: 30, 2: 20, 1: 10}".to_string());
         cache.put(2, 22);
-        assert_eq!(cache.to_str(), "{2: 22, 3: 30, 1: 10}".to_string());
+        assert_eq!(cache.to_string(), "{2: 22, 3: 30, 1: 10}".to_string());
         cache.put(6, 60);
-        assert_eq!(cache.to_str(), "{6: 60, 2: 22, 3: 30}".to_string());
+        assert_eq!(cache.to_string(), "{6: 60, 2: 22, 3: 30}".to_string());
         cache.get(&3);
-        assert_eq!(cache.to_str(), "{3: 30, 6: 60, 2: 22}".to_string());
+        assert_eq!(cache.to_string(), "{3: 30, 6: 60, 2: 22}".to_string());
         cache.change_capacity(2);
-        assert_eq!(cache.to_str(), "{3: 30, 6: 60}".to_string());
+        assert_eq!(cache.to_string(), "{3: 30, 6: 60}".to_string());
     }
 
     #[test]
@@ -343,6 +343,6 @@ mod tests {
         cache.clear();
         assert!(cache.get(&1).is_none());
         assert!(cache.get(&2).is_none());
-        assert_eq!(cache.to_str(), "{}".to_string());
+        assert_eq!(cache.to_string(), "{}".to_string());
     }
 }
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index 728875ce260..86283f03381 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -209,13 +209,11 @@ mod test {
 #[cfg(target_os = "ios")]
 #[cfg(target_os = "freebsd")]
 pub mod dl {
-    use prelude::*;
 
     use c_str::{CString, ToCStr};
     use libc;
     use ptr;
     use result::*;
-    use str::StrAllocating;
     use string::String;
 
     pub unsafe fn open_external<T: ToCStr>(filename: T) -> *mut u8 {
@@ -243,9 +241,8 @@ pub mod dl {
             let ret = if ptr::null() == last_error {
                 Ok(result)
             } else {
-                Err(CString::new(last_error, false).as_str()
-                                                   .unwrap()
-                                                   .to_string())
+                Err(String::from_str(CString::new(last_error, false).as_str()
+                    .unwrap()))
             };
 
             ret
diff --git a/src/libstd/from_str.rs b/src/libstd/from_str.rs
index 1ca72bca20b..21b1e0560a5 100644
--- a/src/libstd/from_str.rs
+++ b/src/libstd/from_str.rs
@@ -14,7 +14,6 @@
 
 use option::{Option, Some, None};
 use string::String;
-use str::StrAllocating;
 
 /// A trait to abstract the idea of creating a new instance of a type from a
 /// string.
@@ -55,7 +54,7 @@ impl FromStr for bool {
 impl FromStr for String {
     #[inline]
     fn from_str(s: &str) -> Option<String> {
-        Some(s.to_string())
+        Some(String::from_str(s))
     }
 }
 
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index e7f26c7bd91..ed183cbf3bc 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -915,7 +915,7 @@ mod test {
     macro_rules! error( ($e:expr, $s:expr) => (
         match $e {
             Ok(val) => fail!("Should have been an error, was {:?}", val),
-            Err(ref err) => assert!(err.to_str().as_slice().contains($s.as_slice()),
+            Err(ref err) => assert!(err.to_string().as_slice().contains($s.as_slice()),
                                     format!("`{}` did not contain `{}`", err, $s))
         }
     ) )
@@ -1167,7 +1167,7 @@ mod test {
         for n in range(0i,3) {
             let f = dir.join(format!("{}.txt", n));
             let mut w = check!(File::create(&f));
-            let msg_str = format!("{}{}", prefix, n.to_str());
+            let msg_str = format!("{}{}", prefix, n.to_string());
             let msg = msg_str.as_slice().as_bytes();
             check!(w.write(msg));
         }
diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs
index 3443a85b468..7d293f363f0 100644
--- a/src/libstd/io/mem.rs
+++ b/src/libstd/io/mem.rs
@@ -532,7 +532,7 @@ mod test {
         writer.write_line("testing").unwrap();
         writer.write_str("testing").unwrap();
         let mut r = BufReader::new(writer.get_ref());
-        assert_eq!(r.read_to_str().unwrap(), "testingtesting\ntesting".to_string());
+        assert_eq!(r.read_to_string().unwrap(), "testingtesting\ntesting".to_string());
     }
 
     #[test]
@@ -542,14 +542,14 @@ mod test {
         writer.write_char('\n').unwrap();
         writer.write_char('ệ').unwrap();
         let mut r = BufReader::new(writer.get_ref());
-        assert_eq!(r.read_to_str().unwrap(), "a\nệ".to_string());
+        assert_eq!(r.read_to_string().unwrap(), "a\nệ".to_string());
     }
 
     #[test]
     fn test_read_whole_string_bad() {
         let buf = [0xff];
         let mut r = BufReader::new(buf);
-        match r.read_to_str() {
+        match r.read_to_string() {
             Ok(..) => fail!(),
             Err(..) => {}
         }
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 1d339b03af6..fe9016453f7 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -233,7 +233,7 @@ use owned::Box;
 use result::{Ok, Err, Result};
 use rt::rtio;
 use slice::{Vector, MutableVector, ImmutableVector};
-use str::{Str, StrSlice, StrAllocating};
+use str::{Str, StrSlice};
 use str;
 use string::String;
 use uint;
@@ -566,7 +566,7 @@ pub trait Reader {
     fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> {
         if min > buf.len() {
             return Err(IoError {
-                detail: Some("the buffer is too short".to_string()),
+                detail: Some(String::from_str("the buffer is too short")),
                 ..standard_error(InvalidInput)
             });
         }
@@ -634,7 +634,7 @@ pub trait Reader {
     fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
         if min > len {
             return Err(IoError {
-                detail: Some("the buffer is too short".to_string()),
+                detail: Some(String::from_str("the buffer is too short")),
                 ..standard_error(InvalidInput)
             });
         }
@@ -702,10 +702,10 @@ pub trait Reader {
     /// This function returns all of the same errors as `read_to_end` with an
     /// additional error if the reader's contents are not a valid sequence of
     /// UTF-8 bytes.
-    fn read_to_str(&mut self) -> IoResult<String> {
+    fn read_to_string(&mut self) -> IoResult<String> {
         self.read_to_end().and_then(|s| {
             match str::from_utf8(s.as_slice()) {
-                Some(s) => Ok(s.to_string()),
+                Some(s) => Ok(String::from_str(s)),
                 None => Err(standard_error(InvalidInput)),
             }
         })
@@ -1440,7 +1440,7 @@ pub trait Buffer: Reader {
     fn read_line(&mut self) -> IoResult<String> {
         self.read_until('\n' as u8).and_then(|line|
             match str::from_utf8(line.as_slice()) {
-                Some(s) => Ok(s.to_string()),
+                Some(s) => Ok(String::from_str(s)),
                 None => Err(standard_error(InvalidInput)),
             }
         )
diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs
index ca59849202b..79caded6711 100644
--- a/src/libstd/io/net/ip.rs
+++ b/src/libstd/io/net/ip.rs
@@ -443,10 +443,11 @@ mod test {
     }
 
     #[test]
-    fn ipv6_addr_to_str() {
+    fn ipv6_addr_to_string() {
         let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280);
-        assert!(a1.to_str() == "::ffff:192.0.2.128".to_string() ||
-                a1.to_str() == "::FFFF:192.0.2.128".to_string());
-        assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), "8:9:a:b:c:d:e:f".to_string());
+        assert!(a1.to_string() == "::ffff:192.0.2.128".to_string() ||
+                a1.to_string() == "::FFFF:192.0.2.128".to_string());
+        assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_string(),
+                   "8:9:a:b:c:d:e:f".to_string());
     }
 }
diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs
index baf53251fbe..49322098348 100644
--- a/src/libstd/io/net/tcp.rs
+++ b/src/libstd/io/net/tcp.rs
@@ -467,7 +467,7 @@ mod test {
 
     iotest!(fn listen_ip4_localhost() {
         let socket_addr = next_test_ip4();
-        let ip_str = socket_addr.ip.to_str();
+        let ip_str = socket_addr.ip.to_string();
         let port = socket_addr.port;
         let listener = TcpListener::bind(ip_str.as_slice(), port);
         let mut acceptor = listener.listen();
@@ -485,7 +485,7 @@ mod test {
 
     iotest!(fn connect_localhost() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -502,7 +502,7 @@ mod test {
 
     iotest!(fn connect_ip4_loopback() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -519,7 +519,7 @@ mod test {
 
     iotest!(fn connect_ip6_loopback() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -536,7 +536,7 @@ mod test {
 
     iotest!(fn smoke_test_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -553,7 +553,7 @@ mod test {
 
     iotest!(fn smoke_test_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -570,7 +570,7 @@ mod test {
 
     iotest!(fn read_eof_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -587,7 +587,7 @@ mod test {
 
     iotest!(fn read_eof_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -604,7 +604,7 @@ mod test {
 
     iotest!(fn read_eof_twice_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -629,7 +629,7 @@ mod test {
 
     iotest!(fn read_eof_twice_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -654,7 +654,7 @@ mod test {
 
     iotest!(fn write_close_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -681,7 +681,7 @@ mod test {
 
     iotest!(fn write_close_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -708,7 +708,7 @@ mod test {
 
     iotest!(fn multiple_connect_serial_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let max = 10u;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
@@ -729,7 +729,7 @@ mod test {
 
     iotest!(fn multiple_connect_serial_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let max = 10u;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
@@ -750,7 +750,7 @@ mod test {
 
     iotest!(fn multiple_connect_interleaved_greedy_schedule_ip4() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         static MAX: int = 10;
         let acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
@@ -772,7 +772,7 @@ mod test {
         connect(0, addr);
 
         fn connect(i: int, addr: SocketAddr) {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let port = addr.port;
             if i == MAX { return }
 
@@ -789,7 +789,7 @@ mod test {
 
     iotest!(fn multiple_connect_interleaved_greedy_schedule_ip6() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         static MAX: int = 10;
         let acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
@@ -811,7 +811,7 @@ mod test {
         connect(0, addr);
 
         fn connect(i: int, addr: SocketAddr) {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let port = addr.port;
             if i == MAX { return }
 
@@ -829,7 +829,7 @@ mod test {
     iotest!(fn multiple_connect_interleaved_lazy_schedule_ip4() {
         static MAX: int = 10;
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -850,7 +850,7 @@ mod test {
         connect(0, addr);
 
         fn connect(i: int, addr: SocketAddr) {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let port = addr.port;
             if i == MAX { return }
 
@@ -868,7 +868,7 @@ mod test {
     iotest!(fn multiple_connect_interleaved_lazy_schedule_ip6() {
         static MAX: int = 10;
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -889,7 +889,7 @@ mod test {
         connect(0, addr);
 
         fn connect(i: int, addr: SocketAddr) {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let port = addr.port;
             if i == MAX { return }
 
@@ -905,7 +905,7 @@ mod test {
     })
 
     pub fn socket_name(addr: SocketAddr) {
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut listener = TcpListener::bind(ip_str.as_slice(), port).unwrap();
 
@@ -917,7 +917,7 @@ mod test {
     }
 
     pub fn peer_name(addr: SocketAddr) {
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
         spawn(proc() {
@@ -954,7 +954,7 @@ mod test {
         let port = addr.port;
         let (tx, rx) = channel();
         spawn(proc() {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let mut srv = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
             tx.send(());
             let mut cl = srv.accept().unwrap();
@@ -965,7 +965,7 @@ mod test {
         });
 
         rx.recv();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let mut c = TcpStream::connect(ip_str.as_slice(), port).unwrap();
         let mut b = [0, ..10];
         assert_eq!(c.read(b), Ok(1));
@@ -975,7 +975,7 @@ mod test {
 
     iotest!(fn double_bind() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let listener = TcpListener::bind(ip_str.as_slice(), port).unwrap().listen();
         assert!(listener.is_ok());
@@ -994,7 +994,7 @@ mod test {
         let (tx, rx) = channel();
 
         spawn(proc() {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             rx.recv();
             let _stream = TcpStream::connect(ip_str.as_slice(), port).unwrap();
             // Close
@@ -1002,7 +1002,7 @@ mod test {
         });
 
         {
-            let ip_str = addr.ip.to_str();
+            let ip_str = addr.ip.to_string();
             let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
             tx.send(());
             {
@@ -1012,12 +1012,12 @@ mod test {
             }
             // Close listener
         }
-        let _listener = TcpListener::bind(addr.ip.to_str().as_slice(), port);
+        let _listener = TcpListener::bind(addr.ip.to_string().as_slice(), port);
     })
 
     iotest!(fn tcp_clone_smoke() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -1048,7 +1048,7 @@ mod test {
 
     iotest!(fn tcp_clone_two_read() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
         let (tx1, rx) = channel();
@@ -1082,7 +1082,7 @@ mod test {
 
     iotest!(fn tcp_clone_two_write() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut acceptor = TcpListener::bind(ip_str.as_slice(), port).listen();
 
@@ -1111,7 +1111,7 @@ mod test {
         use rt::rtio::RtioTcpStream;
 
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let a = TcpListener::bind(ip_str.as_slice(), port).unwrap().listen();
         spawn(proc() {
@@ -1129,7 +1129,7 @@ mod test {
 
     iotest!(fn accept_timeout() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut a = TcpListener::bind(ip_str.as_slice(), port).unwrap().listen().unwrap();
 
@@ -1150,7 +1150,7 @@ mod test {
         if !cfg!(target_os = "freebsd") {
             let (tx, rx) = channel();
             spawn(proc() {
-                tx.send(TcpStream::connect(addr.ip.to_str().as_slice(),
+                tx.send(TcpStream::connect(addr.ip.to_string().as_slice(),
                                            port).unwrap());
             });
             let _l = rx.recv();
@@ -1168,7 +1168,7 @@ mod test {
         // Unset the timeout and make sure that this always blocks.
         a.set_timeout(None);
         spawn(proc() {
-            drop(TcpStream::connect(addr.ip.to_str().as_slice(),
+            drop(TcpStream::connect(addr.ip.to_string().as_slice(),
                                     port).unwrap());
         });
         a.accept().unwrap();
@@ -1176,7 +1176,7 @@ mod test {
 
     iotest!(fn close_readwrite_smoke() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (_tx, rx) = channel::<()>();
@@ -1214,7 +1214,7 @@ mod test {
 
     iotest!(fn close_read_wakes_up() {
         let addr = next_test_ip4();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (_tx, rx) = channel::<()>();
@@ -1241,7 +1241,7 @@ mod test {
 
     iotest!(fn readwrite_timeouts() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (tx, rx) = channel::<()>();
@@ -1275,7 +1275,7 @@ mod test {
 
     iotest!(fn read_timeouts() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (tx, rx) = channel::<()>();
@@ -1305,7 +1305,7 @@ mod test {
 
     iotest!(fn write_timeouts() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (tx, rx) = channel::<()>();
@@ -1334,7 +1334,7 @@ mod test {
 
     iotest!(fn timeout_concurrent_read() {
         let addr = next_test_ip6();
-        let ip_str = addr.ip.to_str();
+        let ip_str = addr.ip.to_string();
         let port = addr.port;
         let mut a = TcpListener::bind(ip_str.as_slice(), port).listen().unwrap();
         let (tx, rx) = channel::<()>();
@@ -1363,7 +1363,7 @@ mod test {
 
     iotest!(fn clone_while_reading() {
         let addr = next_test_ip6();
-        let listen = TcpListener::bind(addr.ip.to_str().as_slice(), addr.port);
+        let listen = TcpListener::bind(addr.ip.to_string().as_slice(), addr.port);
         let mut accept = listen.listen().unwrap();
 
         // Enqueue a task to write to a socket
@@ -1371,7 +1371,7 @@ mod test {
         let (txdone, rxdone) = channel();
         let txdone2 = txdone.clone();
         spawn(proc() {
-            let mut tcp = TcpStream::connect(addr.ip.to_str().as_slice(),
+            let mut tcp = TcpStream::connect(addr.ip.to_string().as_slice(),
                                              addr.port).unwrap();
             rx.recv();
             tcp.write_u8(0).unwrap();
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index 8e1747146e4..8f1046b62fd 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -615,7 +615,7 @@ mod tests {
     })
 
     pub fn read_all(input: &mut Reader) -> String {
-        input.read_to_str().unwrap()
+        input.read_to_string().unwrap()
     }
 
     pub fn run_output(cmd: Command) -> String {
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index e5a64f785ce..cdd083202e0 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -391,7 +391,7 @@ mod tests {
             set_stdout(box w);
             println!("hello!");
         });
-        assert_eq!(r.read_to_str().unwrap(), "hello!\n".to_string());
+        assert_eq!(r.read_to_string().unwrap(), "hello!\n".to_string());
     })
 
     iotest!(fn capture_stderr() {
@@ -404,7 +404,7 @@ mod tests {
             ::realstd::io::stdio::set_stderr(box w);
             fail!("my special message");
         });
-        let s = r.read_to_str().unwrap();
+        let s = r.read_to_string().unwrap();
         assert!(s.as_slice().contains("my special message"));
     })
 }
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs
index 83a01feee90..2acf12b76c0 100644
--- a/src/libstd/io/util.rs
+++ b/src/libstd/io/util.rs
@@ -379,21 +379,21 @@ mod test {
         let mut r = BufReader::new(data.as_bytes());
         {
             let mut r = LimitReader::new(r.by_ref(), 3);
-            assert_eq!(r.read_line(), Ok("012".to_str()));
+            assert_eq!(r.read_line(), Ok("012".to_string()));
             assert_eq!(r.limit(), 0);
             assert_eq!(r.read_line().err().unwrap().kind, io::EndOfFile);
         }
         {
             let mut r = LimitReader::new(r.by_ref(), 9);
-            assert_eq!(r.read_line(), Ok("3456789\n".to_str()));
+            assert_eq!(r.read_line(), Ok("3456789\n".to_string()));
             assert_eq!(r.limit(), 1);
-            assert_eq!(r.read_line(), Ok("0".to_str()));
+            assert_eq!(r.read_line(), Ok("0".to_string()));
         }
         {
             let mut r = LimitReader::new(r.by_ref(), 100);
             assert_eq!(r.read_char(), Ok('1'));
             assert_eq!(r.limit(), 99);
-            assert_eq!(r.read_line(), Ok("23456789\n".to_str()));
+            assert_eq!(r.read_line(), Ok("23456789\n".to_string()));
         }
     }
 
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 2b2ffb9f4e2..680620f5a75 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -245,7 +245,7 @@ impl FloatMath for f32 {
 ///
 /// * num - The float value
 #[inline]
-pub fn to_str(num: f32) -> String {
+pub fn to_string(num: f32) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false);
     r
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index e156d2ce553..3180ee28c6f 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -253,7 +253,7 @@ impl FloatMath for f64 {
 ///
 /// * num - The float value
 #[inline]
-pub fn to_str(num: f64) -> String {
+pub fn to_string(num: f64) -> String {
     let (r, _) = strconv::float_to_str_common(
         num, 10u, true, strconv::SignNeg, strconv::DigAll, strconv::ExpNone, false);
     r
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index a4200b55a59..3c01edf2339 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -55,7 +55,7 @@ impl FromStrRadix for $T {
 
 /// Convert to a string as a byte slice in a given base.
 ///
-/// Use in place of x.to_str() when you do not need to store the string permanently
+/// Use in place of x.to_string() when you do not need to store the string permanently
 ///
 /// # Examples
 ///
@@ -143,7 +143,7 @@ mod tests {
     }
 
     #[test]
-    fn test_to_str() {
+    fn test_to_string() {
         assert_eq!((0 as $T).to_str_radix(10u), "0".to_string());
         assert_eq!((1 as $T).to_str_radix(10u), "1".to_string());
         assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_string());
@@ -155,28 +155,28 @@ mod tests {
     #[test]
     fn test_int_to_str_overflow() {
         let mut i8_val: i8 = 127_i8;
-        assert_eq!(i8_val.to_str(), "127".to_string());
+        assert_eq!(i8_val.to_string(), "127".to_string());
 
         i8_val += 1 as i8;
-        assert_eq!(i8_val.to_str(), "-128".to_string());
+        assert_eq!(i8_val.to_string(), "-128".to_string());
 
         let mut i16_val: i16 = 32_767_i16;
-        assert_eq!(i16_val.to_str(), "32767".to_string());
+        assert_eq!(i16_val.to_string(), "32767".to_string());
 
         i16_val += 1 as i16;
-        assert_eq!(i16_val.to_str(), "-32768".to_string());
+        assert_eq!(i16_val.to_string(), "-32768".to_string());
 
         let mut i32_val: i32 = 2_147_483_647_i32;
-        assert_eq!(i32_val.to_str(), "2147483647".to_string());
+        assert_eq!(i32_val.to_string(), "2147483647".to_string());
 
         i32_val += 1 as i32;
-        assert_eq!(i32_val.to_str(), "-2147483648".to_string());
+        assert_eq!(i32_val.to_string(), "-2147483648".to_string());
 
         let mut i64_val: i64 = 9_223_372_036_854_775_807_i64;
-        assert_eq!(i64_val.to_str(), "9223372036854775807".to_string());
+        assert_eq!(i64_val.to_string(), "9223372036854775807".to_string());
 
         i64_val += 1 as i64;
-        assert_eq!(i64_val.to_str(), "-9223372036854775808".to_string());
+        assert_eq!(i64_val.to_string(), "-9223372036854775808".to_string());
     }
 
     #[test]
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 5028987f44f..88fc6e1ffd8 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -146,7 +146,7 @@ static NAN_BUF:          [u8, ..3] = ['N' as u8, 'a' as u8, 'N' as u8];
 /**
  * Converts an integral number to its string representation as a byte vector.
  * This is meant to be a common base implementation for all integral string
- * conversion functions like `to_str()` or `to_str_radix()`.
+ * conversion functions like `to_string()` or `to_str_radix()`.
  *
  * # Arguments
  * - `num`           - The number to convert. Accepts any number that
@@ -226,7 +226,7 @@ pub fn int_to_str_bytes_common<T: Int>(num: T, radix: uint, sign: SignFormat, f:
 /**
  * Converts a number to its string representation as a byte vector.
  * This is meant to be a common base implementation for all numeric string
- * conversion functions like `to_str()` or `to_str_radix()`.
+ * conversion functions like `to_string()` or `to_str_radix()`.
  *
  * # Arguments
  * - `num`           - The number to convert. Accepts any number that
@@ -894,9 +894,9 @@ mod bench {
         use f64;
 
         #[bench]
-        fn float_to_str(b: &mut Bencher) {
+        fn float_to_string(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { f64::to_str(rng.gen()); })
+            b.iter(|| { f64::to_string(rng.gen()); })
         }
     }
 }
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 7f2efe034a2..cfcaf0fa8da 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -56,7 +56,7 @@ impl FromStrRadix for $T {
 
 /// Convert to a string as a byte slice in a given base.
 ///
-/// Use in place of x.to_str() when you do not need to store the string permanently
+/// Use in place of x.to_string() when you do not need to store the string permanently
 ///
 /// # Examples
 ///
@@ -101,7 +101,7 @@ mod tests {
     use u16;
 
     #[test]
-    pub fn test_to_str() {
+    pub fn test_to_string() {
         assert_eq!((0 as $T).to_str_radix(10u), "0".to_string());
         assert_eq!((1 as $T).to_str_radix(10u), "1".to_string());
         assert_eq!((2 as $T).to_str_radix(10u), "2".to_string());
@@ -141,28 +141,28 @@ mod tests {
     #[test]
     fn test_uint_to_str_overflow() {
         let mut u8_val: u8 = 255_u8;
-        assert_eq!(u8_val.to_str(), "255".to_string());
+        assert_eq!(u8_val.to_string(), "255".to_string());
 
         u8_val += 1 as u8;
-        assert_eq!(u8_val.to_str(), "0".to_string());
+        assert_eq!(u8_val.to_string(), "0".to_string());
 
         let mut u16_val: u16 = 65_535_u16;
-        assert_eq!(u16_val.to_str(), "65535".to_string());
+        assert_eq!(u16_val.to_string(), "65535".to_string());
 
         u16_val += 1 as u16;
-        assert_eq!(u16_val.to_str(), "0".to_string());
+        assert_eq!(u16_val.to_string(), "0".to_string());
 
         let mut u32_val: u32 = 4_294_967_295_u32;
-        assert_eq!(u32_val.to_str(), "4294967295".to_string());
+        assert_eq!(u32_val.to_string(), "4294967295".to_string());
 
         u32_val += 1 as u32;
-        assert_eq!(u32_val.to_str(), "0".to_string());
+        assert_eq!(u32_val.to_string(), "0".to_string());
 
         let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
-        assert_eq!(u64_val.to_str(), "18446744073709551615".to_string());
+        assert_eq!(u64_val.to_string(), "18446744073709551615".to_string());
 
         u64_val += 1 as u64;
-        assert_eq!(u64_val.to_str(), "0".to_string());
+        assert_eq!(u64_val.to_string(), "0".to_string());
     }
 
     #[test]
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index b3f25914c8f..db56b387f8d 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -223,8 +223,8 @@ fn with_env_lock<T>(f: || -> T) -> T {
 /// ```
 pub fn env() -> Vec<(String,String)> {
     env_as_bytes().move_iter().map(|(k,v)| {
-        let k = str::from_utf8_lossy(k.as_slice()).to_string();
-        let v = str::from_utf8_lossy(v.as_slice()).to_string();
+        let k = String::from_str(str::from_utf8_lossy(k.as_slice()).as_slice());
+        let v = String::from_str(str::from_utf8_lossy(v.as_slice()).as_slice());
         (k,v)
     }).collect()
 }
@@ -334,7 +334,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>,Vec<u8>)> {
 /// }
 /// ```
 pub fn getenv(n: &str) -> Option<String> {
-    getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_string())
+    getenv_as_bytes(n).map(|v| String::from_str(str::from_utf8_lossy(v.as_slice()).as_slice()))
 }
 
 #[cfg(unix)]
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index d98cfb7d8ee..5c6e140bd29 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -545,7 +545,7 @@ mod tests {
             ($path:expr, $disp:ident, $exp:expr) => (
                 {
                     let path = Path::new($path);
-                    assert!(path.$disp().to_str().as_slice() == $exp);
+                    assert!(path.$disp().to_string().as_slice() == $exp);
                 }
             )
         )
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs
index 113b0410875..206f75739e8 100644
--- a/src/libstd/path/windows.rs
+++ b/src/libstd/path/windows.rs
@@ -1314,9 +1314,9 @@ mod tests {
     #[test]
     fn test_display_str() {
         let path = Path::new("foo");
-        assert_eq!(path.display().to_str(), "foo".to_string());
+        assert_eq!(path.display().to_string(), "foo".to_string());
         let path = Path::new(b"\\");
-        assert_eq!(path.filename_display().to_str(), "".to_string());
+        assert_eq!(path.filename_display().to_string(), "".to_string());
 
         let path = Path::new("foo");
         let mo = path.display().as_maybe_owned();
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index 28cd7223b0a..6d60fc19d5d 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -78,7 +78,7 @@
 #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek};
 #[doc(no_inline)] pub use str::{Str, StrVector, StrSlice, OwnedStr};
 #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating};
-#[doc(no_inline)] pub use to_str::{ToStr, IntoStr};
+#[doc(no_inline)] pub use to_str::{ToString, IntoStr};
 #[doc(no_inline)] pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
 #[doc(no_inline)] pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
 #[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
diff --git a/src/libstd/task.rs b/src/libstd/task.rs
index c20cbea0ae7..72cc596085e 100644
--- a/src/libstd/task.rs
+++ b/src/libstd/task.rs
@@ -638,7 +638,7 @@ mod test {
             });
         assert!(r.is_ok());
 
-        let output = reader.read_to_str().unwrap();
+        let output = reader.read_to_string().unwrap();
         assert_eq!(output, "Hello, world!".to_string());
     }
 
diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs
index e51e2c4d9ce..c19fd81b570 100644
--- a/src/libstd/to_str.rs
+++ b/src/libstd/to_str.rs
@@ -10,7 +10,7 @@
 
 /*!
 
-The `ToStr` trait for converting to strings
+The `ToString` trait for converting to strings
 
 */
 
@@ -20,19 +20,19 @@ use fmt;
 use string::String;
 
 /// A generic trait for converting a value to a string
-pub trait ToStr {
+pub trait ToString {
     /// Converts the value of `self` to an owned string
-    fn to_str(&self) -> String;
+    fn to_string(&self) -> String;
 }
 
 /// Trait for converting a type to a string, consuming it in the process.
 pub trait IntoStr {
     /// Consume and convert to a string.
-    fn into_str(self) -> String;
+    fn into_string(self) -> String;
 }
 
-impl<T: fmt::Show> ToStr for T {
-    fn to_str(&self) -> String {
+impl<T: fmt::Show> ToString for T {
+    fn to_string(&self) -> String {
         format!("{}", *self)
     }
 }
@@ -44,23 +44,23 @@ mod tests {
 
     #[test]
     fn test_simple_types() {
-        assert_eq!(1i.to_str(), "1".to_string());
-        assert_eq!((-1i).to_str(), "-1".to_string());
-        assert_eq!(200u.to_str(), "200".to_string());
-        assert_eq!(2u8.to_str(), "2".to_string());
-        assert_eq!(true.to_str(), "true".to_string());
-        assert_eq!(false.to_str(), "false".to_string());
-        assert_eq!(().to_str(), "()".to_string());
-        assert_eq!(("hi".to_string()).to_str(), "hi".to_string());
+        assert_eq!(1i.to_string(), "1".to_string());
+        assert_eq!((-1i).to_string(), "-1".to_string());
+        assert_eq!(200u.to_string(), "200".to_string());
+        assert_eq!(2u8.to_string(), "2".to_string());
+        assert_eq!(true.to_string(), "true".to_string());
+        assert_eq!(false.to_string(), "false".to_string());
+        assert_eq!(().to_string(), "()".to_string());
+        assert_eq!(("hi".to_string()).to_string(), "hi".to_string());
     }
 
     #[test]
     fn test_vectors() {
         let x: Vec<int> = vec![];
-        assert_eq!(x.to_str(), "[]".to_string());
-        assert_eq!((vec![1i]).to_str(), "[1]".to_string());
-        assert_eq!((vec![1i, 2, 3]).to_str(), "[1, 2, 3]".to_string());
-        assert!((vec![vec![], vec![1i], vec![1i, 1]]).to_str() ==
+        assert_eq!(x.to_string(), "[]".to_string());
+        assert_eq!((vec![1i]).to_string(), "[1]".to_string());
+        assert_eq!((vec![1i, 2, 3]).to_string(), "[1, 2, 3]".to_string());
+        assert!((vec![vec![], vec![1i], vec![1i, 1]]).to_string() ==
                "[[], [1], [1, 1]]".to_string());
     }
 }