about summary refs log tree commit diff
path: root/src/test/run-pass
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/test/run-pass
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/test/run-pass')
-rw-r--r--src/test/run-pass/bool.rs4
-rw-r--r--src/test/run-pass/capturing-logging.rs2
-rw-r--r--src/test/run-pass/class-cast-to-trait-cross-crate-2.rs8
-rw-r--r--src/test/run-pass/class-separate-impl.rs6
-rw-r--r--src/test/run-pass/deriving-show-2.rs22
-rw-r--r--src/test/run-pass/exponential-notation.rs12
-rw-r--r--src/test/run-pass/fixed_length_vec_glue.rs2
-rw-r--r--src/test/run-pass/issue-2904.rs4
-rw-r--r--src/test/run-pass/issue-3037.rs2
-rw-r--r--src/test/run-pass/issue-3559.rs4
-rw-r--r--src/test/run-pass/issue-3563-3.rs8
-rw-r--r--src/test/run-pass/issue-3702.rs4
-rw-r--r--src/test/run-pass/issue-4241.rs10
-rw-r--r--src/test/run-pass/issue-5280.rs6
-rw-r--r--src/test/run-pass/monad.rs2
-rw-r--r--src/test/run-pass/move-out-of-field.rs4
-rw-r--r--src/test/run-pass/new-impl-syntax.rs4
-rw-r--r--src/test/run-pass/overloaded-deref-count.rs2
-rw-r--r--src/test/run-pass/send_str_treemap.rs2
-rw-r--r--src/test/run-pass/static-impl.rs2
-rw-r--r--src/test/run-pass/task-stderr.rs2
-rw-r--r--src/test/run-pass/tcp-connect-timeouts.rs4
-rw-r--r--src/test/run-pass/tcp-stress.rs2
-rw-r--r--src/test/run-pass/test-ignore-cfg.rs4
-rw-r--r--src/test/run-pass/trait-cast.rs2
-rw-r--r--src/test/run-pass/trait-generic.rs10
-rw-r--r--src/test/run-pass/trait-to-str.rs14
-rw-r--r--src/test/run-pass/vec-to_str.rs8
28 files changed, 78 insertions, 78 deletions
diff --git a/src/test/run-pass/bool.rs b/src/test/run-pass/bool.rs
index cb364d23387..91075633ab8 100644
--- a/src/test/run-pass/bool.rs
+++ b/src/test/run-pass/bool.rs
@@ -49,9 +49,9 @@ fn main() {
     assert_eq!(!true, false);
     assert_eq!(!false, true);
 
-    let s = false.to_str();
+    let s = false.to_string();
     assert_eq!(s.as_slice(), "false");
-    let s = true.to_str();
+    let s = true.to_string();
     assert_eq!(s.as_slice(), "true");
 
     assert!(true > false);
diff --git a/src/test/run-pass/capturing-logging.rs b/src/test/run-pass/capturing-logging.rs
index 19186f4b46b..33ee2ffd359 100644
--- a/src/test/run-pass/capturing-logging.rs
+++ b/src/test/run-pass/capturing-logging.rs
@@ -45,7 +45,7 @@ fn main() {
         debug!("debug");
         info!("info");
     });
-    let s = r.read_to_str().unwrap();
+    let s = r.read_to_string().unwrap();
     assert!(s.as_slice().contains("info"));
     assert!(!s.as_slice().contains("debug"));
 }
diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
index f3d12d21684..e3dbaa62d35 100644
--- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
+++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
@@ -11,16 +11,16 @@
 // aux-build:cci_class_cast.rs
 extern crate cci_class_cast;
 
-use std::to_str::ToStr;
+use std::to_str::ToString;
 use cci_class_cast::kitty::cat;
 
-fn print_out(thing: Box<ToStr>, expected: String) {
-  let actual = thing.to_str();
+fn print_out(thing: Box<ToString>, expected: String) {
+  let actual = thing.to_string();
   println!("{}", actual);
   assert_eq!(actual.to_string(), expected);
 }
 
 pub fn main() {
-  let nyan: Box<ToStr> = box cat(0u, 2, "nyan".to_string()) as Box<ToStr>;
+  let nyan: Box<ToString> = box cat(0u, 2, "nyan".to_string()) as Box<ToString>;
   print_out(nyan, "nyan".to_string());
 }
diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs
index 3d486144c3e..71438882980 100644
--- a/src/test/run-pass/class-separate-impl.rs
+++ b/src/test/run-pass/class-separate-impl.rs
@@ -57,13 +57,13 @@ impl fmt::Show for cat {
     }
 }
 
-fn print_out(thing: Box<ToStr>, expected: String) {
-  let actual = thing.to_str();
+fn print_out(thing: Box<ToString>, expected: String) {
+  let actual = thing.to_string();
   println!("{}", actual);
   assert_eq!(actual.to_string(), expected);
 }
 
 pub fn main() {
-  let nyan: Box<ToStr> = box cat(0u, 2, "nyan".to_string()) as Box<ToStr>;
+  let nyan: Box<ToString> = box cat(0u, 2, "nyan".to_string()) as Box<ToString>;
   print_out(nyan, "nyan".to_string());
 }
diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs
index a5e86dee18e..fa82e42d793 100644
--- a/src/test/run-pass/deriving-show-2.rs
+++ b/src/test/run-pass/deriving-show-2.rs
@@ -41,15 +41,15 @@ impl fmt::Show for Custom {
 }
 
 pub fn main() {
-    assert_eq!(B1.to_str(), "B1".to_string());
-    assert_eq!(B2.to_str(), "B2".to_string());
-    assert_eq!(C1(3).to_str(), "C1(3)".to_string());
-    assert_eq!(C2(B2).to_str(), "C2(B2)".to_string());
-    assert_eq!(D1{ a: 2 }.to_str(), "D1 { a: 2 }".to_string());
-    assert_eq!(E.to_str(), "E".to_string());
-    assert_eq!(F(3).to_str(), "F(3)".to_string());
-    assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string());
-    assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string());
-    assert_eq!(I{ a: 2, b: 4 }.to_str(), "I { a: 2, b: 4 }".to_string());
-    assert_eq!(J(Custom).to_str(), "J(yay)".to_string());
+    assert_eq!(B1.to_string(), "B1".to_string());
+    assert_eq!(B2.to_string(), "B2".to_string());
+    assert_eq!(C1(3).to_string(), "C1(3)".to_string());
+    assert_eq!(C2(B2).to_string(), "C2(B2)".to_string());
+    assert_eq!(D1{ a: 2 }.to_string(), "D1 { a: 2 }".to_string());
+    assert_eq!(E.to_string(), "E".to_string());
+    assert_eq!(F(3).to_string(), "F(3)".to_string());
+    assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string());
+    assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string());
+    assert_eq!(I{ a: 2, b: 4 }.to_string(), "I { a: 2, b: 4 }".to_string());
+    assert_eq!(J(Custom).to_string(), "J(yay)".to_string());
 }
diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs
index bb236638905..7e71be41148 100644
--- a/src/test/run-pass/exponential-notation.rs
+++ b/src/test/run-pass/exponential-notation.rs
@@ -11,24 +11,24 @@
 #![feature(macro_rules)]
 
 use s = std::num::strconv;
-use to_str = std::num::strconv::float_to_str_common;
+use to_string = std::num::strconv::float_to_str_common;
 
 macro_rules! t(($a:expr, $b:expr) => { { let (r, _) = $a; assert_eq!(r, $b.to_string()) } })
 
 pub fn main() {
     // Basic usage
-    t!(to_str(1.2345678e-5f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpDec, false),
+    t!(to_string(1.2345678e-5f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpDec, false),
              "1.234568e-5")
 
     // Hexadecimal output
-    t!(to_str(7.281738281250e+01f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false),
+    t!(to_string(7.281738281250e+01f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false),
               "+1.2345p+6")
-    t!(to_str(-1.777768135071e-02f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false),
+    t!(to_string(-1.777768135071e-02f64, 16u, true, s::SignAll, s::DigMax(6), s::ExpBin, false),
              "-1.2345p-6")
 
     // Some denormals
-    t!(to_str(4.9406564584124654e-324f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false),
+    t!(to_string(4.9406564584124654e-324f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false),
              "1p-1074")
-    t!(to_str(2.2250738585072009e-308f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false),
+    t!(to_string(2.2250738585072009e-308f64, 10u, true, s::SignNeg, s::DigMax(6), s::ExpBin, false),
              "1p-1022")
 }
diff --git a/src/test/run-pass/fixed_length_vec_glue.rs b/src/test/run-pass/fixed_length_vec_glue.rs
index 62cfd10dbfb..3b7c5083bb4 100644
--- a/src/test/run-pass/fixed_length_vec_glue.rs
+++ b/src/test/run-pass/fixed_length_vec_glue.rs
@@ -17,6 +17,6 @@ struct Struc { a: u8, b: [int, ..3], c: int }
 pub fn main() {
     let arr = [1,2,3];
     let struc = Struc {a: 13u8, b: arr, c: 42};
-    let s = repr::repr_to_str(&struc);
+    let s = repr::repr_to_string(&struc);
     assert_eq!(s, "Struc{a: 13u8, b: [1, 2, 3], c: 42}".to_string());
 }
diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs
index d48a944c2f0..4a89d277e9f 100644
--- a/src/test/run-pass/issue-2904.rs
+++ b/src/test/run-pass/issue-2904.rs
@@ -79,8 +79,8 @@ fn read_board_grid<rdr:'static + io::Reader>(mut input: rdr)
 
 mod test {
     #[test]
-    pub fn trivial_to_str() {
-        assert!(lambda.to_str() == "\\")
+    pub fn trivial_to_string() {
+        assert!(lambda.to_string() == "\\")
     }
 }
 
diff --git a/src/test/run-pass/issue-3037.rs b/src/test/run-pass/issue-3037.rs
index 1d442198aec..1555098f291 100644
--- a/src/test/run-pass/issue-3037.rs
+++ b/src/test/run-pass/issue-3037.rs
@@ -10,7 +10,7 @@
 
 enum what { }
 
-fn what_to_str(x: what) -> String
+fn what_to_string(x: what) -> String
 {
     match x {
     }
diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs
index 53f92246e54..2568d94fcbf 100644
--- a/src/test/run-pass/issue-3559.rs
+++ b/src/test/run-pass/issue-3559.rs
@@ -24,6 +24,6 @@ pub fn main() {
     let mut table = HashMap::new();
     table.insert("one".to_string(), 1i);
     table.insert("two".to_string(), 2i);
-    assert!(check_strs(table.to_str().as_slice(), "{one: 1, two: 2}") ||
-            check_strs(table.to_str().as_slice(), "{two: 2, one: 1}"));
+    assert!(check_strs(table.to_string().as_slice(), "{one: 1, two: 2}") ||
+            check_strs(table.to_string().as_slice(), "{two: 2, one: 1}"));
 }
diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs
index ac022d5c212..e38969c2526 100644
--- a/src/test/run-pass/issue-3563-3.rs
+++ b/src/test/run-pass/issue-3563-3.rs
@@ -94,7 +94,7 @@ impl AsciiArt {
     }
 }
 
-// Allows AsciiArt to be converted to a string using the libcore ToStr trait.
+// Allows AsciiArt to be converted to a string using the libcore ToString trait.
 // Note that the %s fmt! specifier will not call this automatically.
 impl fmt::Show for AsciiArt {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -159,7 +159,7 @@ pub fn check_strs(actual: &str, expected: &str) -> bool {
 
 fn test_ascii_art_ctor() {
     let art = AsciiArt(3, 3, '*');
-    assert!(check_strs(art.to_str().as_slice(), "...\n...\n..."));
+    assert!(check_strs(art.to_string().as_slice(), "...\n...\n..."));
 }
 
 
@@ -168,7 +168,7 @@ fn test_add_pt() {
     art.add_pt(0, 0);
     art.add_pt(0, -10);
     art.add_pt(1, 2);
-    assert!(check_strs(art.to_str().as_slice(), "*..\n...\n.*."));
+    assert!(check_strs(art.to_string().as_slice(), "*..\n...\n.*."));
 }
 
 
@@ -176,7 +176,7 @@ fn test_shapes() {
     let mut art = AsciiArt(4, 4, '*');
     art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}});
     art.add_point(Point {x: 2, y: 2});
-    assert!(check_strs(art.to_str().as_slice(), "****\n*..*\n*.**\n****"));
+    assert!(check_strs(art.to_string().as_slice(), "****\n*..*\n*.**\n****"));
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/issue-3702.rs b/src/test/run-pass/issue-3702.rs
index c9cedc3b7de..3f219da0a87 100644
--- a/src/test/run-pass/issue-3702.rs
+++ b/src/test/run-pass/issue-3702.rs
@@ -11,11 +11,11 @@
 
 pub fn main() {
   trait Text {
-    fn to_str(&self) -> String;
+    fn to_string(&self) -> String;
   }
 
   fn to_string(t: Box<Text>) {
-    println!("{}", t.to_str());
+    println!("{}", t.to_string());
   }
 
 }
diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs
index b27720b8579..3ebc3e64573 100644
--- a/src/test/run-pass/issue-4241.rs
+++ b/src/test/run-pass/issue-4241.rs
@@ -96,19 +96,19 @@ priv fn parse_response(io: @io::Reader) -> Result {
     }
 }
 
-priv fn cmd_to_str(cmd: ~[String]) -> String {
+priv fn cmd_to_string(cmd: ~[String]) -> String {
   let mut res = "*".to_string();
-  res.push_str(cmd.len().to_str());
+  res.push_str(cmd.len().to_string());
   res.push_str("\r\n");
     for s in cmd.iter() {
-    res.push_str(["$".to_string(), s.len().to_str(), "\r\n".to_string(),
+    res.push_str(["$".to_string(), s.len().to_string(), "\r\n".to_string(),
                   (*s).clone(), "\r\n".to_string()].concat() );
     }
   res
 }
 
 fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result {
-  let cmd = cmd_to_str(cmd);
+  let cmd = cmd_to_string(cmd);
   //println!("{}", cmd);
   sb.write_str(cmd);
   let res = parse_response(@sb as @io::Reader);
@@ -116,7 +116,7 @@ fn query(cmd: ~[String], sb: TcpSocketBuf) -> Result {
 }
 
 fn query2(cmd: ~[String]) -> Result {
-  let _cmd = cmd_to_str(cmd);
+  let _cmd = cmd_to_string(cmd);
     io::with_str_reader("$3\r\nXXX\r\n".to_string())(|sb| {
     let res = parse_response(@sb as @io::Reader);
     println!("{:?}", res);
diff --git a/src/test/run-pass/issue-5280.rs b/src/test/run-pass/issue-5280.rs
index 16fd45a5615..977cd08ba37 100644
--- a/src/test/run-pass/issue-5280.rs
+++ b/src/test/run-pass/issue-5280.rs
@@ -11,15 +11,15 @@
 type FontTableTag = u32;
 
 trait FontTableTagConversions {
-  fn tag_to_str(self);
+  fn tag_to_string(self);
 }
 
 impl FontTableTagConversions for FontTableTag {
-  fn tag_to_str(self) {
+  fn tag_to_string(self) {
     &self;
   }
 }
 
 pub fn main() {
-    5.tag_to_str();
+    5.tag_to_string();
 }
diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs
index 2b67ef09c59..783dc32426a 100644
--- a/src/test/run-pass/monad.rs
+++ b/src/test/run-pass/monad.rs
@@ -38,7 +38,7 @@ impl<A> option_monad<A> for Option<A> {
 }
 
 fn transform(x: Option<int>) -> Option<String> {
-    x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str()) )
+    x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_string()) )
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/move-out-of-field.rs b/src/test/run-pass/move-out-of-field.rs
index e7d679c41e8..92c5e025b9b 100644
--- a/src/test/run-pass/move-out-of-field.rs
+++ b/src/test/run-pass/move-out-of-field.rs
@@ -20,7 +20,7 @@ impl StringBuffer {
     }
 }
 
-fn to_str(sb: StringBuffer) -> String {
+fn to_string(sb: StringBuffer) -> String {
     sb.s
 }
 
@@ -30,6 +30,6 @@ pub fn main() {
     };
     sb.append("Hello, ");
     sb.append("World!");
-    let str = to_str(sb);
+    let str = to_string(sb);
     assert_eq!(str.as_slice(), "Hello, World!");
 }
diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs
index 9fd6e961675..8532b5f51dc 100644
--- a/src/test/run-pass/new-impl-syntax.rs
+++ b/src/test/run-pass/new-impl-syntax.rs
@@ -32,6 +32,6 @@ impl<T:fmt::Show> fmt::Show for PolymorphicThingy<T> {
 }
 
 pub fn main() {
-    println!("{}", Thingy { x: 1, y: 2 }.to_str());
-    println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_str());
+    println!("{}", Thingy { x: 1, y: 2 }.to_string());
+    println!("{}", PolymorphicThingy { x: Thingy { x: 1, y: 2 } }.to_string());
 }
diff --git a/src/test/run-pass/overloaded-deref-count.rs b/src/test/run-pass/overloaded-deref-count.rs
index 49edf1bad57..283c76adf0d 100644
--- a/src/test/run-pass/overloaded-deref-count.rs
+++ b/src/test/run-pass/overloaded-deref-count.rs
@@ -72,7 +72,7 @@ pub fn main() {
     // N.B. This is required because method lookup hasn't been performed so
     // we don't know whether the called method takes mutable self, before
     // the dereference itself is type-checked (a chicken-and-egg problem).
-    (*n).to_str();
+    (*n).to_string();
     assert_eq!(n.counts(), (2, 4));
 
     // Mutable deref used for calling a method taking &mut self.
diff --git a/src/test/run-pass/send_str_treemap.rs b/src/test/run-pass/send_str_treemap.rs
index 68eca8f21a7..f3a730aa2b3 100644
--- a/src/test/run-pass/send_str_treemap.rs
+++ b/src/test/run-pass/send_str_treemap.rs
@@ -12,7 +12,7 @@ extern crate collections;
 
 use std::collections::{ Map, MutableMap};
 use std::str::{SendStr, Owned, Slice};
-use std::to_str::ToStr;
+use std::to_str::ToString;
 use self::collections::TreeMap;
 use std::option::Some;
 
diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs
index 9267fcac011..d0dacc2ff7a 100644
--- a/src/test/run-pass/static-impl.rs
+++ b/src/test/run-pass/static-impl.rs
@@ -31,7 +31,7 @@ trait uint_utils {
 
 impl uint_utils for uint {
     fn str(&self) -> String {
-        self.to_str()
+        self.to_string()
     }
     fn multi(&self, f: |uint|) {
         let mut c = 0u;
diff --git a/src/test/run-pass/task-stderr.rs b/src/test/run-pass/task-stderr.rs
index 6a71f9df6e4..ceffd1e3636 100644
--- a/src/test/run-pass/task-stderr.rs
+++ b/src/test/run-pass/task-stderr.rs
@@ -21,6 +21,6 @@ fn main() {
     });
     assert!(res.is_err());
 
-    let output = reader.read_to_str().unwrap();
+    let output = reader.read_to_string().unwrap();
     assert!(output.as_slice().contains("Hello, world!"));
 }
diff --git a/src/test/run-pass/tcp-connect-timeouts.rs b/src/test/run-pass/tcp-connect-timeouts.rs
index ebc720aa0c8..d2408509fc5 100644
--- a/src/test/run-pass/tcp-connect-timeouts.rs
+++ b/src/test/run-pass/tcp-connect-timeouts.rs
@@ -54,7 +54,7 @@ macro_rules! iotest (
 iotest!(fn eventual_timeout() {
     use native;
     let addr = next_test_ip4();
-    let host = addr.ip.to_str();
+    let host = addr.ip.to_string();
     let port = addr.port;
 
     // Use a native task to receive connections because it turns out libuv is
@@ -82,7 +82,7 @@ iotest!(fn eventual_timeout() {
 
 iotest!(fn timeout_success() {
     let addr = next_test_ip4();
-    let host = addr.ip.to_str();
+    let host = addr.ip.to_string();
     let port = addr.port;
     let _l = TcpListener::bind(host.as_slice(), port).unwrap().listen();
 
diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs
index de3366708c5..f52a3455e41 100644
--- a/src/test/run-pass/tcp-stress.rs
+++ b/src/test/run-pass/tcp-stress.rs
@@ -61,7 +61,7 @@ fn main() {
     for _ in range(0u, 1000) {
         let tx = tx.clone();
         TaskBuilder::new().stack_size(64 * 1024).spawn(proc() {
-            let host = addr.ip.to_str();
+            let host = addr.ip.to_string();
             let port = addr.port;
             match TcpStream::connect(host.as_slice(), port) {
                 Ok(stream) => {
diff --git a/src/test/run-pass/test-ignore-cfg.rs b/src/test/run-pass/test-ignore-cfg.rs
index c3387a963a7..b36fbca2da0 100644
--- a/src/test/run-pass/test-ignore-cfg.rs
+++ b/src/test/run-pass/test-ignore-cfg.rs
@@ -27,10 +27,10 @@ fn checktests() {
     let tests = __test::TESTS;
 
     assert!(
-        tests.iter().any(|t| t.desc.name.to_str().as_slice() == "shouldignore" &&
+        tests.iter().any(|t| t.desc.name.to_string().as_slice() == "shouldignore" &&
                          t.desc.ignore));
 
     assert!(
-        tests.iter().any(|t| t.desc.name.to_str().as_slice() == "shouldnotignore" &&
+        tests.iter().any(|t| t.desc.name.to_string().as_slice() == "shouldnotignore" &&
                          !t.desc.ignore));
 }
diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs
index daab40f5d90..43d3b591ffa 100644
--- a/src/test/run-pass/trait-cast.rs
+++ b/src/test/run-pass/trait-cast.rs
@@ -39,7 +39,7 @@ impl<T:to_str> to_str for Option<T> {
 
 impl to_str for int {
     fn to_str_(&self) -> String {
-        self.to_str()
+        self.to_string()
     }
 }
 
diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs
index f3f4c556b77..eeda6e2c88b 100644
--- a/src/test/run-pass/trait-generic.rs
+++ b/src/test/run-pass/trait-generic.rs
@@ -11,16 +11,16 @@
 
 
 trait to_str {
-    fn to_string(&self) -> String;
+    fn to_string_(&self) -> String;
 }
 impl to_str for int {
-    fn to_string(&self) -> String { self.to_str() }
+    fn to_string_(&self) -> String { self.to_string() }
 }
 impl to_str for String {
-    fn to_string(&self) -> String { self.clone() }
+    fn to_string_(&self) -> String { self.clone() }
 }
 impl to_str for () {
-    fn to_string(&self) -> String { "()".to_string() }
+    fn to_string_(&self) -> String { "()".to_string() }
 }
 
 trait map<T> {
@@ -40,7 +40,7 @@ fn foo<U, T: map<U>>(x: T) -> Vec<String> {
     x.map(|_e| "hi".to_string() )
 }
 fn bar<U:to_str,T:map<U>>(x: T) -> Vec<String> {
-    x.map(|_e| _e.to_string() )
+    x.map(|_e| _e.to_string_() )
 }
 
 pub fn main() {
diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs
index 54a21caafa0..fbe40e837de 100644
--- a/src/test/run-pass/trait-to-str.rs
+++ b/src/test/run-pass/trait-to-str.rs
@@ -11,29 +11,29 @@
 
 
 trait to_str {
-    fn to_string(&self) -> String;
+    fn to_string_(&self) -> String;
 }
 
 impl to_str for int {
-    fn to_string(&self) -> String { self.to_str() }
+    fn to_string_(&self) -> String { self.to_string() }
 }
 
 impl<T:to_str> to_str for Vec<T> {
-    fn to_string(&self) -> String {
+    fn to_string_(&self) -> String {
         format!("[{}]",
                 self.iter()
-                    .map(|e| e.to_string())
+                    .map(|e| e.to_string_())
                     .collect::<Vec<String>>()
                     .connect(", "))
     }
 }
 
 pub fn main() {
-    assert!(1.to_string() == "1".to_string());
-    assert!((vec!(2i, 3, 4)).to_string() == "[2, 3, 4]".to_string());
+    assert!(1.to_string_() == "1".to_string());
+    assert!((vec!(2i, 3, 4)).to_string_() == "[2, 3, 4]".to_string());
 
     fn indirect<T:to_str>(x: T) -> String {
-        format!("{}!", x.to_string())
+        format!("{}!", x.to_string_())
     }
     assert!(indirect(vec!(10i, 20)) == "[10, 20]!".to_string());
 
diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs
index 4d9f80cec6a..deb08a4608c 100644
--- a/src/test/run-pass/vec-to_str.rs
+++ b/src/test/run-pass/vec-to_str.rs
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 pub fn main() {
-    assert_eq!((vec!(0i, 1)).to_str(), "[0, 1]".to_string());
-    assert_eq!((&[1i, 2]).to_str(), "[1, 2]".to_string());
+    assert_eq!((vec!(0i, 1)).to_string(), "[0, 1]".to_string());
+    assert_eq!((&[1i, 2]).to_string(), "[1, 2]".to_string());
 
     let foo = vec!(3i, 4);
     let bar = &[4i, 5];
 
-    assert_eq!(foo.to_str(), "[3, 4]".to_string());
-    assert_eq!(bar.to_str(), "[4, 5]".to_string());
+    assert_eq!(foo.to_string(), "[3, 4]".to_string());
+    assert_eq!(bar.to_string(), "[4, 5]".to_string());
 }