]> git.lizzy.rs Git - rust.git/commitdiff
std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.
authorRicho Healey <richo@psych0tik.net>
Sat, 21 Jun 2014 10:39:03 +0000 (03:39 -0700)
committerBrian Anderson <banderson@mozilla.com>
Tue, 8 Jul 2014 20:01:43 +0000 (13:01 -0700)
[breaking-change]

208 files changed:
src/compiletest/compiletest.rs
src/compiletest/errors.rs
src/compiletest/util.rs
src/doc/guide-tasks.md
src/doc/po/ja/complement-cheatsheet.md.po
src/doc/po/ja/rust.md.po
src/doc/po/ja/tutorial.md.po
src/doc/rust.md
src/etc/vim/syntax/rust.vim
src/libcollections/bitv.rs
src/libcollections/btree.rs
src/libcollections/dlist.rs
src/libcollections/smallintmap.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcore/fmt/float.rs
src/libcoretest/char.rs
src/libdebug/fmt.rs
src/libdebug/repr.rs
src/libgetopts/lib.rs
src/libglob/lib.rs
src/libgraphviz/lib.rs
src/libnative/io/file_win32.rs
src/libnative/io/pipe_unix.rs
src/libnative/io/pipe_win32.rs
src/libnative/io/process.rs
src/libnative/io/util.rs
src/libnum/bigint.rs
src/libnum/complex.rs
src/libnum/rational.rs
src/libregex_macros/lib.rs
src/librustc/back/link.rs
src/librustc/back/svh.rs
src/librustc/driver/driver.rs
src/librustc/driver/mod.rs
src/librustc/front/test.rs
src/librustc/lib/llvm.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/metadata/creader.rs
src/librustc/metadata/decoder.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/gather_loans/move_error.rs
src/librustc/middle/borrowck/mod.rs
src/librustc/middle/cfg/graphviz.rs
src/librustc/middle/check_const.rs
src/librustc/middle/check_match.rs
src/librustc/middle/check_static.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/effect.rs
src/librustc/middle/kind.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/privacy.rs
src/librustc/middle/reachable.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/save/mod.rs
src/librustc/middle/save/recorder.rs
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/adt.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/builder.rs
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/cleanup.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/datum.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/llrepr.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/check/_match.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/regionmanip.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/check/writeback.rs
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/infer/error_reporting.rs
src/librustc/middle/typeck/infer/glb.rs
src/librustc/middle/typeck/infer/lattice.rs
src/librustc/middle/typeck/infer/lub.rs
src/librustc/middle/typeck/infer/mod.rs
src/librustc/middle/typeck/infer/resolve.rs
src/librustc/middle/typeck/infer/sub.rs
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/variance.rs
src/librustc/util/ppaux.rs
src/librustdoc/clean/inline.rs
src/librustdoc/clean/mod.rs
src/librustdoc/html/format.rs
src/librustdoc/html/markdown.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/librustrt/c_str.rs
src/librustuv/lib.rs
src/librustuv/net.rs
src/libsemver/lib.rs
src/libserialize/json.rs
src/libstd/ascii.rs
src/libstd/collections/lru_cache.rs
src/libstd/dynamic_lib.rs
src/libstd/from_str.rs
src/libstd/io/fs.rs
src/libstd/io/mem.rs
src/libstd/io/mod.rs
src/libstd/io/net/ip.rs
src/libstd/io/net/tcp.rs
src/libstd/io/process.rs
src/libstd/io/stdio.rs
src/libstd/io/util.rs
src/libstd/num/f32.rs
src/libstd/num/f64.rs
src/libstd/num/int_macros.rs
src/libstd/num/strconv.rs
src/libstd/num/uint_macros.rs
src/libstd/os.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/prelude.rs
src/libstd/task.rs
src/libstd/to_str.rs
src/libsyntax/ast.rs
src/libsyntax/ast_map.rs
src/libsyntax/ast_util.rs
src/libsyntax/codemap.rs
src/libsyntax/diagnostic.rs
src/libsyntax/ext/asm.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/env.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/log_syntax.rs
src/libsyntax/ext/quote.rs
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/fold.rs
src/libsyntax/parse/attr.rs
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libtest/lib.rs
src/libtest/stats.rs
src/libtime/lib.rs
src/liburl/lib.rs
src/libuuid/lib.rs
src/test/bench/core-set.rs
src/test/bench/core-uint-to-str.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-pfib.rs
src/test/bench/shootout-regex-dna.rs
src/test/compile-fail/issue-2063.rs
src/test/compile-fail/issue-3973.rs
src/test/compile-fail/lint-uppercase-variables.rs
src/test/compile-fail/moves-based-on-type-block-bad.rs
src/test/compile-fail/multitrait.rs
src/test/compile-fail/no-implicit-prelude-nested.rs
src/test/compile-fail/no-implicit-prelude.rs
src/test/compile-fail/uninhabited-enum-cast.rs
src/test/compile-fail/use-after-move-implicity-coerced-object.rs
src/test/debuginfo/cross-crate-type-uniquing.rs
src/test/run-pass/bool.rs
src/test/run-pass/capturing-logging.rs
src/test/run-pass/class-cast-to-trait-cross-crate-2.rs
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/deriving-show-2.rs
src/test/run-pass/exponential-notation.rs
src/test/run-pass/fixed_length_vec_glue.rs
src/test/run-pass/issue-2904.rs
src/test/run-pass/issue-3037.rs
src/test/run-pass/issue-3559.rs
src/test/run-pass/issue-3563-3.rs
src/test/run-pass/issue-3702.rs
src/test/run-pass/issue-4241.rs
src/test/run-pass/issue-5280.rs
src/test/run-pass/monad.rs
src/test/run-pass/move-out-of-field.rs
src/test/run-pass/new-impl-syntax.rs
src/test/run-pass/overloaded-deref-count.rs
src/test/run-pass/send_str_treemap.rs
src/test/run-pass/static-impl.rs
src/test/run-pass/task-stderr.rs
src/test/run-pass/tcp-connect-timeouts.rs
src/test/run-pass/tcp-stress.rs
src/test/run-pass/test-ignore-cfg.rs
src/test/run-pass/trait-cast.rs
src/test/run-pass/trait-generic.rs
src/test/run-pass/trait-to-str.rs
src/test/run-pass/vec-to_str.rs

index 9eac38e4cd5b7cb77e70cc03e65fde68c64c45db..4de66d8746fbea72f45206832e1ef93c56a2ba9e 100644 (file)
@@ -187,7 +187,7 @@ pub fn log_config(config: &Config) {
                     opt_str(&config.filter
                                    .as_ref()
                                    .map(|re| {
-                                       re.to_str().into_string()
+                                       re.to_string().into_string()
                                    }))));
     logv(c, format!("runtool: {}", opt_str(&config.runtool)));
     logv(c, format!("host-rustcflags: {}",
index 8e79f58c60881d21399b2c98f0ab750f98222a73..7681792bdf53d1e1af5f92fe111e710f398410d6 100644 (file)
@@ -31,7 +31,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
 fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option<ExpectedError> {
     re.captures(line).and_then(|caps| {
         let adjusts = caps.name("adjusts").len();
-        let kind = caps.name("kind").to_ascii().to_lower().into_str();
+        let kind = caps.name("kind").to_ascii().to_lower().into_string();
         let msg = caps.name("msg").trim().to_string();
 
         debug!("line={} kind={} msg={}", line_num, kind, msg);
index c6e02606f74e750fa4eababd3d61c6a05f7941dc..369e6b0af645c82505bf6e08e7ed0df5b6f852b6 100644 (file)
@@ -41,7 +41,7 @@ pub fn make_new_path(path: &str) -> String {
       Some(curr) => {
         format!("{}{}{}", path, path_div(), curr)
       }
-      None => path.to_str()
+      None => path.to_string()
     }
 }
 
index 9021b761954d05dfd8212e52972c41132dc8d58c..6ef273e7a1a59099021bfdb11f3de3816f1ac9c3 100644 (file)
@@ -465,7 +465,7 @@ fn stringifier(channel: &DuplexStream<String, uint>) {
     let mut value: uint;
     loop {
         value = channel.recv();
-        channel.send(value.to_str());
+        channel.send(value.to_string());
         if value == 0 { break; }
     }
 }
@@ -478,7 +478,7 @@ send strings (the first type parameter) and receive `uint` messages
 (the second type parameter). The body itself simply loops, reading
 from the channel and then sending its response back.  The actual
 response itself is simply the stringified version of the received value,
-`uint::to_str(value)`.
+`uint::to_string(value)`.
 
 Here is the code for the parent task:
 
@@ -492,7 +492,7 @@ use std::comm::duplex;
 #     let mut value: uint;
 #     loop {
 #         value = channel.recv();
-#         channel.send(value.to_str());
+#         channel.send(value.to_string());
 #         if value == 0u { break; }
 #     }
 # }
index 3b7bb2e740d46a58ca7c0689acd859c7da0991ef..b429f3020a73c1414ca293193b2ee27735823f1c 100644 (file)
@@ -23,7 +23,7 @@ msgstr ""
 #| "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz [win-exe]: "
 #| "http://static.rust-lang.org/dist/rust-nightly-install.exe"
 msgid ""
-"Use [`ToStr`](http://static.rust-lang.org/doc/master/std/to_str/trait.ToStr."
+"Use [`ToString`](http://static.rust-lang.org/doc/master/std/to_str/trait.ToString."
 "html)."
 msgstr ""
 "[tarball]: http://static.rust-lang.org/dist/rust-nightly.tar.gz\n"
@@ -34,7 +34,7 @@ msgstr ""
 #, fuzzy
 #| msgid ""
 #| "~~~~ let x: f64 = 4.0; let y: uint = x as uint; assert!(y == 4u); ~~~~"
-msgid "~~~ let x: int = 42; let y: String = x.to_str(); ~~~"
+msgid "~~~ let x: int = 42; let y: String = x.to_string(); ~~~"
 msgstr ""
 "~~~~\n"
 "let x: f64 = 4.0;\n"
index f0aef7accb6e1a0484f68cca36cf05bb4d3475b1..a28a62d01c2674d561ac69661fb19b6240dd0dc0 100644 (file)
@@ -1656,7 +1656,7 @@ msgstr ""
 #| msgid "~~~~ {.ignore} // main.rs extern crate world; fn main() { println(~\"hello \" + world::explore()); } ~~~~"
 msgid ""
 "impl Printable for int {\n"
-"  fn to_string(&self) -> String { self.to_str() }\n"
+"  fn to_string(&self) -> String { self.to_string() }\n"
 "}\n"
 msgstr ""
 "~~~~ {.ignore}\n"
index 68c32ae9704a36bc74a66ffe7f8447a4549dfe8d..597cf5b7ac509cfde4b42385ee3d07557b68d0ab 100644 (file)
@@ -4410,9 +4410,9 @@ msgstr ""
 
 #. type: Plain text
 #: src/doc/tutorial.md:2528
-msgid "#[deriving(Rand, ToStr)] enum ABC { A, B, C } ~~~"
+msgid "#[deriving(Rand, ToString)] enum ABC { A, B, C } ~~~"
 msgstr ""
-"#[deriving(Rand, ToStr)]\n"
+"#[deriving(Rand, ToString)]\n"
 "enum ABC { A, B, C }\n"
 "~~~"
 
@@ -4422,15 +4422,15 @@ msgstr ""
 #| msgid ""
 #| "The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
 #| "`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, "
-#| "`Zero`, and `ToStr`."
+#| "`Zero`, and `ToString`."
 msgid ""
 "The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
 "`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, "
-"`Default`, `Zero`, and `ToStr`."
+"`Default`, `Zero`, and `ToString`."
 msgstr ""
 "実装を自動的に導出可能なトレイトは、 `Eq`, `TotalEq`, `Ord`, `TotalOrd`, "
 "`Encodable` `Decodable`, `Clone`, `DeepClone`, `Hash`, `Rand`, `Zero`, "
-"および `ToStr` です。."
+"および `ToString` です。."
 
 #. type: Plain text
 #: src/doc/tutorial.md:2534
index f09214d1a6f9d149483857f5c6f8fb6e9e83db2f..9d5a6fa42a830239fb21695527511b85fc6abe1f 100644 (file)
@@ -3671,15 +3671,15 @@ An example of an object type:
 
 ~~~~
 trait Printable {
-  fn to_string(&self) -> String;
+  fn stringify(&self) -> String;
 }
 
 impl Printable for int {
-  fn to_string(&self) -> String { self.to_str() }
+  fn stringify(&self) -> String { self.to_string() }
 }
 
 fn print(a: Box<Printable>) {
-   println!("{}", a.to_string());
+   println!("{}", a.stringify());
 }
 
 fn main() {
index 6285eb6895df05e42ac6f54f601277239ada9bf7..86df9cba4cdf5317b8a148f97dbde8b912a2607e 100644 (file)
@@ -100,7 +100,7 @@ syn keyword rustTrait RawPtr
 syn keyword rustTrait Buffer Writer Reader Seek
 syn keyword rustTrait Str StrVector StrSlice OwnedStr
 syn keyword rustTrait IntoMaybeOwned StrAllocating
-syn keyword rustTrait ToStr IntoStr
+syn keyword rustTrait ToString IntoStr
 syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
 syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
 syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
index f01b1cf9815389f1ae628f981504c6b157a0c974..905c27ee82c9470cc1c2af5e70af59115727993f 100644 (file)
@@ -60,17 +60,17 @@ enum BitvVariant { Big(BigBitv), Small(SmallBitv) }
 /// bv.set(3, true);
 /// bv.set(5, true);
 /// bv.set(7, true);
-/// println!("{}", bv.to_str());
+/// println!("{}", bv.to_string());
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 ///
 /// // flip all values in bitvector, producing non-primes less than 10
 /// bv.negate();
-/// println!("{}", bv.to_str());
+/// println!("{}", bv.to_string());
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 ///
 /// // reset bitvector to empty
 /// bv.clear();
-/// println!("{}", bv.to_str());
+/// println!("{}", bv.to_string());
 /// println!("total bits set to true: {}", bv.iter().filter(|x| *x).count());
 /// ```
 pub struct Bitv {
@@ -996,10 +996,10 @@ mod tests {
     #[test]
     fn test_to_str() {
         let zerolen = Bitv::new();
-        assert_eq!(zerolen.to_str().as_slice(), "");
+        assert_eq!(zerolen.to_string().as_slice(), "");
 
         let eightbits = Bitv::with_capacity(8u, false);
-        assert_eq!(eightbits.to_str().as_slice(), "00000000")
+        assert_eq!(eightbits.to_string().as_slice(), "00000000")
     }
 
     #[test]
@@ -1022,7 +1022,7 @@ fn test_2_elements() {
         let mut b = bitv::Bitv::with_capacity(2, false);
         b.set(0, true);
         b.set(1, false);
-        assert_eq!(b.to_str().as_slice(), "10");
+        assert_eq!(b.to_string().as_slice(), "10");
     }
 
     #[test]
@@ -1333,7 +1333,7 @@ fn test_equal_sneaky_big() {
     fn test_from_bytes() {
         let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
         let str = format!("{}{}{}", "10110110", "00000000", "11111111");
-        assert_eq!(bitv.to_str().as_slice(), str.as_slice());
+        assert_eq!(bitv.to_string().as_slice(), str.as_slice());
     }
 
     #[test]
@@ -1352,7 +1352,7 @@ fn test_to_bytes() {
     fn test_from_bools() {
         let bools = vec![true, false, true, true];
         let bitv: Bitv = bools.iter().map(|n| *n).collect();
-        assert_eq!(bitv.to_str().as_slice(), "1011");
+        assert_eq!(bitv.to_string().as_slice(), "1011");
     }
 
     #[test]
@@ -1787,7 +1787,7 @@ fn test_bitv_set_show() {
         s.insert(10);
         s.insert(50);
         s.insert(2);
-        assert_eq!("{1, 2, 10, 50}".to_string(), s.to_str());
+        assert_eq!("{1, 2, 10, 50}".to_string(), s.to_string());
     }
 
     fn rng() -> rand::IsaacRng {
index 92abfaad3483301016fa4449e51221967446f2c9..2d138b1a1895f3d45406c15d00dbc9bdf5c9c421 100644 (file)
@@ -787,7 +787,6 @@ mod test_btree {
     fn insert_test_one() {
         let b = BTree::new(1i, "abc".to_string(), 2);
         let is_insert = b.insert(2i, "xyz".to_string());
-        //println!("{}", is_insert.clone().to_str());
         assert!(is_insert.root.is_leaf());
     }
 
@@ -798,7 +797,7 @@ fn insert_test_two() {
         let leaf_elt_3 = LeafElt::new(3i, "ccc".to_string());
         let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3));
         let b = BTree::new_with_node_len(n, 3, 2);
-        //println!("{}", b.clone().insert(4, "ddd".to_string()).to_str());
+        //println!("{}", b.clone().insert(4, "ddd".to_string()).to_string());
         assert!(b.insert(4, "ddd".to_string()).root.is_leaf());
     }
 
@@ -810,7 +809,7 @@ fn insert_test_three() {
         let leaf_elt_4 = LeafElt::new(4i, "ddd".to_string());
         let n = Node::new_leaf(vec!(leaf_elt_1, leaf_elt_2, leaf_elt_3, leaf_elt_4));
         let b = BTree::new_with_node_len(n, 3, 2);
-        //println!("{}", b.clone().insert(5, "eee".to_string()).to_str());
+        //println!("{}", b.clone().insert(5, "eee".to_string()).to_string());
         assert!(!b.insert(5, "eee".to_string()).root.is_leaf());
     }
 
@@ -827,7 +826,7 @@ fn insert_test_four() {
         b = b.clone().insert(7, "ggg".to_string());
         b = b.clone().insert(8, "hhh".to_string());
         b = b.clone().insert(0, "omg".to_string());
-        //println!("{}", b.clone().to_str());
+        //println!("{}", b.clone().to_string());
         assert!(!b.root.is_leaf());
     }
 
@@ -905,11 +904,11 @@ fn btree_cmp_test_greater() {
         assert!(&b2.cmp(&b) == &Greater)
     }
 
-    //Tests the BTree's to_str() method.
+    //Tests the BTree's to_string() method.
     #[test]
     fn btree_tostr_test() {
         let b = BTree::new(1i, "abc".to_string(), 2);
-        assert_eq!(b.to_str(), "Key: 1, value: abc;".to_string())
+        assert_eq!(b.to_string(), "Key: 1, value: abc;".to_string())
     }
 
 }
index 4114c8cb1c4ddc8b7a5a489de9ea5ee1f7a8c518..ed2d67388766700ebd3b99ddf4ec9d739d05ea88 100644 (file)
@@ -1041,12 +1041,12 @@ fn test_fuzz() {
     #[test]
     fn test_show() {
         let list: DList<int> = range(0i, 10).collect();
-        assert!(list.to_str().as_slice() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
+        assert!(list.to_string().as_slice() == "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
 
         let list: DList<&str> = vec!["just", "one", "test", "more"].iter()
                                                                    .map(|&s| s)
                                                                    .collect();
-        assert!(list.to_str().as_slice() == "[just, one, test, more]");
+        assert!(list.to_string().as_slice() == "[just, one, test, more]");
     }
 
     #[cfg(test)]
index 14e41f3fef96546a257d531eb429e91e3b46e37e..ca62b1235d5549e01a6f3b6ed0fc522149a1ce71 100644 (file)
@@ -491,7 +491,7 @@ fn test_show() {
         map.insert(1, 2i);
         map.insert(3, 4i);
 
-        let map_str = map.to_str();
+        let map_str = map.to_string();
         let map_str = map_str.as_slice();
         assert!(map_str == "{1: 2, 3: 4}" || map_str == "{3: 4, 1: 2}");
         assert_eq!(format!("{}", empty), "{}".to_string());
index ddba4b34e3a2a4e8a5664f54b61d95e08ffeb943..63c95fa25cb0da74b5d57b1d25569fb3eb363a41 100644 (file)
@@ -657,7 +657,7 @@ impl<'a> StrAllocating for MaybeOwned<'a> {
     #[inline]
     fn into_string(self) -> String {
         match self {
-            Slice(s) => s.to_string(),
+            Slice(s) => String::from_str(s),
             Owned(s) => s
         }
     }
@@ -673,7 +673,7 @@ impl<'a> Clone for MaybeOwned<'a> {
     fn clone(&self) -> MaybeOwned<'a> {
         match *self {
             Slice(s) => Slice(s),
-            Owned(ref s) => Owned(s.to_string())
+            Owned(ref s) => Owned(String::from_str(s.as_slice()))
         }
     }
 }
@@ -762,7 +762,7 @@ fn test_from_buf_len() {
             let a = vec![65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
             let b = a.as_ptr();
             let c = from_buf_len(b, 3u);
-            assert_eq!(c, "AAA".to_string());
+            assert_eq!(c, String::from_str("AAA"));
         }
     }
 }
@@ -776,12 +776,6 @@ pub trait StrAllocating: Str {
     /// Convert `self` into a `String`, not making a copy if possible.
     fn into_string(self) -> String;
 
-    /// Convert `self` into a `String`.
-    #[inline]
-    fn to_string(&self) -> String {
-        String::from_str(self.as_slice())
-    }
-
     #[allow(missing_doc)]
     #[deprecated = "replaced by .into_string()"]
     fn into_owned(self) -> String {
@@ -933,7 +927,7 @@ fn nfkd_chars<'a>(&'a self) -> Decompositions<'a> {
 impl<'a> StrAllocating for &'a str {
     #[inline]
     fn into_string(self) -> String {
-        self.to_string()
+        String::from_str(self)
     }
 }
 
@@ -963,11 +957,19 @@ fn append(mut self, rhs: &str) -> String {
 
 #[cfg(test)]
 mod tests {
-    use std::prelude::*;
     use std::iter::AdditiveIterator;
     use std::default::Default;
+    use std::char::Char;
+    use std::clone::Clone;
+    use std::cmp::{Equal, Greater, Less, Ord, Eq, PartialOrd, PartialEq, Equiv};
+    use std::result::{Ok, Err};
+    use std::option::{Some, None};
+    use std::ptr::RawPtr;
+    use std::iter::{Iterator, DoubleEndedIterator};
+    use Collection;
 
-    use str::*;
+    use super::*;
+    use std::slice::{Vector, ImmutableVector};
     use string::String;
     use vec::Vec;
 
@@ -1028,17 +1030,17 @@ fn test_rfind() {
 
     #[test]
     fn test_collect() {
-        let empty = "".to_string();
+        let empty = String::from_str("");
         let s: String = empty.as_slice().chars().collect();
         assert_eq!(empty, s);
-        let data = "ประเทศไทย中".to_string();
+        let data = String::from_str("ประเทศไทย中");
         let s: String = data.as_slice().chars().collect();
         assert_eq!(data, s);
     }
 
     #[test]
     fn test_into_bytes() {
-        let data = "asdf".to_string();
+        let data = String::from_str("asdf");
         let buf = data.into_bytes();
         assert_eq!(b"asdf", buf.as_slice());
     }
@@ -1055,7 +1057,7 @@ fn test_find_str() {
         assert!(data.slice(2u, 4u).find_str("ab").is_none());
 
         let string = "ประเทศไทย中华Việt Nam";
-        let mut data = string.to_string();
+        let mut data = String::from_str(string);
         data.push_str(string);
         assert!(data.as_slice().find_str("ไท华").is_none());
         assert_eq!(data.as_slice().slice(0u, 43u).find_str(""), Some(0u));
@@ -1092,11 +1094,13 @@ fn test_concat() {
         fn t(v: &[String], s: &str) {
             assert_eq!(v.concat().as_slice(), s);
         }
-        t(["you".to_string(), "know".to_string(), "I'm".to_string(),
-          "no".to_string(), "good".to_string()], "youknowI'mnogood");
+        t([String::from_str("you"), String::from_str("know"),
+           String::from_str("I'm"),
+           String::from_str("no"), String::from_str("good")],
+          "youknowI'mnogood");
         let v: &[String] = [];
         t(v, "");
-        t(["hi".to_string()], "hi");
+        t([String::from_str("hi")], "hi");
     }
 
     #[test]
@@ -1104,12 +1108,13 @@ fn test_connect() {
         fn t(v: &[String], sep: &str, s: &str) {
             assert_eq!(v.connect(sep).as_slice(), s);
         }
-        t(["you".to_string(), "know".to_string(), "I'm".to_string(),
-           "no".to_string(), "good".to_string()],
+        t([String::from_str("you"), String::from_str("know"),
+           String::from_str("I'm"),
+           String::from_str("no"), String::from_str("good")],
           " ", "you know I'm no good");
         let v: &[String] = [];
         t(v, " ", "");
-        t(["hi".to_string()], " ", "hi");
+        t([String::from_str("hi")], " ", "hi");
     }
 
     #[test]
@@ -1136,11 +1141,11 @@ fn t(v: &[&str], sep: &str, s: &str) {
 
     #[test]
     fn test_repeat() {
-        assert_eq!("x".repeat(4), "xxxx".to_string());
-        assert_eq!("hi".repeat(4), "hihihihi".to_string());
-        assert_eq!("ไท华".repeat(3), "ไท华ไท华ไท华".to_string());
-        assert_eq!("".repeat(4), "".to_string());
-        assert_eq!("hi".repeat(0), "".to_string());
+        assert_eq!("x".repeat(4), String::from_str("xxxx"));
+        assert_eq!("hi".repeat(4), String::from_str("hihihihi"));
+        assert_eq!("ไท华".repeat(3), String::from_str("ไท华ไท华ไท华"));
+        assert_eq!("".repeat(4), String::from_str(""));
+        assert_eq!("hi".repeat(0), String::from_str(""));
     }
 
     #[test]
@@ -1168,9 +1173,9 @@ fn half_a_million_letter_a() -> String {
         }
         let letters = a_million_letter_a();
         assert!(half_a_million_letter_a() ==
-            unsafe {raw::slice_bytes(letters.as_slice(),
+            unsafe {String::from_str(raw::slice_bytes(letters.as_slice(),
                                      0u,
-                                     500000)}.to_string());
+                                     500000))});
     }
 
     #[test]
@@ -1204,13 +1209,13 @@ fn test_is_empty() {
     #[test]
     fn test_replace() {
         let a = "a";
-        assert_eq!("".replace(a, "b"), "".to_string());
-        assert_eq!("a".replace(a, "b"), "b".to_string());
-        assert_eq!("ab".replace(a, "b"), "bb".to_string());
+        assert_eq!("".replace(a, "b"), String::from_str(""));
+        assert_eq!("a".replace(a, "b"), String::from_str("b"));
+        assert_eq!("ab".replace(a, "b"), String::from_str("bb"));
         let test = "test";
         assert!(" test test ".replace(test, "toast") ==
-            " toast toast ".to_string());
-        assert_eq!(" test test ".replace(test, ""), "   ".to_string());
+            String::from_str(" toast toast "));
+        assert_eq!(" test test ".replace(test, ""), String::from_str("   "));
     }
 
     #[test]
@@ -1285,7 +1290,7 @@ fn half_a_million_letter_x() -> String {
         }
         let letters = a_million_letter_x();
         assert!(half_a_million_letter_x() ==
-            letters.as_slice().slice(0u, 3u * 500000u).to_string());
+            String::from_str(letters.as_slice().slice(0u, 3u * 500000u)));
     }
 
     #[test]
@@ -1513,7 +1518,7 @@ fn test_raw_from_c_str() {
             let a = vec![65, 65, 65, 65, 65, 65, 65, 0];
             let b = a.as_ptr();
             let c = raw::from_c_str(b);
-            assert_eq!(c, "AAAAAAA".to_string());
+            assert_eq!(c, String::from_str("AAAAAAA"));
         }
     }
 
@@ -1535,7 +1540,7 @@ fn test_as_bytes() {
     fn test_as_bytes_fail() {
         // Don't double free. (I'm not sure if this exercises the
         // original problem code path anymore.)
-        let s = "".to_string();
+        let s = String::from_str("");
         let _bytes = s.as_bytes();
         fail!();
     }
@@ -1578,10 +1583,10 @@ fn test_subslice_offset_2() {
 
     #[test]
     fn vec_str_conversions() {
-        let s1: String = "All mimsy were the borogoves".to_string();
+        let s1: String = String::from_str("All mimsy were the borogoves");
 
         let v: Vec<u8> = Vec::from_slice(s1.as_bytes());
-        let s2: String = from_utf8(v.as_slice()).unwrap().to_string();
+        let s2: String = String::from_str(from_utf8(v.as_slice()).unwrap());
         let mut i: uint = 0u;
         let n1: uint = s1.len();
         let n2: uint = v.len();
@@ -1624,13 +1629,13 @@ fn test_contains_char() {
     #[test]
     fn test_utf16() {
         let pairs =
-            [("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n".to_string(),
+            [(String::from_str("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
               vec![0xd800_u16, 0xdf45_u16, 0xd800_u16, 0xdf3f_u16,
                 0xd800_u16, 0xdf3b_u16, 0xd800_u16, 0xdf46_u16,
                 0xd800_u16, 0xdf39_u16, 0xd800_u16, 0xdf3b_u16,
                 0xd800_u16, 0xdf30_u16, 0x000a_u16]),
 
-             ("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n".to_string(),
+             (String::from_str("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
               vec![0xd801_u16, 0xdc12_u16, 0xd801_u16,
                 0xdc49_u16, 0xd801_u16, 0xdc2e_u16, 0xd801_u16,
                 0xdc40_u16, 0xd801_u16, 0xdc32_u16, 0xd801_u16,
@@ -1638,7 +1643,7 @@ fn test_utf16() {
                 0xd801_u16, 0xdc32_u16, 0xd801_u16, 0xdc4d_u16,
                 0x000a_u16]),
 
-             ("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n".to_string(),
+             (String::from_str("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
               vec![0xd800_u16, 0xdf00_u16, 0xd800_u16, 0xdf16_u16,
                 0xd800_u16, 0xdf0b_u16, 0xd800_u16, 0xdf04_u16,
                 0xd800_u16, 0xdf11_u16, 0xd800_u16, 0xdf09_u16,
@@ -1647,7 +1652,7 @@ fn test_utf16() {
                 0xdf04_u16, 0xd800_u16, 0xdf0b_u16, 0xd800_u16,
                 0xdf09_u16, 0xd800_u16, 0xdf11_u16, 0x000a_u16 ]),
 
-             ("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n".to_string(),
+             (String::from_str("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
               vec![0xd801_u16, 0xdc8b_u16, 0xd801_u16, 0xdc98_u16,
                 0xd801_u16, 0xdc88_u16, 0xd801_u16, 0xdc91_u16,
                 0xd801_u16, 0xdc9b_u16, 0xd801_u16, 0xdc92_u16,
@@ -1660,7 +1665,7 @@ fn test_utf16() {
                 0xd801_u16, 0xdc95_u16, 0xd801_u16, 0xdc86_u16,
                 0x000a_u16 ]),
              // Issue #12318, even-numbered non-BMP planes
-             ("\U00020000".to_string(),
+             (String::from_str("\U00020000"),
               vec![0xD840, 0xDC00])];
 
         for p in pairs.iter() {
@@ -1698,16 +1703,16 @@ fn test_utf16_invalid() {
     fn test_utf16_lossy() {
         // completely positive cases tested above.
         // lead + eof
-        assert_eq!(from_utf16_lossy([0xD800]), "\uFFFD".to_string());
+        assert_eq!(from_utf16_lossy([0xD800]), String::from_str("\uFFFD"));
         // lead + lead
-        assert_eq!(from_utf16_lossy([0xD800, 0xD800]), "\uFFFD\uFFFD".to_string());
+        assert_eq!(from_utf16_lossy([0xD800, 0xD800]), String::from_str("\uFFFD\uFFFD"));
 
         // isolated trail
-        assert_eq!(from_utf16_lossy([0x0061, 0xDC00]), "a\uFFFD".to_string());
+        assert_eq!(from_utf16_lossy([0x0061, 0xDC00]), String::from_str("a\uFFFD"));
 
         // general
         assert_eq!(from_utf16_lossy([0xD800, 0xd801, 0xdc8b, 0xD800]),
-                   "\uFFFD𐒋\uFFFD".to_string());
+                   String::from_str("\uFFFD𐒋\uFFFD"));
     }
 
     #[test]
@@ -1752,27 +1757,29 @@ fn test_char_at_reverse() {
 
     #[test]
     fn test_escape_unicode() {
-        assert_eq!("abc".escape_unicode(), "\\x61\\x62\\x63".to_string());
-        assert_eq!("a c".escape_unicode(), "\\x61\\x20\\x63".to_string());
-        assert_eq!("\r\n\t".escape_unicode(), "\\x0d\\x0a\\x09".to_string());
-        assert_eq!("'\"\\".escape_unicode(), "\\x27\\x22\\x5c".to_string());
-        assert_eq!("\x00\x01\xfe\xff".escape_unicode(), "\\x00\\x01\\xfe\\xff".to_string());
-        assert_eq!("\u0100\uffff".escape_unicode(), "\\u0100\\uffff".to_string());
-        assert_eq!("\U00010000\U0010ffff".escape_unicode(), "\\U00010000\\U0010ffff".to_string());
-        assert_eq!("ab\ufb00".escape_unicode(), "\\x61\\x62\\ufb00".to_string());
-        assert_eq!("\U0001d4ea\r".escape_unicode(), "\\U0001d4ea\\x0d".to_string());
+        assert_eq!("abc".escape_unicode(), String::from_str("\\x61\\x62\\x63"));
+        assert_eq!("a c".escape_unicode(), String::from_str("\\x61\\x20\\x63"));
+        assert_eq!("\r\n\t".escape_unicode(), String::from_str("\\x0d\\x0a\\x09"));
+        assert_eq!("'\"\\".escape_unicode(), String::from_str("\\x27\\x22\\x5c"));
+        assert_eq!("\x00\x01\xfe\xff".escape_unicode(), String::from_str("\\x00\\x01\\xfe\\xff"));
+        assert_eq!("\u0100\uffff".escape_unicode(), String::from_str("\\u0100\\uffff"));
+        assert_eq!("\U00010000\U0010ffff".escape_unicode(),
+                   String::from_str("\\U00010000\\U0010ffff"));
+        assert_eq!("ab\ufb00".escape_unicode(), String::from_str("\\x61\\x62\\ufb00"));
+        assert_eq!("\U0001d4ea\r".escape_unicode(), String::from_str("\\U0001d4ea\\x0d"));
     }
 
     #[test]
     fn test_escape_default() {
-        assert_eq!("abc".escape_default(), "abc".to_string());
-        assert_eq!("a c".escape_default(), "a c".to_string());
-        assert_eq!("\r\n\t".escape_default(), "\\r\\n\\t".to_string());
-        assert_eq!("'\"\\".escape_default(), "\\'\\\"\\\\".to_string());
-        assert_eq!("\u0100\uffff".escape_default(), "\\u0100\\uffff".to_string());
-        assert_eq!("\U00010000\U0010ffff".escape_default(), "\\U00010000\\U0010ffff".to_string());
-        assert_eq!("ab\ufb00".escape_default(), "ab\\ufb00".to_string());
-        assert_eq!("\U0001d4ea\r".escape_default(), "\\U0001d4ea\\r".to_string());
+        assert_eq!("abc".escape_default(), String::from_str("abc"));
+        assert_eq!("a c".escape_default(), String::from_str("a c"));
+        assert_eq!("\r\n\t".escape_default(), String::from_str("\\r\\n\\t"));
+        assert_eq!("'\"\\".escape_default(), String::from_str("\\'\\\"\\\\"));
+        assert_eq!("\u0100\uffff".escape_default(), String::from_str("\\u0100\\uffff"));
+        assert_eq!("\U00010000\U0010ffff".escape_default(),
+                   String::from_str("\\U00010000\\U0010ffff"));
+        assert_eq!("ab\ufb00".escape_default(), String::from_str("ab\\ufb00"));
+        assert_eq!("\U0001d4ea\r".escape_default(), String::from_str("\\U0001d4ea\\r"));
     }
 
     #[test]
@@ -2013,30 +2020,39 @@ fn test_words() {
 
     #[test]
     fn test_nfd_chars() {
-        assert_eq!("abc".nfd_chars().collect::<String>(), "abc".to_string());
-        assert_eq!("\u1e0b\u01c4".nfd_chars().collect::<String>(), "d\u0307\u01c4".to_string());
-        assert_eq!("\u2026".nfd_chars().collect::<String>(), "\u2026".to_string());
-        assert_eq!("\u2126".nfd_chars().collect::<String>(), "\u03a9".to_string());
-        assert_eq!("\u1e0b\u0323".nfd_chars().collect::<String>(), "d\u0323\u0307".to_string());
-        assert_eq!("\u1e0d\u0307".nfd_chars().collect::<String>(), "d\u0323\u0307".to_string());
-        assert_eq!("a\u0301".nfd_chars().collect::<String>(), "a\u0301".to_string());
-        assert_eq!("\u0301a".nfd_chars().collect::<String>(), "\u0301a".to_string());
-        assert_eq!("\ud4db".nfd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_string());
-        assert_eq!("\uac1c".nfd_chars().collect::<String>(), "\u1100\u1162".to_string());
+        assert_eq!("abc".nfd_chars().collect::<String>(), String::from_str("abc"));
+        assert_eq!("\u1e0b\u01c4".nfd_chars().collect::<String>(),
+                   String::from_str("d\u0307\u01c4"));
+        assert_eq!("\u2026".nfd_chars().collect::<String>(), String::from_str("\u2026"));
+        assert_eq!("\u2126".nfd_chars().collect::<String>(), String::from_str("\u03a9"));
+        assert_eq!("\u1e0b\u0323".nfd_chars().collect::<String>(),
+                   String::from_str("d\u0323\u0307"));
+        assert_eq!("\u1e0d\u0307".nfd_chars().collect::<String>(),
+                   String::from_str("d\u0323\u0307"));
+        assert_eq!("a\u0301".nfd_chars().collect::<String>(), String::from_str("a\u0301"));
+        assert_eq!("\u0301a".nfd_chars().collect::<String>(), String::from_str("\u0301a"));
+        assert_eq!("\ud4db".nfd_chars().collect::<String>(),
+                   String::from_str("\u1111\u1171\u11b6"));
+        assert_eq!("\uac1c".nfd_chars().collect::<String>(), String::from_str("\u1100\u1162"));
     }
 
     #[test]
     fn test_nfkd_chars() {
-        assert_eq!("abc".nfkd_chars().collect::<String>(), "abc".to_string());
-        assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::<String>(), "d\u0307DZ\u030c".to_string());
-        assert_eq!("\u2026".nfkd_chars().collect::<String>(), "...".to_string());
-        assert_eq!("\u2126".nfkd_chars().collect::<String>(), "\u03a9".to_string());
-        assert_eq!("\u1e0b\u0323".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_string());
-        assert_eq!("\u1e0d\u0307".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_string());
-        assert_eq!("a\u0301".nfkd_chars().collect::<String>(), "a\u0301".to_string());
-        assert_eq!("\u0301a".nfkd_chars().collect::<String>(), "\u0301a".to_string());
-        assert_eq!("\ud4db".nfkd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_string());
-        assert_eq!("\uac1c".nfkd_chars().collect::<String>(), "\u1100\u1162".to_string());
+        assert_eq!("abc".nfkd_chars().collect::<String>(), String::from_str("abc"));
+        assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::<String>(),
+                   String::from_str("d\u0307DZ\u030c"));
+        assert_eq!("\u2026".nfkd_chars().collect::<String>(), String::from_str("..."));
+        assert_eq!("\u2126".nfkd_chars().collect::<String>(), String::from_str("\u03a9"));
+        assert_eq!("\u1e0b\u0323".nfkd_chars().collect::<String>(),
+                   String::from_str("d\u0323\u0307"));
+        assert_eq!("\u1e0d\u0307".nfkd_chars().collect::<String>(),
+                   String::from_str("d\u0323\u0307"));
+        assert_eq!("a\u0301".nfkd_chars().collect::<String>(), String::from_str("a\u0301"));
+        assert_eq!("\u0301a".nfkd_chars().collect::<String>(),
+                   String::from_str("\u0301a"));
+        assert_eq!("\ud4db".nfkd_chars().collect::<String>(),
+String::from_str("\u1111\u1171\u11b6"));
+        assert_eq!("\uac1c".nfkd_chars().collect::<String>(), String::from_str("\u1100\u1162"));
     }
 
     #[test]
@@ -2090,10 +2106,10 @@ fn sum_len<S: Collection>(v: &[S]) -> uint {
             v.iter().map(|x| x.len()).sum()
         }
 
-        let s = "01234".to_string();
+        let s = String::from_str("01234");
         assert_eq!(5, sum_len(["012", "", "34"]));
-        assert_eq!(5, sum_len(["01".to_string(), "2".to_string(),
-                               "34".to_string(), "".to_string()]));
+        assert_eq!(5, sum_len([String::from_str("01"), String::from_str("2"),
+                               String::from_str("34"), String::from_str("")]));
         assert_eq!(5, sum_len([s.as_slice()]));
     }
 
@@ -2112,10 +2128,10 @@ fn test_str_from_utf8() {
     #[test]
     fn test_str_from_utf8_owned() {
         let xs = Vec::from_slice(b"hello");
-        assert_eq!(from_utf8_owned(xs), Ok("hello".to_string()));
+        assert_eq!(from_utf8_owned(xs), Ok(String::from_str("hello")));
 
         let xs = Vec::from_slice("ศไทย中华Việt Nam".as_bytes());
-        assert_eq!(from_utf8_owned(xs), Ok("ศไทย中华Việt Nam".to_string()));
+        assert_eq!(from_utf8_owned(xs), Ok(String::from_str("ศไทย中华Việt Nam")));
 
         let xs = Vec::from_slice(b"hello\xFF");
         assert_eq!(from_utf8_owned(xs),
@@ -2131,34 +2147,30 @@ fn test_str_from_utf8_lossy() {
         assert_eq!(from_utf8_lossy(xs), Slice("ศไทย中华Việt Nam"));
 
         let xs = b"Hello\xC2 There\xFF Goodbye";
-        assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD There\uFFFD Goodbye".to_string()));
+        assert_eq!(from_utf8_lossy(xs), Owned(String::from_str("Hello\uFFFD There\uFFFD Goodbye")));
 
         let xs = b"Hello\xC0\x80 There\xE6\x83 Goodbye";
-        assert_eq!(from_utf8_lossy(xs), Owned("Hello\uFFFD\uFFFD There\uFFFD Goodbye".to_string()));
+        assert_eq!(from_utf8_lossy(xs),
+                   Owned(String::from_str("Hello\uFFFD\uFFFD There\uFFFD Goodbye")));
 
         let xs = b"\xF5foo\xF5\x80bar";
-        assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFD\uFFFDbar".to_string()));
+        assert_eq!(from_utf8_lossy(xs), Owned(String::from_str("\uFFFDfoo\uFFFD\uFFFDbar")));
 
         let xs = b"\xF1foo\xF1\x80bar\xF1\x80\x80baz";
-        assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFDbaz".to_string()));
+        assert_eq!(from_utf8_lossy(xs), Owned(String::from_str("\uFFFDfoo\uFFFDbar\uFFFDbaz")));
 
         let xs = b"\xF4foo\xF4\x80bar\xF4\xBFbaz";
-        assert_eq!(from_utf8_lossy(xs), Owned("\uFFFDfoo\uFFFDbar\uFFFD\uFFFDbaz".to_string()));
+        assert_eq!(from_utf8_lossy(xs),
+                   Owned(String::from_str("\uFFFDfoo\uFFFDbar\uFFFD\uFFFDbaz")));
 
         let xs = b"\xF0\x80\x80\x80foo\xF0\x90\x80\x80bar";
-        assert_eq!(from_utf8_lossy(xs), Owned("\uFFFD\uFFFD\uFFFD\uFFFD\
-                                               foo\U00010000bar".to_string()));
+        assert_eq!(from_utf8_lossy(xs), Owned(String::from_str("\uFFFD\uFFFD\uFFFD\uFFFD\
+                                               foo\U00010000bar")));
 
         // surrogates
         let xs = b"\xED\xA0\x80foo\xED\xBF\xBFbar";
-        assert_eq!(from_utf8_lossy(xs), Owned("\uFFFD\uFFFD\uFFFDfoo\
-                                               \uFFFD\uFFFD\uFFFDbar".to_string()));
-    }
-
-    #[test]
-    fn test_from_str() {
-      let owned: Option<::std::string::String> = from_str("string");
-      assert_eq!(owned.as_ref().map(|s| s.as_slice()), Some("string"));
+        assert_eq!(from_utf8_lossy(xs), Owned(String::from_str("\uFFFD\uFFFD\uFFFDfoo\
+                                               \uFFFD\uFFFD\uFFFDbar")));
     }
 
     #[test]
@@ -2166,18 +2178,18 @@ fn test_maybe_owned_traits() {
         let s = Slice("abcde");
         assert_eq!(s.len(), 5);
         assert_eq!(s.as_slice(), "abcde");
-        assert_eq!(s.to_str().as_slice(), "abcde");
+        assert_eq!(String::from_str(s.as_slice()).as_slice(), "abcde");
         assert_eq!(format!("{}", s).as_slice(), "abcde");
-        assert!(s.lt(&Owned("bcdef".to_string())));
+        assert!(s.lt(&Owned(String::from_str("bcdef"))));
         assert_eq!(Slice(""), Default::default());
 
-        let o = Owned("abcde".to_string());
+        let o = Owned(String::from_str("abcde"));
         assert_eq!(o.len(), 5);
         assert_eq!(o.as_slice(), "abcde");
-        assert_eq!(o.to_str().as_slice(), "abcde");
+        assert_eq!(String::from_str(o.as_slice()).as_slice(), "abcde");
         assert_eq!(format!("{}", o).as_slice(), "abcde");
         assert!(o.lt(&Slice("bcdef")));
-        assert_eq!(Owned("".to_string()), Default::default());
+        assert_eq!(Owned(String::from_str("")), Default::default());
 
         assert!(s.cmp(&o) == Equal);
         assert!(s.equiv(&o));
@@ -2192,31 +2204,33 @@ fn test_maybe_owned_methods() {
         assert!(s.is_slice());
         assert!(!s.is_owned());
 
-        let o = Owned("abcde".to_string());
+        let o = Owned(String::from_str("abcde"));
         assert!(!o.is_slice());
         assert!(o.is_owned());
     }
 
     #[test]
     fn test_maybe_owned_clone() {
-        assert_eq!(Owned("abcde".to_string()), Slice("abcde").clone());
-        assert_eq!(Owned("abcde".to_string()), Owned("abcde".to_string()).clone());
+        assert_eq!(Owned(String::from_str("abcde")), Slice("abcde").clone());
+        assert_eq!(Owned(String::from_str("abcde")), Owned(String::from_str("abcde")).clone());
         assert_eq!(Slice("abcde"), Slice("abcde").clone());
-        assert_eq!(Slice("abcde"), Owned("abcde".to_string()).clone());
+        assert_eq!(Slice("abcde"), Owned(String::from_str("abcde")).clone());
     }
 
     #[test]
     fn test_maybe_owned_into_string() {
-        assert_eq!(Slice("abcde").into_string(), "abcde".to_string());
-        assert_eq!(Owned("abcde".to_string()).into_string(), "abcde".to_string());
+        assert_eq!(Slice("abcde").into_string(), String::from_str("abcde"));
+        assert_eq!(Owned(String::from_str("abcde")).into_string(),
+                   String::from_str("abcde"));
     }
 
     #[test]
     fn test_into_maybe_owned() {
         assert_eq!("abcde".into_maybe_owned(), Slice("abcde"));
-        assert_eq!(("abcde".to_string()).into_maybe_owned(), Slice("abcde"));
-        assert_eq!("abcde".into_maybe_owned(), Owned("abcde".to_string()));
-        assert_eq!(("abcde".to_string()).into_maybe_owned(), Owned("abcde".to_string()));
+        assert_eq!((String::from_str("abcde")).into_maybe_owned(), Slice("abcde"));
+        assert_eq!("abcde".into_maybe_owned(), Owned(String::from_str("abcde")));
+        assert_eq!((String::from_str("abcde")).into_maybe_owned(),
+                   Owned(String::from_str("abcde")));
     }
 }
 
@@ -2224,7 +2238,10 @@ fn test_into_maybe_owned() {
 mod bench {
     use test::Bencher;
     use super::*;
-    use std::prelude::*;
+    use vec::Vec;
+    use std::iter::{Iterator, DoubleEndedIterator};
+    use std::collections::Collection;
+    use std::slice::Vector;
 
     #[bench]
     fn char_iterator(b: &mut Bencher) {
index e1467d957d710398d04e4af952e749944caa18b3..74b9465f2a5690c560837f70598e63fbc03e5ee9 100644 (file)
@@ -354,7 +354,7 @@ fn equiv(&self, other: &S) -> bool {
 
 impl<S: Str> Add<S, String> for String {
     fn add(&self, other: &S) -> String {
-        let mut s = self.to_string();
+        let mut s = String::from_str(self.as_slice());
         s.push_str(other.as_slice());
         return s;
     }
@@ -369,6 +369,12 @@ mod tests {
     use str::{Str, StrSlice};
     use super::String;
 
+    #[test]
+    fn test_from_str() {
+      let owned: Option<::std::string::String> = from_str("string");
+      assert_eq!(owned.as_ref().map(|s| s.as_slice()), Some("string"));
+    }
+
     #[bench]
     fn bench_with_capacity(b: &mut Bencher) {
         b.iter(|| {
index f326195be1607f270e6283c4a0830b6c9816b563..ef5b51fd00b3f5a6894db5356f68371fac385d98 100644 (file)
@@ -70,7 +70,7 @@ pub enum SignFormat {
 /**
  * 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
index 852edd90b0f3fb28ecb6ad4b574dce7fe2079d50..5393c207344348a9e7575b91ed9f652ddbee3470 100644 (file)
@@ -167,12 +167,6 @@ fn string(c: char) -> String {
     assert_eq!(s.as_slice(), "\\U0001d4b6");
 }
 
-#[test]
-fn test_to_str() {
-    let s = 't'.to_str();
-    assert_eq!(s.as_slice(), "t");
-}
-
 #[test]
 fn test_encode_utf8() {
     fn check(input: char, expect: &[u8]) {
index 4087cb952716831fa3a55215e8a3538024b0392e..0b04a07ea888af5a667fa1ad61015c0382141c5d 100644 (file)
@@ -45,7 +45,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             // If we have a specified width for formatting, then we have to make
             // this allocation of a new string
             _ => {
-                let s = repr::repr_to_str(self);
+                let s = repr::repr_to_string(self);
                 f.pad(s.as_slice())
             }
         }
index 133353ec3d717a09a9225a332d77ae0e5b61f55a..3e541929dbf0883957cd74cd4f5046d1a52882f8 100644 (file)
@@ -73,7 +73,7 @@ fn write_repr(&self, writer: &mut io::Writer) -> io::IoResult<()> {
 
 macro_rules! num_repr(($ty:ident, $suffix:expr) => (impl Repr for $ty {
     fn write_repr(&self, writer: &mut io::Writer) -> io::IoResult<()> {
-        let s = self.to_str();
+        let s = self.to_string();
         writer.write(s.as_bytes()).and_then(|()| {
             writer.write($suffix)
         })
@@ -564,7 +564,7 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
     }
 }
 
-pub fn repr_to_str<T>(t: &T) -> String {
+pub fn repr_to_string<T>(t: &T) -> String {
     let mut result = io::MemWriter::new();
     write_repr(&mut result as &mut io::Writer, t).unwrap();
     String::from_utf8(result.unwrap()).unwrap()
index 790df13c1ffbf57a30f2c82031d79f784aed7ee7..bb3e90958f14229d266bfc986be70ba7d89e1952 100644 (file)
@@ -59,7 +59,7 @@
 //!     ];
 //!     let matches = match getopts(args.tail(), opts) {
 //!         Ok(m) => { m }
-//!         Err(f) => { fail!(f.to_str()) }
+//!         Err(f) => { fail!(f.to_string()) }
 //!     };
 //!     if matches.opt_present("h") {
 //!         print_usage(program.as_slice(), opts);
@@ -222,9 +222,9 @@ fn from_str(nm: &str) -> Name {
         }
     }
 
-    fn to_str(&self) -> String {
+    fn to_string(&self) -> String {
         match *self {
-            Short(ch) => ch.to_str(),
+            Short(ch) => ch.to_string(),
             Long(ref s) => s.to_string()
         }
     }
@@ -501,7 +501,7 @@ impl Fail_ {
     /// Convert a `Fail_` enum into an error string.
     #[deprecated="use `Show` (`{}` format specifier)"]
     pub fn to_err_msg(self) -> String {
-        self.to_str()
+        self.to_string()
     }
 }
 
@@ -609,12 +609,12 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
                 name_pos += 1;
                 let optid = match find_opt(opts.as_slice(), (*nm).clone()) {
                   Some(id) => id,
-                  None => return Err(UnrecognizedOption(nm.to_str()))
+                  None => return Err(UnrecognizedOption(nm.to_string()))
                 };
                 match opts.get(optid).hasarg {
                   No => {
                     if !i_arg.is_none() {
-                        return Err(UnexpectedArgument(nm.to_str()));
+                        return Err(UnexpectedArgument(nm.to_string()));
                     }
                     vals.get_mut(optid).push(Given);
                   }
@@ -635,7 +635,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
                     if !i_arg.is_none() {
                         vals.get_mut(optid).push(Val(i_arg.clone().unwrap()));
                     } else if i + 1 == l {
-                        return Err(ArgumentMissing(nm.to_str()));
+                        return Err(ArgumentMissing(nm.to_string()));
                     } else {
                         i += 1;
                         vals.get_mut(optid).push(Val(args[i].clone()));
@@ -652,12 +652,12 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
         let occ = opts.get(i).occur;
         if occ == Req {
             if n == 0 {
-                return Err(OptionMissing(opts.get(i).name.to_str()));
+                return Err(OptionMissing(opts.get(i).name.to_string()));
             }
         }
         if occ != Multi {
             if n > 1 {
-                return Err(OptionDuplicated(opts.get(i).name.to_str()));
+                return Err(OptionDuplicated(opts.get(i).name.to_string()));
             }
         }
         i += 1;
index 6aa48dc748ec0d0bf01c162985b6d1e0a628b7ea..668000b2db42caab6e71356ff1a6f937ba6059d7 100644 (file)
@@ -703,11 +703,11 @@ fn test_range_pattern() {
         for &p in pats.iter() {
             let pat = Pattern::new(p);
             for c in "abcdefghijklmnopqrstuvwxyz".chars() {
-                assert!(pat.matches(c.to_str().as_slice()));
+                assert!(pat.matches(c.to_string().as_slice()));
             }
             for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars() {
                 let options = MatchOptions {case_sensitive: false, .. MatchOptions::new()};
-                assert!(pat.matches_with(c.to_str().as_slice(), options));
+                assert!(pat.matches_with(c.to_string().as_slice(), options));
             }
             assert!(pat.matches("1"));
             assert!(pat.matches("2"));
index 52990bae55433f31368b515c6a2e2de599bb647d..662722e08d96fe1e09e0a01974b046802628808d 100644 (file)
@@ -666,7 +666,7 @@ fn test_input(g: LabelledGraph) -> IoResult<String> {
         let mut writer = MemWriter::new();
         render(&g, &mut writer).unwrap();
         let mut r = BufReader::new(writer.get_ref());
-        match r.read_to_str() {
+        match r.read_to_string() {
             Ok(string) => Ok(string.to_string()),
             Err(err) => Err(err),
         }
@@ -768,7 +768,7 @@ fn left_aligned_text() {
 
         render(&g, &mut writer).unwrap();
         let mut r = BufReader::new(writer.get_ref());
-        let r = r.read_to_str();
+        let r = r.read_to_string();
 
         assert_eq!(r.unwrap().as_slice(),
 r#"digraph syntax_tree {
index 98553603313404382aafa07a63d726c28ef9b1a6..dbca4ff7ff719a9575a8dafe09c2b5adb629afc1 100644 (file)
@@ -259,7 +259,7 @@ pub fn to_utf16(s: &CString) -> IoResult<Vec<u16>> {
         None => Err(IoError {
             code: libc::ERROR_INVALID_NAME as uint,
             extra: 0,
-            detail: Some("valid unicode input required".to_str()),
+            detail: Some("valid unicode input required".to_string()),
         })
     }
 }
index b5b2065f996ed29d079807a1454c3f86f2763269..0e019fa7e8fbdadf7b04ea38dd5e09a22ba5edc1 100644 (file)
@@ -43,7 +43,7 @@ fn addr_to_sockaddr_un(addr: &CString) -> IoResult<(libc::sockaddr_storage, uint
         return Err(IoError {
             code: ERROR as uint,
             extra: 0,
-            detail: Some("path must be smaller than SUN_LEN".to_str()),
+            detail: Some("path must be smaller than SUN_LEN".to_string()),
         })
     }
     s.sun_family = libc::AF_UNIX as libc::sa_family_t;
index e5e8cdeffd7e4c2249b44d5a7f1db0fa2fee47f7..ec40ff89bd2cdb9fdf6d46576c80c8005d5abfc1 100644 (file)
@@ -479,7 +479,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
                             Err(IoError {
                                 code: libc::ERROR_OPERATION_ABORTED as uint,
                                 extra: amt,
-                                detail: Some("short write during write".to_str()),
+                                detail: Some("short write during write".to_string()),
                             })
                         } else {
                             Err(util::timeout("write timed out"))
index 6fab73115cf9a5e2dcd1ddf7847f2796b4f44e4d..71702d180b9e0efaffb630e01fcecb23803e1c65 100644 (file)
@@ -170,7 +170,7 @@ fn kill(&mut self, signum: int) -> IoResult<()> {
             Some(..) => return Err(IoError {
                 code: ERROR as uint,
                 extra: 0,
-                detail: Some("can't kill an exited process".to_str()),
+                detail: Some("can't kill an exited process".to_string()),
             }),
             None => {}
         }
@@ -301,7 +301,7 @@ fn spawn_process_os(cfg: ProcessConfig,
         return Err(IoError {
             code: libc::ERROR_CALL_NOT_IMPLEMENTED as uint,
             extra: 0,
-            detail: Some("unsupported gid/uid requested on windows".to_str()),
+            detail: Some("unsupported gid/uid requested on windows".to_string()),
         })
     }
 
index 31ba2223082d554325d66814aa8869500c566324..06046cc74cfd85d7828d92b2f0688756764bf57a 100644 (file)
@@ -30,7 +30,7 @@ pub fn timeout(desc: &'static str) -> IoError {
     IoError {
         code: ERROR as uint,
         extra: 0,
-        detail: Some(desc.to_str()),
+        detail: Some(desc.to_string()),
     }
 }
 
@@ -40,7 +40,7 @@ pub fn short_write(n: uint, desc: &'static str) -> IoError {
     IoError {
         code: ERROR as uint,
         extra: n,
-        detail: Some(desc.to_str()),
+        detail: Some(desc.to_string()),
     }
 }
 
index cc3753def59f4cc2a6ed98d1080f4a36fc33ae28..046ba96f45a38185e28770381c58094ca4713e77 100644 (file)
@@ -2737,7 +2737,7 @@ fn check(s: &str, ans: Option<int>) {
         // attempt to allocate a vector of size (-1u) == huge.
         let x: BigInt =
             from_str(format!("1{}", "0".repeat(36)).as_slice()).unwrap();
-        let _y = x.to_str();
+        let _y = x.to_string();
     }
 
     #[test]
@@ -2842,14 +2842,14 @@ fn fib_100(b: &mut Bencher) {
     }
 
     #[bench]
-    fn to_str(b: &mut Bencher) {
+    fn to_string(b: &mut Bencher) {
         let fac = factorial(100);
         let fib = fib(100);
         b.iter(|| {
-            fac.to_str();
+            fac.to_string();
         });
         b.iter(|| {
-            fib.to_str();
+            fib.to_string();
         });
     }
 
index 9ee80d283cf924621ac20309c075ea29d8fcf371..f4a3ac97a4ef762bca048dee50bab92cea967fc7 100644 (file)
@@ -347,9 +347,9 @@ fn test_neg() {
     }
 
     #[test]
-    fn test_to_str() {
+    fn test_to_string() {
         fn test(c : Complex64, s: String) {
-            assert_eq!(c.to_str(), s);
+            assert_eq!(c.to_string(), s);
         }
         test(_0_0i, "0+0i".to_string());
         test(_1_0i, "1+0i".to_string());
index 1792f282eca701a89faea064ac4dcf05795a8e1e..a279ede6fa5347d68b85d7251fb3ad20a4b43752 100644 (file)
@@ -17,6 +17,7 @@
 use std::from_str::FromStr;
 use std::num;
 use std::num::{Zero, One, ToStrRadix, FromStrRadix};
+
 use bigint::{BigInt, BigUint, Sign, Plus, Minus};
 
 /// Represents the ratio between 2 numbers.
@@ -603,7 +604,7 @@ fn test_recip() {
     fn test_to_from_str() {
         fn test(r: Rational, s: String) {
             assert_eq!(FromStr::from_str(s.as_slice()), Some(r));
-            assert_eq!(r.to_str(), s);
+            assert_eq!(r.to_string(), s);
         }
         test(_1, "1".to_string());
         test(_0, "0".to_string());
index c15b232d8e1323592920dc149c7e65252a9481e7..95ed334c5d4ec8eb91ef867cd32e191859b54f76 100644 (file)
@@ -87,7 +87,7 @@ fn native(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree])
     let re = match Regex::new(regex.as_slice()) {
         Ok(re) => re,
         Err(err) => {
-            cx.span_err(sp, err.to_str().as_slice());
+            cx.span_err(sp, err.to_string().as_slice());
             return DummyResult::any(sp)
         }
     };
@@ -621,11 +621,11 @@ fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option<String> {
     let regex = match entry.node {
         ast::ExprLit(lit) => {
             match lit.node {
-                ast::LitStr(ref s, _) => s.to_str(),
+                ast::LitStr(ref s, _) => s.to_string(),
                 _ => {
                     cx.span_err(entry.span, format!(
                         "expected string literal but got `{}`",
-                        pprust::lit_to_str(lit)).as_slice());
+                        pprust::lit_to_string(lit)).as_slice());
                     return None
                 }
             }
@@ -633,7 +633,7 @@ fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option<String> {
         _ => {
             cx.span_err(entry.span, format!(
                 "expected string literal but got `{}`",
-                pprust::expr_to_str(entry)).as_slice());
+                pprust::expr_to_string(entry)).as_slice());
             return None
         }
     };
index f1856850701b27995c107e26572475ebca369de2..4f915342ee0eebe37759ede1a15e9cac670a4a31 100644 (file)
@@ -773,7 +773,7 @@ pub fn mangle_exported_name(ccx: &CrateContext, path: PathElems,
 pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
                                             t: ty::t,
                                             name: &str) -> String {
-    let s = ppaux::ty_to_str(ccx.tcx(), t);
+    let s = ppaux::ty_to_string(ccx.tcx(), t);
     let path = [PathName(token::intern(s.as_slice())),
                 gensym_name(name)];
     let hash = get_symbol_hash(ccx, t);
index 24b9ff970aa220a513447ba38ade1517da2b4917..324ed3b567ec44436b0d81166b3910b9fc95b0d9 100644 (file)
@@ -340,13 +340,13 @@ fn visit_mac(&mut self, macro: &Mac, e: E) {
                 // trees might be faster. Implementing this is far
                 // easier in short term.
                 let macro_defn_as_string =
-                    pprust::to_str(|pp_state| pp_state.print_mac(macro));
+                    pprust::to_string(|pp_state| pp_state.print_mac(macro));
                 macro_defn_as_string.hash(self.st);
             } else {
                 // It is not possible to observe any kind of macro
                 // invocation at this stage except `macro_rules!`.
                 fail!("reached macro somehow: {}",
-                      pprust::to_str(|pp_state| pp_state.print_mac(macro)));
+                      pprust::to_string(|pp_state| pp_state.print_mac(macro)));
             }
 
             visit::walk_mac(self, macro, e);
index 7e34ff2dbbde9ccb25c81ea3a3ea0b34a8307222..6a016edcd2868fce87671e901d207f62464ec2b5 100644 (file)
@@ -594,7 +594,7 @@ fn post(&self,
         match node {
             pprust::NodeItem(item) => {
                 try!(pp::space(&mut s.s));
-                s.synth_comment(item.id.to_str())
+                s.synth_comment(item.id.to_string())
             }
             pprust::NodeBlock(blk) => {
                 try!(pp::space(&mut s.s));
@@ -602,7 +602,7 @@ fn post(&self,
             }
             pprust::NodeExpr(expr) => {
                 try!(pp::space(&mut s.s));
-                try!(s.synth_comment(expr.id.to_str()));
+                try!(s.synth_comment(expr.id.to_string()));
                 s.pclose()
             }
             pprust::NodePat(pat) => {
@@ -636,7 +636,7 @@ fn post(&self,
                 try!(pp::word(&mut s.s, "as"));
                 try!(pp::space(&mut s.s));
                 try!(pp::word(&mut s.s,
-                              ppaux::ty_to_str(
+                              ppaux::ty_to_string(
                                   tcx,
                                   ty::expr_ty(tcx, expr)).as_slice()));
                 s.pclose()
index 807c2590566d91e4f2f7c7cacae554600cc55dd2..ad0d8cac1e3578fa8aebf0ec4d13d56b2a2aea3d 100644 (file)
@@ -251,7 +251,7 @@ pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
         match getopts::getopts(args.as_slice(), config::optgroups().as_slice()) {
             Ok(m) => m,
             Err(f) => {
-                early_error(f.to_str().as_slice());
+                early_error(f.to_string().as_slice());
             }
         };
 
@@ -450,7 +450,7 @@ fn monitor(f: proc():Send) {
                     emitter.emit(None, note.as_slice(), diagnostic::Note)
                 }
 
-                match r.read_to_str() {
+                match r.read_to_string() {
                     Ok(s) => println!("{}", s),
                     Err(e) => {
                         emitter.emit(None,
index b2c6840ad227292b5f61a6827b192e431190ad50..0860d111a9ef04a2f254bbf2de4b615856651cd2 100644 (file)
@@ -347,7 +347,7 @@ pub fn main() {
         span: DUMMY_SP,
      };
 
-    debug!("Synthetic test module:\n{}\n", pprust::item_to_str(&item));
+    debug!("Synthetic test module:\n{}\n", pprust::item_to_string(&item));
 
     box(GC) item
 }
index d07e74493be96dc4b82547a158860d7e68e3442e..a4425183cde64ad79f46fa646d43ab8aca5b3e3c 100644 (file)
@@ -1883,7 +1883,7 @@ pub fn find_type(&self, s: &str) -> Option<Type> {
         self.named_types.borrow().find_equiv(&s).map(|x| Type::from_ref(*x))
     }
 
-    pub fn type_to_str(&self, ty: Type) -> String {
+    pub fn type_to_string(&self, ty: Type) -> String {
         unsafe {
             let s = llvm::LLVMTypeToString(ty.to_ref());
             let ret = from_c_str(s);
@@ -1893,11 +1893,11 @@ pub fn type_to_str(&self, ty: Type) -> String {
     }
 
     pub fn types_to_str(&self, tys: &[Type]) -> String {
-        let strs: Vec<String> = tys.iter().map(|t| self.type_to_str(*t)).collect();
+        let strs: Vec<String> = tys.iter().map(|t| self.type_to_string(*t)).collect();
         format!("[{}]", strs.connect(","))
     }
 
-    pub fn val_to_str(&self, val: ValueRef) -> String {
+    pub fn val_to_string(&self, val: ValueRef) -> String {
         unsafe {
             let s = llvm::LLVMValueToString(val);
             let ret = from_c_str(s);
index 7b8026e32e024183cfd56b8e69343a39ebf25bc2..98a6f7d5ed38d2879255f6065f3c7510839e3179 100644 (file)
@@ -31,7 +31,7 @@
 use middle::typeck::astconv::ast_ty_to_ty;
 use middle::typeck::infer;
 use middle::{typeck, ty, def, pat_util, stability};
-use util::ppaux::{ty_to_str};
+use util::ppaux::{ty_to_string};
 use util::nodemap::NodeSet;
 use lint::{Context, LintPass, LintArray};
 
@@ -412,14 +412,14 @@ fn check_heap_type(&self, cx: &Context, span: Span, ty: ty::t) {
         });
 
         if n_uniq > 0 {
-            let s = ty_to_str(cx.tcx, ty);
+            let s = ty_to_string(cx.tcx, ty);
             let m = format!("type uses owned (Box type) pointers: {}", s);
             cx.span_lint(OWNED_HEAP_MEMORY, span, m.as_slice());
             cx.span_lint(HEAP_MEMORY, span, m.as_slice());
         }
 
         if n_box > 0 {
-            let s = ty_to_str(cx.tcx, ty);
+            let s = ty_to_string(cx.tcx, ty);
             let m = format!("type uses managed (@ type) pointers: {}", s);
             cx.span_lint(MANAGED_HEAP_MEMORY, span, m.as_slice());
             cx.span_lint(HEAP_MEMORY, span, m.as_slice());
index 79fbd73c23d3cbdbcffeef0ed299fcc604440657..61aaf068c1098bd06ce1e6e9c9433542bfc7e2a7 100644 (file)
@@ -666,7 +666,7 @@ pub fn check_crate(tcx: &ty::ctxt,
         for &(lint, span, ref msg) in v.iter() {
             tcx.sess.span_bug(span,
                               format!("unprocessed lint {} at {}: {}",
-                                      lint.as_str(), tcx.map.node_to_str(*id), *msg).as_slice())
+                                      lint.as_str(), tcx.map.node_to_string(*id), *msg).as_slice())
         }
     }
 
index 29566fb1e7cd1f0cf5d13e3e7d2dd2f1d70d447e..edf46c214ba63fa4b94757ab2dafc19f9fc91aed 100644 (file)
@@ -148,12 +148,12 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
                    ident, path_opt);
             let name = match *path_opt {
                 Some((ref path_str, _)) => {
-                    let name = path_str.get().to_str();
+                    let name = path_str.get().to_string();
                     validate_crate_name(Some(e.sess), name.as_slice(),
                                         Some(i.span));
                     name
                 }
-                None => ident.get().to_str(),
+                None => ident.get().to_string(),
             };
             Some(CrateInfo {
                 ident: ident.get().to_string(),
index f88c0d34ed83eebdf45eb7ce726e2fdf9e1df497..1cf420dd2f8cd655e8291c623cfcd2a641cc5e11 100644 (file)
@@ -1087,7 +1087,7 @@ fn list_crate_attributes(md: ebml::Doc, hash: &Svh,
 
     let r = get_attributes(md);
     for attr in r.iter() {
-        try!(write!(out, "{}\n", pprust::attribute_to_str(attr)));
+        try!(write!(out, "{}\n", pprust::attribute_to_string(attr)));
     }
 
     write!(out, "\n\n")
index 21713672f8149e82ab06ffce43dd4b2fb676e18b..a9208045d250ae4783becf936f8420ab51ac5fdb 100644 (file)
@@ -101,7 +101,7 @@ fn encode_impl_type_basename(ebml_w: &mut Encoder, name: Ident) {
 }
 
 pub fn encode_def_id(ebml_w: &mut Encoder, id: DefId) {
-    ebml_w.wr_tagged_str(tag_def_id, def_to_str(id).as_slice());
+    ebml_w.wr_tagged_str(tag_def_id, def_to_string(id).as_slice());
 }
 
 #[deriving(Clone)]
@@ -116,7 +116,7 @@ fn encode_trait_ref(ebml_w: &mut Encoder,
                     tag: uint) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
-        ds: def_to_str,
+        ds: def_to_string,
         tcx: ecx.tcx,
         abbrevs: &ecx.type_abbrevs
     };
@@ -141,7 +141,7 @@ fn encode_family(ebml_w: &mut Encoder, c: char) {
     ebml_w.end_tag();
 }
 
-pub fn def_to_str(did: DefId) -> String {
+pub fn def_to_string(did: DefId) -> String {
     format!("{}:{}", did.krate, did.node)
 }
 
@@ -151,7 +151,7 @@ fn encode_ty_type_param_defs(ebml_w: &mut Encoder,
                              tag: uint) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
-        ds: def_to_str,
+        ds: def_to_string,
         tcx: ecx.tcx,
         abbrevs: &ecx.type_abbrevs
     };
@@ -172,7 +172,7 @@ fn encode_region_param_defs(ebml_w: &mut Encoder,
         ebml_w.end_tag();
 
         ebml_w.wr_tagged_str(tag_region_param_def_def_id,
-                             def_to_str(param.def_id).as_slice());
+                             def_to_string(param.def_id).as_slice());
 
         ebml_w.wr_tagged_u64(tag_region_param_def_space,
                              param.space.to_uint() as u64);
@@ -204,7 +204,7 @@ fn encode_bounds_and_type(ebml_w: &mut Encoder,
 
 fn encode_variant_id(ebml_w: &mut Encoder, vid: DefId) {
     ebml_w.start_tag(tag_items_data_item_variant);
-    let s = def_to_str(vid);
+    let s = def_to_string(vid);
     ebml_w.writer.write(s.as_bytes());
     ebml_w.end_tag();
 }
@@ -214,7 +214,7 @@ pub fn write_type(ecx: &EncodeContext,
                   typ: ty::t) {
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
-        ds: def_to_str,
+        ds: def_to_string,
         tcx: ecx.tcx,
         abbrevs: &ecx.type_abbrevs
     };
@@ -236,7 +236,7 @@ fn encode_method_fty(ecx: &EncodeContext,
 
     let ty_str_ctxt = &tyencode::ctxt {
         diag: ecx.diag,
-        ds: def_to_str,
+        ds: def_to_string,
         tcx: ecx.tcx,
         abbrevs: &ecx.type_abbrevs
     };
@@ -266,14 +266,14 @@ fn encode_disr_val(_: &EncodeContext,
                    ebml_w: &mut Encoder,
                    disr_val: ty::Disr) {
     ebml_w.start_tag(tag_disr_val);
-    let s = disr_val.to_str();
+    let s = disr_val.to_string();
     ebml_w.writer.write(s.as_bytes());
     ebml_w.end_tag();
 }
 
 fn encode_parent_item(ebml_w: &mut Encoder, id: DefId) {
     ebml_w.start_tag(tag_items_data_parent_item);
-    let s = def_to_str(id);
+    let s = def_to_string(id);
     ebml_w.writer.write(s.as_bytes());
     ebml_w.end_tag();
 }
@@ -291,7 +291,7 @@ fn encode_struct_fields(ebml_w: &mut Encoder,
         encode_struct_field_family(ebml_w, f.vis);
         encode_def_id(ebml_w, f.id);
         ebml_w.start_tag(tag_item_field_origin);
-        let s = def_to_str(origin);
+        let s = def_to_string(origin);
         ebml_w.writer.write(s.as_bytes());
         ebml_w.end_tag();
         ebml_w.end_tag();
@@ -382,7 +382,7 @@ fn encode_reexported_static_method(ebml_w: &mut Encoder,
             exp.name, token::get_ident(method_ident));
     ebml_w.start_tag(tag_items_data_item_reexport);
     ebml_w.start_tag(tag_items_data_item_reexport_def_id);
-    ebml_w.wr_str(def_to_str(method_def_id).as_slice());
+    ebml_w.wr_str(def_to_string(method_def_id).as_slice());
     ebml_w.end_tag();
     ebml_w.start_tag(tag_items_data_item_reexport_name);
     ebml_w.wr_str(format!("{}::{}",
@@ -529,7 +529,7 @@ fn encode_reexports(ecx: &EncodeContext,
                        id);
                 ebml_w.start_tag(tag_items_data_item_reexport);
                 ebml_w.start_tag(tag_items_data_item_reexport_def_id);
-                ebml_w.wr_str(def_to_str(exp.def_id).as_slice());
+                ebml_w.wr_str(def_to_string(exp.def_id).as_slice());
                 ebml_w.end_tag();
                 ebml_w.start_tag(tag_items_data_item_reexport_name);
                 ebml_w.wr_str(exp.name.as_slice());
@@ -562,12 +562,12 @@ fn encode_info_for_mod(ecx: &EncodeContext,
     // Encode info about all the module children.
     for item in md.items.iter() {
         ebml_w.start_tag(tag_mod_child);
-        ebml_w.wr_str(def_to_str(local_def(item.id)).as_slice());
+        ebml_w.wr_str(def_to_string(local_def(item.id)).as_slice());
         ebml_w.end_tag();
 
         each_auxiliary_node_id(*item, |auxiliary_node_id| {
             ebml_w.start_tag(tag_mod_child);
-            ebml_w.wr_str(def_to_str(local_def(
+            ebml_w.wr_str(def_to_string(local_def(
                         auxiliary_node_id)).as_slice());
             ebml_w.end_tag();
             true
@@ -579,10 +579,10 @@ fn encode_info_for_mod(ecx: &EncodeContext,
                 debug!("(encoding info for module) ... encoding impl {} \
                         ({:?}/{:?})",
                         token::get_ident(ident),
-                        did, ecx.tcx.map.node_to_str(did));
+                        did, ecx.tcx.map.node_to_string(did));
 
                 ebml_w.start_tag(tag_mod_impl);
-                ebml_w.wr_str(def_to_str(local_def(did)).as_slice());
+                ebml_w.wr_str(def_to_string(local_def(did)).as_slice());
                 ebml_w.end_tag();
             }
             _ => {}
@@ -659,7 +659,7 @@ fn encode_provided_source(ebml_w: &mut Encoder,
                           source_opt: Option<DefId>) {
     for source in source_opt.iter() {
         ebml_w.start_tag(tag_item_method_provided_source);
-        let s = def_to_str(*source);
+        let s = def_to_string(*source);
         ebml_w.writer.write(s.as_bytes());
         ebml_w.end_tag();
     }
@@ -916,7 +916,7 @@ fn add_to_index(item: &Item, ebml_w: &Encoder,
     }
 
     debug!("encoding info for item at {}",
-           tcx.sess.codemap().span_to_str(item.span));
+           tcx.sess.codemap().span_to_string(item.span));
 
     let def_id = local_def(item.id);
     let stab = stability::lookup(tcx, ast_util::local_def(item.id));
@@ -987,7 +987,7 @@ fn add_to_index(item: &Item, ebml_w: &Encoder,
         // Encode all the items in this module.
         for foreign_item in fm.items.iter() {
             ebml_w.start_tag(tag_mod_child);
-            ebml_w.wr_str(def_to_str(local_def(foreign_item.id)).as_slice());
+            ebml_w.wr_str(def_to_string(local_def(foreign_item.id)).as_slice());
             ebml_w.end_tag();
         }
         encode_visibility(ebml_w, vis);
@@ -1111,7 +1111,7 @@ fn add_to_index(item: &Item, ebml_w: &Encoder,
         }
         for &method_def_id in methods.iter() {
             ebml_w.start_tag(tag_item_impl_method);
-            let s = def_to_str(method_def_id);
+            let s = def_to_string(method_def_id);
             ebml_w.writer.write(s.as_bytes());
             ebml_w.end_tag();
         }
@@ -1174,7 +1174,7 @@ fn add_to_index(item: &Item, ebml_w: &Encoder,
             ebml_w.end_tag();
 
             ebml_w.start_tag(tag_mod_child);
-            ebml_w.wr_str(def_to_str(method_def_id).as_slice());
+            ebml_w.wr_str(def_to_string(method_def_id).as_slice());
             ebml_w.end_tag();
         }
         encode_path(ebml_w, path.clone());
@@ -1327,7 +1327,7 @@ fn my_visit_foreign_item(ni: &ForeignItem,
     // See above
     let ecx: &EncodeContext = unsafe { mem::transmute(ecx_ptr) };
     debug!("writing foreign item {}::{}",
-            ecx.tcx.map.path_to_str(ni.id),
+            ecx.tcx.map.path_to_string(ni.id),
             token::get_ident(ni.ident));
 
     let mut ebml_w = unsafe {
@@ -1693,12 +1693,12 @@ fn encode_misc_info(ecx: &EncodeContext,
     ebml_w.start_tag(tag_misc_info_crate_items);
     for &item in krate.module.items.iter() {
         ebml_w.start_tag(tag_mod_child);
-        ebml_w.wr_str(def_to_str(local_def(item.id)).as_slice());
+        ebml_w.wr_str(def_to_string(local_def(item.id)).as_slice());
         ebml_w.end_tag();
 
         each_auxiliary_node_id(item, |auxiliary_node_id| {
             ebml_w.start_tag(tag_mod_child);
-            ebml_w.wr_str(def_to_str(local_def(
+            ebml_w.wr_str(def_to_string(local_def(
                         auxiliary_node_id)).as_slice());
             ebml_w.end_tag();
             true
@@ -1939,7 +1939,7 @@ pub fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> String {
     let mut wr = MemWriter::new();
     tyencode::enc_ty(&mut wr, &tyencode::ctxt {
         diag: tcx.sess.diagnostic(),
-        ds: def_to_str,
+        ds: def_to_string,
         tcx: tcx,
         abbrevs: &RefCell::new(HashMap::new())
     }, t);
index d7a7d2902b49153b87d489896d3f113071062f5c..11b1687dc55999163defd6f49b10f3e731c0d5a2 100644 (file)
@@ -28,7 +28,7 @@
 use middle::subst::VecPerParamSpace;
 use middle::typeck::{MethodCall, MethodCallee, MethodOrigin};
 use middle::{ty, typeck};
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 use syntax::{ast, ast_map, ast_util, codemap, fold};
 use syntax::codemap::Span;
@@ -86,7 +86,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
         e::IIMethodRef(_, _, m) => m.id,
     };
     debug!("> Encoding inlined item: {} ({})",
-           ecx.tcx.map.path_to_str(id),
+           ecx.tcx.map.path_to_string(id),
            ebml_w.writer.tell());
 
     let ii = simplify_ast(ii);
@@ -99,7 +99,7 @@ pub fn encode_inlined_item(ecx: &e::EncodeContext,
     ebml_w.end_tag();
 
     debug!("< Encoded inlined fn: {} ({})",
-           ecx.tcx.map.path_to_str(id),
+           ecx.tcx.map.path_to_string(id),
            ebml_w.writer.tell());
 }
 
@@ -119,7 +119,7 @@ pub fn decode_inlined_item(cdata: &cstore::crate_metadata,
         debug!("> Decoding inlined fn: {}::?",
         {
             // Do an Option dance to use the path after it is moved below.
-            let s = ast_map::path_to_str(ast_map::Values(path.iter()));
+            let s = ast_map::path_to_string(ast_map::Values(path.iter()));
             path_as_str = Some(s);
             path_as_str.as_ref().map(|x| x.as_slice())
         });
@@ -147,7 +147,7 @@ pub fn decode_inlined_item(cdata: &cstore::crate_metadata,
         match ii {
           ast::IIItem(i) => {
             debug!(">>> DECODED ITEM >>>\n{}\n<<< DECODED ITEM <<<",
-                   syntax::print::pprust::item_to_str(&*i));
+                   syntax::print::pprust::item_to_string(&*i));
           }
           _ => { }
         }
@@ -826,7 +826,7 @@ impl<'a> get_ty_str_ctxt for e::EncodeContext<'a> {
     fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a> {
         tyencode::ctxt {
             diag: self.tcx.sess.diagnostic(),
-            ds: e::def_to_str,
+            ds: e::def_to_string,
             tcx: self.tcx,
             abbrevs: &self.type_abbrevs
         }
@@ -1391,7 +1391,7 @@ fn decode_side_tables(xcx: &ExtendedDecodeContext,
                     c::tag_table_node_type => {
                         let ty = val_dsr.read_ty(xcx);
                         debug!("inserting ty for node {:?}: {}",
-                               id, ty_to_str(dcx.tcx, ty));
+                               id, ty_to_string(dcx.tcx, ty));
                         dcx.tcx.node_types.borrow_mut().insert(id as uint, ty);
                     }
                     c::tag_table_item_subst => {
@@ -1561,7 +1561,7 @@ fn new_int_alist<B>() -> alist<int, B> {
     ).unwrap());
     match (item_out, item_exp) {
       (ast::IIItem(item_out), ast::IIItem(item_exp)) => {
-        assert!(pprust::item_to_str(item_out) == pprust::item_to_str(item_exp));
+        assert!(pprust::item_to_string(item_out) == pprust::item_to_string(item_exp));
       }
       _ => fail!()
     }
index df208b9cdc133f85f352a0a3a60dec63e8433968..db8ab8c83fbdc78ae18f20bdb60d96bb08ae431a 100644 (file)
@@ -351,7 +351,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                 "it".to_string()
             } else {
                 format!("`{}`",
-                        self.bccx.loan_path_to_str(&*old_loan.loan_path))
+                        self.bccx.loan_path_to_string(&*old_loan.loan_path))
             };
 
             match (new_loan.kind, old_loan.kind) {
@@ -360,7 +360,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                         new_loan.span,
                         format!("cannot borrow `{}` as mutable \
                                 more than once at a time",
-                                self.bccx.loan_path_to_str(
+                                self.bccx.loan_path_to_string(
                                     &*new_loan.loan_path)).as_slice());
                 }
 
@@ -369,7 +369,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                         new_loan.span,
                         format!("closure requires unique access to `{}` \
                                 but {} is already borrowed",
-                                self.bccx.loan_path_to_str(&*new_loan.loan_path),
+                                self.bccx.loan_path_to_string(&*new_loan.loan_path),
                                 old_pronoun).as_slice());
                 }
 
@@ -378,7 +378,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                         new_loan.span,
                         format!("cannot borrow `{}` as {} because \
                                 previous closure requires unique access",
-                                self.bccx.loan_path_to_str(&*new_loan.loan_path),
+                                self.bccx.loan_path_to_string(&*new_loan.loan_path),
                                 new_loan.kind.to_user_str()).as_slice());
                 }
 
@@ -387,7 +387,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                         new_loan.span,
                         format!("cannot borrow `{}` as {} because \
                                 {} is also borrowed as {}",
-                                self.bccx.loan_path_to_str(&*new_loan.loan_path),
+                                self.bccx.loan_path_to_string(&*new_loan.loan_path),
                                 new_loan.kind.to_user_str(),
                                 old_pronoun,
                                 old_loan.kind.to_user_str()).as_slice());
@@ -399,7 +399,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                     self.bccx.span_note(
                         span,
                         format!("borrow occurs due to use of `{}` in closure",
-                                self.bccx.loan_path_to_str(
+                                self.bccx.loan_path_to_string(
                                     &*new_loan.loan_path)).as_slice());
                 }
                 _ => { }
@@ -410,7 +410,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                     format!("the mutable borrow prevents subsequent \
                             moves, borrows, or modification of `{0}` \
                             until the borrow ends",
-                            self.bccx.loan_path_to_str(
+                            self.bccx.loan_path_to_string(
                                 &*old_loan.loan_path))
                 }
 
@@ -418,14 +418,14 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                     format!("the immutable borrow prevents subsequent \
                             moves or mutable borrows of `{0}` \
                             until the borrow ends",
-                            self.bccx.loan_path_to_str(&*old_loan.loan_path))
+                            self.bccx.loan_path_to_string(&*old_loan.loan_path))
                 }
 
                 ty::UniqueImmBorrow => {
                     format!("the unique capture prevents subsequent \
                             moves or borrows of `{0}` \
                             until the borrow ends",
-                            self.bccx.loan_path_to_str(&*old_loan.loan_path))
+                            self.bccx.loan_path_to_string(&*old_loan.loan_path))
                 }
             };
 
@@ -433,7 +433,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                 euv::ClosureCapture(_) => {
                     format!("previous borrow of `{}` occurs here due to \
                             use in closure",
-                            self.bccx.loan_path_to_str(&*old_loan.loan_path))
+                            self.bccx.loan_path_to_string(&*old_loan.loan_path))
                 }
 
                 euv::OverloadedOperator(..) |
@@ -442,7 +442,7 @@ pub fn report_error_if_loan_conflicts_with_restriction(&self,
                 euv::ClosureInvocation(..) |
                 euv::RefBinding(..) => {
                     format!("previous borrow of `{}` occurs here",
-                            self.bccx.loan_path_to_str(&*old_loan.loan_path))
+                            self.bccx.loan_path_to_string(&*old_loan.loan_path))
                 }
             };
 
@@ -518,12 +518,12 @@ fn check_for_copy_of_frozen_path(&self,
                 self.bccx.span_err(
                     span,
                     format!("cannot use `{}` because it was mutably borrowed",
-                            self.bccx.loan_path_to_str(copy_path).as_slice())
+                            self.bccx.loan_path_to_string(copy_path).as_slice())
                     .as_slice());
                 self.bccx.span_note(
                     loan_span,
                     format!("borrow of `{}` occurs here",
-                            self.bccx.loan_path_to_str(&*loan_path).as_slice())
+                            self.bccx.loan_path_to_string(&*loan_path).as_slice())
                     .as_slice());
             }
         }
@@ -543,19 +543,19 @@ fn check_for_move_of_borrowed_path(&self,
                 let err_message = match move_kind {
                     move_data::Captured =>
                         format!("cannot move `{}` into closure because it is borrowed",
-                                self.bccx.loan_path_to_str(move_path).as_slice()),
+                                self.bccx.loan_path_to_string(move_path).as_slice()),
                     move_data::Declared |
                     move_data::MoveExpr |
                     move_data::MovePat =>
                         format!("cannot move out of `{}` because it is borrowed",
-                                self.bccx.loan_path_to_str(move_path).as_slice())
+                                self.bccx.loan_path_to_string(move_path).as_slice())
                 };
 
                 self.bccx.span_err(span, err_message.as_slice());
                 self.bccx.span_note(
                     loan_span,
                     format!("borrow of `{}` occurs here",
-                            self.bccx.loan_path_to_str(&*loan_path).as_slice())
+                            self.bccx.loan_path_to_string(&*loan_path).as_slice())
                     .as_slice());
             }
         }
@@ -567,7 +567,7 @@ pub fn analyze_restrictions_on_use(&self,
                                        borrow_kind: ty::BorrowKind)
                                        -> UseError {
         debug!("analyze_restrictions_on_use(expr_id={:?}, use_path={})",
-               self.tcx().map.node_to_str(expr_id),
+               self.tcx().map.node_to_string(expr_id),
                use_path.repr(self.tcx()));
 
         let mut ret = UseOk;
@@ -690,15 +690,15 @@ fn check_assignment(&self,
                     assignment_span,
                     format!("cannot assign to {} {} `{}`",
                             assignee_cmt.mutbl.to_user_str(),
-                            self.bccx.cmt_to_str(&*assignee_cmt),
-                            self.bccx.loan_path_to_str(&*lp)).as_slice());
+                            self.bccx.cmt_to_string(&*assignee_cmt),
+                            self.bccx.loan_path_to_string(&*lp)).as_slice());
             }
             None => {
                 self.bccx.span_err(
                     assignment_span,
                     format!("cannot assign to {} {}",
                             assignee_cmt.mutbl.to_user_str(),
-                            self.bccx.cmt_to_str(&*assignee_cmt)).as_slice());
+                            self.bccx.cmt_to_string(&*assignee_cmt)).as_slice());
             }
         }
         return;
@@ -824,10 +824,10 @@ pub fn report_illegal_mutation(&self,
         self.bccx.span_err(
             span,
             format!("cannot assign to `{}` because it is borrowed",
-                    self.bccx.loan_path_to_str(loan_path)).as_slice());
+                    self.bccx.loan_path_to_string(loan_path)).as_slice());
         self.bccx.span_note(
             loan.span,
             format!("borrow of `{}` occurs here",
-                    self.bccx.loan_path_to_str(loan_path)).as_slice());
+                    self.bccx.loan_path_to_string(loan_path)).as_slice());
     }
 }
index f5c91f7b1b3bf4441e664ff0fd479486864b6d22..9876e12d5ccac539efb1d03ff7ba34ae4ad00cb8 100644 (file)
@@ -120,7 +120,7 @@ fn report_cannot_move_out_of(bccx: &BorrowckCtxt, move_from: mc::cmt) {
             bccx.span_err(
                 move_from.span,
                 format!("cannot move out of {}",
-                        bccx.cmt_to_str(&*move_from)).as_slice());
+                        bccx.cmt_to_string(&*move_from)).as_slice());
         }
 
         mc::cat_downcast(ref b) |
@@ -145,7 +145,7 @@ fn note_move_destination(bccx: &BorrowckCtxt,
                          move_to_span: codemap::Span,
                          pat_ident: &ast::Ident,
                          is_first_note: bool) {
-    let pat_name = pprust::ident_to_str(pat_ident);
+    let pat_name = pprust::ident_to_string(pat_ident);
     if is_first_note {
         bccx.span_note(
             move_to_span,
index 9ab3202b9096e5733d084b7a953c568e6b1250a7..426a1fbede56b7fb9dca84c9f5e033e7fc9b95df 100644 (file)
@@ -418,7 +418,7 @@ pub fn cat_pattern(&self,
     pub fn report(&self, err: BckError) {
         self.span_err(
             err.span,
-            self.bckerr_to_str(&err).as_slice());
+            self.bckerr_to_string(&err).as_slice());
         self.note_and_explain_bckerr(err);
     }
 
@@ -439,7 +439,7 @@ pub fn report_use_of_moved_value(&self,
                     use_span,
                     format!("{} of possibly uninitialized variable: `{}`",
                             verb,
-                            self.loan_path_to_str(lp)).as_slice());
+                            self.loan_path_to_string(lp)).as_slice());
             }
             _ => {
                 let partially = if lp == moved_lp {""} else {"partially "};
@@ -448,7 +448,7 @@ pub fn report_use_of_moved_value(&self,
                     format!("{} of {}moved value: `{}`",
                             verb,
                             partially,
-                            self.loan_path_to_str(lp)).as_slice());
+                            self.loan_path_to_string(lp)).as_slice());
             }
         }
 
@@ -472,7 +472,7 @@ pub fn report_use_of_moved_value(&self,
                 self.tcx.sess.span_note(
                     expr_span,
                     format!("`{}` moved here because it has type `{}`, which is {}",
-                            self.loan_path_to_str(moved_lp),
+                            self.loan_path_to_string(moved_lp),
                             expr_ty.user_string(self.tcx),
                             suggestion).as_slice());
             }
@@ -483,7 +483,7 @@ pub fn report_use_of_moved_value(&self,
                     format!("`{}` moved here because it has type `{}`, \
                              which is moved by default (use `ref` to \
                              override)",
-                            self.loan_path_to_str(moved_lp),
+                            self.loan_path_to_string(moved_lp),
                             pat_ty.user_string(self.tcx)).as_slice());
             }
 
@@ -506,7 +506,7 @@ pub fn report_use_of_moved_value(&self,
                     expr_span,
                     format!("`{}` moved into closure environment here because it \
                             has type `{}`, which is {}",
-                            self.loan_path_to_str(moved_lp),
+                            self.loan_path_to_string(moved_lp),
                             expr_ty.user_string(self.tcx),
                             suggestion).as_slice());
             }
@@ -536,7 +536,7 @@ pub fn report_reassigned_immutable_variable(&self,
         self.tcx.sess.span_err(
             span,
             format!("re-assignment of immutable variable `{}`",
-                    self.loan_path_to_str(lp)).as_slice());
+                    self.loan_path_to_string(lp)).as_slice());
         self.tcx.sess.span_note(assign.span, "prior assignment occurs here");
     }
 
@@ -552,20 +552,20 @@ pub fn span_end_note(&self, s: Span, m: &str) {
         self.tcx.sess.span_end_note(s, m);
     }
 
-    pub fn bckerr_to_str(&self, err: &BckError) -> String {
+    pub fn bckerr_to_string(&self, err: &BckError) -> String {
         match err.code {
             err_mutbl => {
                 let descr = match opt_loan_path(&err.cmt) {
                     None => {
                         format!("{} {}",
                                 err.cmt.mutbl.to_user_str(),
-                                self.cmt_to_str(&*err.cmt))
+                                self.cmt_to_string(&*err.cmt))
                     }
                     Some(lp) => {
                         format!("{} {} `{}`",
                                 err.cmt.mutbl.to_user_str(),
-                                self.cmt_to_str(&*err.cmt),
-                                self.loan_path_to_str(&*lp))
+                                self.cmt_to_string(&*err.cmt),
+                                self.loan_path_to_string(&*lp))
                     }
                 };
 
@@ -589,7 +589,7 @@ pub fn bckerr_to_str(&self, err: &BckError) -> String {
                 let msg = match opt_loan_path(&err.cmt) {
                     None => "borrowed value".to_string(),
                     Some(lp) => {
-                        format!("`{}`", self.loan_path_to_str(&*lp))
+                        format!("`{}`", self.loan_path_to_string(&*lp))
                     }
                 };
                 format!("{} does not live long enough", msg)
@@ -597,9 +597,9 @@ pub fn bckerr_to_str(&self, err: &BckError) -> String {
             err_borrowed_pointer_too_short(..) => {
                 let descr = match opt_loan_path(&err.cmt) {
                     Some(lp) => {
-                        format!("`{}`", self.loan_path_to_str(&*lp))
+                        format!("`{}`", self.loan_path_to_string(&*lp))
                     }
-                    None => self.cmt_to_str(&*err.cmt),
+                    None => self.cmt_to_string(&*err.cmt),
                 };
 
                 format!("lifetime of {} is too short to guarantee \
@@ -691,9 +691,9 @@ pub fn note_and_explain_bckerr(&self, err: BckError) {
             err_borrowed_pointer_too_short(loan_scope, ptr_scope) => {
                 let descr = match opt_loan_path(&err.cmt) {
                     Some(lp) => {
-                        format!("`{}`", self.loan_path_to_str(&*lp))
+                        format!("`{}`", self.loan_path_to_string(&*lp))
                     }
-                    None => self.cmt_to_str(&*err.cmt),
+                    None => self.cmt_to_string(&*err.cmt),
                 };
                 note_and_explain_region(
                     self.tcx,
@@ -710,7 +710,7 @@ pub fn note_and_explain_bckerr(&self, err: BckError) {
         }
     }
 
-    pub fn append_loan_path_to_str(&self,
+    pub fn append_loan_path_to_string(&self,
                                    loan_path: &LoanPath,
                                    out: &mut String) {
         match *loan_path {
@@ -720,7 +720,7 @@ pub fn append_loan_path_to_str(&self,
             }
 
             LpExtend(ref lp_base, _, LpInterior(mc::InteriorField(fname))) => {
-                self.append_autoderefd_loan_path_to_str(&**lp_base, out);
+                self.append_autoderefd_loan_path_to_string(&**lp_base, out);
                 match fname {
                     mc::NamedField(fname) => {
                         out.push_char('.');
@@ -728,24 +728,24 @@ pub fn append_loan_path_to_str(&self,
                     }
                     mc::PositionalField(idx) => {
                         out.push_char('#'); // invent a notation here
-                        out.push_str(idx.to_str().as_slice());
+                        out.push_str(idx.to_string().as_slice());
                     }
                 }
             }
 
             LpExtend(ref lp_base, _, LpInterior(mc::InteriorElement(_))) => {
-                self.append_autoderefd_loan_path_to_str(&**lp_base, out);
+                self.append_autoderefd_loan_path_to_string(&**lp_base, out);
                 out.push_str("[..]");
             }
 
             LpExtend(ref lp_base, _, LpDeref(_)) => {
                 out.push_char('*');
-                self.append_loan_path_to_str(&**lp_base, out);
+                self.append_loan_path_to_string(&**lp_base, out);
             }
         }
     }
 
-    pub fn append_autoderefd_loan_path_to_str(&self,
+    pub fn append_autoderefd_loan_path_to_string(&self,
                                               loan_path: &LoanPath,
                                               out: &mut String) {
         match *loan_path {
@@ -753,23 +753,23 @@ pub fn append_autoderefd_loan_path_to_str(&self,
                 // For a path like `(*x).f` or `(*x)[3]`, autoderef
                 // rules would normally allow users to omit the `*x`.
                 // So just serialize such paths to `x.f` or x[3]` respectively.
-                self.append_autoderefd_loan_path_to_str(&**lp_base, out)
+                self.append_autoderefd_loan_path_to_string(&**lp_base, out)
             }
 
             LpVar(..) | LpUpvar(..) | LpExtend(_, _, LpInterior(..)) => {
-                self.append_loan_path_to_str(loan_path, out)
+                self.append_loan_path_to_string(loan_path, out)
             }
         }
     }
 
-    pub fn loan_path_to_str(&self, loan_path: &LoanPath) -> String {
+    pub fn loan_path_to_string(&self, loan_path: &LoanPath) -> String {
         let mut result = String::new();
-        self.append_loan_path_to_str(loan_path, &mut result);
+        self.append_loan_path_to_string(loan_path, &mut result);
         result
     }
 
-    pub fn cmt_to_str(&self, cmt: &mc::cmt_) -> String {
-        self.mc().cmt_to_str(cmt)
+    pub fn cmt_to_string(&self, cmt: &mc::cmt_) -> String {
+        self.mc().cmt_to_string(cmt)
     }
 }
 
@@ -815,11 +815,11 @@ impl Repr for LoanPath {
     fn repr(&self, tcx: &ty::ctxt) -> String {
         match self {
             &LpVar(id) => {
-                format!("$({})", tcx.map.node_to_str(id))
+                format!("$({})", tcx.map.node_to_string(id))
             }
 
             &LpUpvar(ty::UpvarId{ var_id, closure_expr_id }) => {
-                let s = tcx.map.node_to_str(var_id);
+                let s = tcx.map.node_to_string(var_id);
                 format!("$({} captured by id={})", s, closure_expr_id)
             }
 
index c33580d869b15ea7cc7381aa8232b5f0fc6cd9d3..9f44f0babc72abfaae37bf70e1133627ee020df8 100644 (file)
@@ -64,7 +64,7 @@ fn node_label(&'a self, &(i, n): &Node<'a>) -> dot::LabelText<'a> {
         } else if n.data.id == ast::DUMMY_NODE_ID {
             dot::LabelStr("(dummy_node)".into_maybe_owned())
         } else {
-            let s = self.ast_map.node_to_str(n.data.id);
+            let s = self.ast_map.node_to_string(n.data.id);
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             dot::EscStr(s.into_maybe_owned())
@@ -80,7 +80,7 @@ fn edge_label(&self, e: &Edge<'a>) -> dot::LabelText<'a> {
             } else {
                 put_one = true;
             }
-            let s = self.ast_map.node_to_str(node_id);
+            let s = self.ast_map.node_to_string(node_id);
             // left-aligns the lines
             let s = replace_newline_with_backslash_l(s);
             label = label.append(format!("exiting scope_{} {}",
index cf886702d863126f7373e17b7db64e8ac646cf8f..33bf6ceed4f2b848d9811072495d8b0d0dd47dad 100644 (file)
@@ -108,7 +108,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
                  .span_err(e.span,
                            format!("can not cast to `{}` in a constant \
                                     expression",
-                                   ppaux::ty_to_str(v.tcx, ety)).as_slice())
+                                   ppaux::ty_to_string(v.tcx, ety)).as_slice())
             }
           }
           ExprPath(ref pth) => {
index 6ba112bf353913b63954c91e50fc2da5c166781a..599f5f4024f28ab2d98c3a29156790f22a7a5e80 100644 (file)
 use syntax::ast_util::{is_unguarded, walk_pat};
 use syntax::codemap::{Span, Spanned, DUMMY_SP};
 use syntax::owned_slice::OwnedSlice;
-use syntax::print::pprust::pat_to_str;
+use syntax::print::pprust::pat_to_string;
 use syntax::visit;
 use syntax::visit::{Visitor, FnKind};
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 struct Matrix(Vec<Vec<Gc<Pat>>>);
 
@@ -47,7 +47,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
         let &Matrix(ref m) = self;
         let pretty_printed_matrix: Vec<Vec<String>> = m.iter().map(|row| {
-            row.iter().map(|&pat| pat_to_str(pat)).collect::<Vec<String>>()
+            row.iter().map(|&pat| pat_to_string(pat)).collect::<Vec<String>>()
         }).collect();
 
         let column_count = m.iter().map(|row| row.len()).max().unwrap_or(0u);
@@ -147,7 +147,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &Expr) {
                    // We know the type is inhabited, so this must be wrong
                    cx.tcx.sess.span_err(ex.span, format!("non-exhaustive patterns: \
                                 type {} is non-empty",
-                                ty_to_str(cx.tcx, pat_ty)).as_slice());
+                                ty_to_string(cx.tcx, pat_ty)).as_slice());
                }
                // If the type *is* empty, it's vacuously exhaustive
                return;
@@ -222,7 +222,8 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, m: &Matrix) {
                 [] => wild(),
                 _ => unreachable!()
             };
-            let msg = format!("non-exhaustive patterns: `{0}` not covered", pat_to_str(&*witness));
+            let msg = format!("non-exhaustive patterns: `{0}` not covered",
+                              pat_to_string(&*witness));
             cx.tcx.sess.span_err(sp, msg.as_slice());
         }
         NotUseful => {
@@ -780,7 +781,7 @@ fn check_local(cx: &mut MatchCheckCtxt, loc: &Local) {
         Some(pat) => {
             let msg = format!(
                 "refutable pattern in {} binding: `{}` not covered",
-                name, pat_to_str(&*pat)
+                name, pat_to_string(&*pat)
             );
             cx.tcx.sess.span_err(loc.pat.span, msg.as_slice());
         },
@@ -802,7 +803,7 @@ fn check_fn(cx: &mut MatchCheckCtxt,
             Some(pat) => {
                 let msg = format!(
                     "refutable pattern in function argument: `{}` not covered",
-                    pat_to_str(&*pat)
+                    pat_to_string(&*pat)
                 );
                 cx.tcx.sess.span_err(input.pat.span, msg.as_slice());
             },
index 33949ee5b1644a91855be8f450873519abcc2328..1e948afb7018fe745ffc05f1e5db7dc33291e65d 100644 (file)
@@ -75,7 +75,7 @@ fn report_error(&self, span: Span, result: Option<String>) -> bool {
 impl<'a> Visitor<bool> for CheckStaticVisitor<'a> {
 
     fn visit_item(&mut self, i: &ast::Item, _is_const: bool) {
-        debug!("visit_item(item={})", pprust::item_to_str(i));
+        debug!("visit_item(item={})", pprust::item_to_string(i));
         match i.node {
             ast::ItemStatic(_, mutability, ref expr) => {
                 match mutability {
@@ -99,7 +99,7 @@ fn visit_item(&mut self, i: &ast::Item, _is_const: bool) {
     /// of a static item, this method does nothing but walking
     /// down through it.
     fn visit_expr(&mut self, e: &ast::Expr, is_const: bool) {
-        debug!("visit_expr(expr={})", pprust::expr_to_str(e));
+        debug!("visit_expr(expr={})", pprust::expr_to_string(e));
 
         if !is_const {
             return visit::walk_expr(self, e, is_const);
index 5ac85833e221eb3ccbcb47a23c47284ba2acf603..7d9178162a65adb11de93f371623b028d93cda68 100644 (file)
@@ -164,18 +164,18 @@ fn pre(&self,
             let cfgidx = to_cfgidx_or_die(id, &self.nodeid_to_index);
             let (start, end) = self.compute_id_range_frozen(cfgidx);
             let on_entry = self.on_entry.slice(start, end);
-            let entry_str = bits_to_str(on_entry);
+            let entry_str = bits_to_string(on_entry);
 
             let gens = self.gens.slice(start, end);
             let gens_str = if gens.iter().any(|&u| u != 0) {
-                format!(" gen: {}", bits_to_str(gens))
+                format!(" gen: {}", bits_to_string(gens))
             } else {
                 "".to_string()
             };
 
             let kills = self.kills.slice(start, end);
             let kills_str = if kills.iter().any(|&u| u != 0) {
-                format!(" kill: {}", bits_to_str(kills))
+                format!(" kill: {}", bits_to_string(kills))
             } else {
                 "".to_string()
             };
@@ -289,7 +289,7 @@ pub fn add_kill(&mut self, id: ast::NodeId, bit: uint) {
     fn apply_gen_kill(&mut self, cfgidx: CFGIndex, bits: &mut [uint]) {
         //! Applies the gen and kill sets for `id` to `bits`
         debug!("{:s} apply_gen_kill(cfgidx={}, bits={}) [before]",
-               self.analysis_name, cfgidx, mut_bits_to_str(bits));
+               self.analysis_name, cfgidx, mut_bits_to_string(bits));
         let (start, end) = self.compute_id_range(cfgidx);
         let gens = self.gens.slice(start, end);
         bitwise(bits, gens, &Union);
@@ -297,7 +297,7 @@ fn apply_gen_kill(&mut self, cfgidx: CFGIndex, bits: &mut [uint]) {
         bitwise(bits, kills, &Subtract);
 
         debug!("{:s} apply_gen_kill(cfgidx={}, bits={}) [after]",
-               self.analysis_name, cfgidx, mut_bits_to_str(bits));
+               self.analysis_name, cfgidx, mut_bits_to_string(bits));
     }
 
     fn compute_id_range_frozen(&self, cfgidx: CFGIndex) -> (uint, uint) {
@@ -334,7 +334,7 @@ pub fn each_bit_on_entry_frozen(&self,
         let (start, end) = self.compute_id_range_frozen(cfgidx);
         let on_entry = self.on_entry.slice(start, end);
         debug!("{:s} each_bit_on_entry_frozen(id={:?}, on_entry={})",
-               self.analysis_name, id, bits_to_str(on_entry));
+               self.analysis_name, id, bits_to_string(on_entry));
         self.each_bit(on_entry, f)
     }
 
@@ -348,7 +348,7 @@ pub fn each_gen_bit_frozen(&self, id: ast::NodeId, f: |uint| -> bool)
         let (start, end) = self.compute_id_range_frozen(cfgidx);
         let gens = self.gens.slice(start, end);
         debug!("{:s} each_gen_bit(id={:?}, gens={})",
-               self.analysis_name, id, bits_to_str(gens));
+               self.analysis_name, id, bits_to_string(gens));
         self.each_bit(gens, f)
     }
 
@@ -426,10 +426,10 @@ pub fn add_kills_from_flow_exits(&mut self, cfg: &cfg::CFG) {
             if changed {
                 let bits = self.kills.mut_slice(start, end);
                 debug!("{:s} add_kills_from_flow_exits flow_exit={} bits={} [before]",
-                       self.analysis_name, flow_exit, mut_bits_to_str(bits));
+                       self.analysis_name, flow_exit, mut_bits_to_string(bits));
                 bits.copy_from(orig_kills.as_slice());
                 debug!("{:s} add_kills_from_flow_exits flow_exit={} bits={} [after]",
-                       self.analysis_name, flow_exit, mut_bits_to_str(bits));
+                       self.analysis_name, flow_exit, mut_bits_to_string(bits));
             }
             true
         });
@@ -483,10 +483,10 @@ fn walk_cfg(&mut self,
                 cfg: &cfg::CFG,
                 in_out: &mut [uint]) {
         debug!("DataFlowContext::walk_cfg(in_out={}) {:s}",
-               bits_to_str(in_out), self.dfcx.analysis_name);
+               bits_to_string(in_out), self.dfcx.analysis_name);
         cfg.graph.each_node(|node_index, node| {
             debug!("DataFlowContext::walk_cfg idx={} id={} begin in_out={}",
-                   node_index, node.data.id, bits_to_str(in_out));
+                   node_index, node.data.id, bits_to_string(in_out));
 
             let (start, end) = self.dfcx.compute_id_range(node_index);
 
@@ -526,7 +526,7 @@ fn propagate_bits_into_entry_set_for(&mut self,
         let source = edge.source();
         let cfgidx = edge.target();
         debug!("{:s} propagate_bits_into_entry_set_for(pred_bits={}, {} to {})",
-               self.dfcx.analysis_name, bits_to_str(pred_bits), source, cfgidx);
+               self.dfcx.analysis_name, bits_to_string(pred_bits), source, cfgidx);
         let (start, end) = self.dfcx.compute_id_range(cfgidx);
         let changed = {
             // (scoping mutable borrow of self.dfcx.on_entry)
@@ -536,17 +536,17 @@ fn propagate_bits_into_entry_set_for(&mut self,
         if changed {
             debug!("{:s} changed entry set for {:?} to {}",
                    self.dfcx.analysis_name, cfgidx,
-                   bits_to_str(self.dfcx.on_entry.slice(start, end)));
+                   bits_to_string(self.dfcx.on_entry.slice(start, end)));
             self.changed = true;
         }
     }
 }
 
-fn mut_bits_to_str(words: &mut [uint]) -> String {
-    bits_to_str(words)
+fn mut_bits_to_string(words: &mut [uint]) -> String {
+    bits_to_string(words)
 }
 
-fn bits_to_str(words: &[uint]) -> String {
+fn bits_to_string(words: &[uint]) -> String {
     let mut result = String::new();
     let mut sep = '[';
 
@@ -582,7 +582,7 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
 
 fn set_bit(words: &mut [uint], bit: uint) -> bool {
     debug!("set_bit: words={} bit={}",
-           mut_bits_to_str(words), bit_str(bit));
+           mut_bits_to_string(words), bit_str(bit));
     let word = bit / uint::BITS;
     let bit_in_word = bit % uint::BITS;
     let bit_mask = 1 << bit_in_word;
index 2333b329996401dc20c4596fbaa68b459a18d525..782a380e23a0ecdd3aa98e2f5cbb1adf858d941d 100644 (file)
@@ -68,7 +68,7 @@ fn check_str_index(&mut self, e: &ast::Expr) {
             _ => return
         };
         debug!("effect: checking index with base type {}",
-                ppaux::ty_to_str(self.tcx, base_type));
+                ppaux::ty_to_string(self.tcx, base_type));
         match ty::get(base_type).sty {
             ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
                 ty::ty_str => {
@@ -147,7 +147,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
                 let method_call = MethodCall::expr(expr.id);
                 let base_type = self.tcx.method_map.borrow().get(&method_call).ty;
                 debug!("effect: method call case, base type is {}",
-                       ppaux::ty_to_str(self.tcx, base_type));
+                       ppaux::ty_to_string(self.tcx, base_type));
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span,
                                         "invocation of unsafe method")
@@ -156,7 +156,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
             ast::ExprCall(base, _) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: call case, base type is {}",
-                       ppaux::ty_to_str(self.tcx, base_type));
+                       ppaux::ty_to_string(self.tcx, base_type));
                 if type_is_unsafe_function(base_type) {
                     self.require_unsafe(expr.span, "call to unsafe function")
                 }
@@ -164,7 +164,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
             ast::ExprUnary(ast::UnDeref, base) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: unary case, base type is {}",
-                        ppaux::ty_to_str(self.tcx, base_type));
+                        ppaux::ty_to_string(self.tcx, base_type));
                 match ty::get(base_type).sty {
                     ty::ty_ptr(_) => {
                         self.require_unsafe(expr.span,
index a7154e78bc58612d7243430bd2aa3a106be75ac1..d432ced5226cee32781cfffea24c12d9eedfa8d8 100644 (file)
 use middle::ty;
 use middle::typeck::{MethodCall, NoAdjustment};
 use middle::typeck;
-use util::ppaux::{Repr, ty_to_str};
+use util::ppaux::{Repr, ty_to_string};
 use util::ppaux::UserString;
 
 use syntax::ast::*;
 use syntax::attr;
 use syntax::codemap::Span;
-use syntax::print::pprust::{expr_to_str, ident_to_str};
+use syntax::print::pprust::{expr_to_string, ident_to_string};
 use syntax::{visit};
 use syntax::visit::Visitor;
 
@@ -126,7 +126,7 @@ fn check_impl_of_trait(cx: &mut Context, it: &Item, trait_ref: &TraitRef, self_t
         cx.tcx.sess.span_err(self_type.span,
             format!("the type `{}', which does not fulfill `{}`, cannot implement this \
                     trait",
-                    ty_to_str(cx.tcx, self_ty),
+                    ty_to_string(cx.tcx, self_ty),
                     missing.user_string(cx.tcx)).as_slice());
         cx.tcx.sess.span_note(self_type.span,
             format!("types implementing this trait must fulfill `{}`",
@@ -246,7 +246,7 @@ fn check_fn(
 }
 
 pub fn check_expr(cx: &mut Context, e: &Expr) {
-    debug!("kind::check_expr({})", expr_to_str(e));
+    debug!("kind::check_expr({})", expr_to_string(e));
 
     // Handle any kind bounds on type parameters
     check_bounds_on_type_parameters(cx, e);
@@ -492,7 +492,7 @@ pub fn check_typaram_bounds(cx: &Context,
             sp,
             format!("instantiating a type parameter with an incompatible type \
                      `{}`, which does not fulfill `{}`",
-                    ty_to_str(cx.tcx, ty),
+                    ty_to_string(cx.tcx, ty),
                     missing.user_string(cx.tcx)).as_slice());
     });
 }
@@ -509,14 +509,14 @@ pub fn check_freevar_bounds(cx: &Context, sp: Span, ty: ty::t,
                 format!("cannot implicitly borrow variable of type `{}` in a \
                          bounded stack closure (implicit reference does not \
                          fulfill `{}`)",
-                        ty_to_str(cx.tcx, rty),
+                        ty_to_string(cx.tcx, rty),
                         missing.user_string(cx.tcx)).as_slice())
             }
             None => {
                 cx.tcx.sess.span_err(sp,
                 format!("cannot capture variable of type `{}`, which does \
                          not fulfill `{}`, in a bounded closure",
-                        ty_to_str(cx.tcx, ty),
+                        ty_to_string(cx.tcx, ty),
                         missing.user_string(cx.tcx)).as_slice())
             }
         }
@@ -533,20 +533,20 @@ pub fn check_trait_cast_bounds(cx: &Context, sp: Span, ty: ty::t,
         cx.tcx.sess.span_err(sp,
             format!("cannot pack type `{}`, which does not fulfill \
                      `{}`, as a trait bounded by {}",
-                    ty_to_str(cx.tcx, ty), missing.user_string(cx.tcx),
+                    ty_to_string(cx.tcx, ty), missing.user_string(cx.tcx),
                     bounds.user_string(cx.tcx)).as_slice());
     });
 }
 
 fn check_copy(cx: &Context, ty: ty::t, sp: Span, reason: &str) {
     debug!("type_contents({})={}",
-           ty_to_str(cx.tcx, ty),
-           ty::type_contents(cx.tcx, ty).to_str());
+           ty_to_string(cx.tcx, ty),
+           ty::type_contents(cx.tcx, ty).to_string());
     if ty::type_moves_by_default(cx.tcx, ty) {
         cx.tcx.sess.span_err(
             sp,
             format!("copying a value of non-copyable type `{}`",
-                    ty_to_str(cx.tcx, ty)).as_slice());
+                    ty_to_string(cx.tcx, ty)).as_slice());
         cx.tcx.sess.span_note(sp, format!("{}", reason).as_slice());
     }
 }
@@ -558,7 +558,7 @@ pub fn check_static(tcx: &ty::ctxt, ty: ty::t, sp: Span) -> bool {
             tcx.sess.span_err(sp,
                 format!("value may contain references; \
                          add `'static` bound to `{}`",
-                        ty_to_str(tcx, ty)).as_slice());
+                        ty_to_string(tcx, ty)).as_slice());
           }
           _ => {
             tcx.sess.span_err(sp, "value may contain references");
@@ -643,7 +643,7 @@ pub fn check_cast_for_escaping_regions(
             //         source_span,
             //         format!("source contains reference with lifetime \
             //               not found in the target type `{}`",
-            //              ty_to_str(cx.tcx, target_ty)));
+            //              ty_to_string(cx.tcx, target_ty)));
             //     note_and_explain_region(
             //         cx.tcx, "source data is only valid for ", r, "");
             // }
@@ -683,7 +683,7 @@ fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) {
                           format!("variable `{}` has dynamically sized type \
                                    `{}`",
                                   name,
-                                  ty_to_str(tcx, ty)).as_slice());
+                                  ty_to_string(tcx, ty)).as_slice());
     }
 }
 
@@ -691,7 +691,7 @@ fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) {
 fn check_pat(cx: &mut Context, pat: &Pat) {
     let var_name = match pat.node {
         PatWild => Some("_".to_string()),
-        PatIdent(_, ref path1, _) => Some(ident_to_str(&path1.node).to_string()),
+        PatIdent(_, ref path1, _) => Some(ident_to_string(&path1.node).to_string()),
         _ => None
     };
 
@@ -702,7 +702,7 @@ fn check_pat(cx: &mut Context, pat: &Pat) {
             match ty {
                 Some(ty) => {
                     debug!("kind: checking sized-ness of variable {}: {}",
-                           name, ty_to_str(cx.tcx, *ty));
+                           name, ty_to_string(cx.tcx, *ty));
                     check_sized(cx.tcx, *ty, name, pat.span);
                 }
                 None => {} // extern fn args
index a33062457629b3bc97b5e4bce227022be0713313..79742d3173434cd5bafcef3173eccbbbc4f80d5c 100644 (file)
 use syntax::codemap::{BytePos, original_sp, Span};
 use syntax::parse::token::special_idents;
 use syntax::parse::token;
-use syntax::print::pprust::{expr_to_str, block_to_str};
+use syntax::print::pprust::{expr_to_string, block_to_string};
 use syntax::{visit, ast_util};
 use syntax::visit::{Visitor, FnKind};
 
@@ -152,17 +152,17 @@ enum LiveNodeKind {
     ExitNode
 }
 
-fn live_node_kind_to_str(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
+fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
     let cm = cx.sess.codemap();
     match lnk {
         FreeVarNode(s) => {
-            format!("Free var node [{}]", cm.span_to_str(s))
+            format!("Free var node [{}]", cm.span_to_string(s))
         }
         ExprNode(s) => {
-            format!("Expr node [{}]", cm.span_to_str(s))
+            format!("Expr node [{}]", cm.span_to_string(s))
         }
         VarDefNode(s) => {
-            format!("Var def node [{}]", cm.span_to_str(s))
+            format!("Var def node [{}]", cm.span_to_string(s))
         }
         ExitNode => "Exit node".to_string(),
     }
@@ -272,8 +272,8 @@ fn add_live_node(&mut self, lnk: LiveNodeKind) -> LiveNode {
         self.lnks.push(lnk);
         self.num_live_nodes += 1;
 
-        debug!("{} is of kind {}", ln.to_str(),
-               live_node_kind_to_str(lnk, self.tcx));
+        debug!("{} is of kind {}", ln.to_string(),
+               live_node_kind_to_string(lnk, self.tcx));
 
         ln
     }
@@ -282,7 +282,7 @@ fn add_live_node_for_node(&mut self, node_id: NodeId, lnk: LiveNodeKind) {
         let ln = self.add_live_node(lnk);
         self.live_node_map.insert(node_id, ln);
 
-        debug!("{} is node {}", ln.to_str(), node_id);
+        debug!("{} is node {}", ln.to_string(), node_id);
     }
 
     fn add_variable(&mut self, vk: VarKind) -> Variable {
@@ -297,7 +297,7 @@ fn add_variable(&mut self, vk: VarKind) -> Variable {
             ImplicitRet => {}
         }
 
-        debug!("{} is {:?}", v.to_str(), vk);
+        debug!("{} is {:?}", v.to_string(), vk);
 
         v
     }
@@ -317,7 +317,7 @@ fn variable(&self, node_id: NodeId, span: Span) -> Variable {
     fn variable_name(&self, var: Variable) -> String {
         match self.var_kinds.get(var.get()) {
             &Local(LocalInfo { ident: nm, .. }) | &Arg(_, nm) => {
-                token::get_ident(nm).get().to_str()
+                token::get_ident(nm).get().to_string()
             },
             &ImplicitRet => "<implicit-ret>".to_string()
         }
@@ -675,7 +675,7 @@ fn write_vars(&self,
         for var_idx in range(0u, self.ir.num_vars) {
             let idx = node_base_idx + var_idx;
             if test(idx).is_valid() {
-                try!(write!(wr, " {}", Variable(var_idx).to_str()));
+                try!(write!(wr, " {}", Variable(var_idx).to_string()));
             }
         }
         Ok(())
@@ -717,7 +717,7 @@ fn ln_str(&self, ln: LiveNode) -> String {
             self.write_vars(wr, ln, |idx| self.users.get(idx).reader);
             write!(wr, "  writes");
             self.write_vars(wr, ln, |idx| self.users.get(idx).writer);
-            write!(wr, "  precedes {}]", self.successors.get(ln.get()).to_str());
+            write!(wr, "  precedes {}]", self.successors.get(ln.get()).to_string());
         }
         str::from_utf8(wr.unwrap().as_slice()).unwrap().to_string()
     }
@@ -766,7 +766,7 @@ fn merge_from_succ(&mut self,
         });
 
         debug!("merge_from_succ(ln={}, succ={}, first_merge={}, changed={})",
-               ln.to_str(), self.ln_str(succ_ln), first_merge, changed);
+               ln.to_string(), self.ln_str(succ_ln), first_merge, changed);
         return changed;
 
         fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool {
@@ -787,14 +787,14 @@ fn define(&mut self, writer: LiveNode, var: Variable) {
         self.users.get_mut(idx).reader = invalid_node();
         self.users.get_mut(idx).writer = invalid_node();
 
-        debug!("{} defines {} (idx={}): {}", writer.to_str(), var.to_str(),
+        debug!("{} defines {} (idx={}): {}", writer.to_string(), var.to_string(),
                idx, self.ln_str(writer));
     }
 
     // Either read, write, or both depending on the acc bitset
     fn acc(&mut self, ln: LiveNode, var: Variable, acc: uint) {
         debug!("{} accesses[{:x}] {}: {}",
-               ln.to_str(), acc, var.to_str(), self.ln_str(ln));
+               ln.to_string(), acc, var.to_string(), self.ln_str(ln));
 
         let idx = self.idx(ln, var);
         let user = self.users.get_mut(idx);
@@ -822,7 +822,7 @@ fn compute(&mut self, decl: &FnDecl, body: &Block) -> LiveNode {
         // effectively a return---this only occurs in `for` loops,
         // where the body is really a closure.
 
-        debug!("compute: using id for block, {}", block_to_str(body));
+        debug!("compute: using id for block, {}", block_to_string(body));
 
         let exit_ln = self.s.exit_ln;
         let entry_ln: LiveNode =
@@ -837,7 +837,7 @@ fn compute(&mut self, decl: &FnDecl, body: &Block) -> LiveNode {
                    }
                    body.id
                },
-               entry_ln.to_str());
+               entry_ln.to_string());
 
         entry_ln
     }
@@ -928,7 +928,7 @@ fn propagate_through_opt_expr(&mut self,
 
     fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
                               -> LiveNode {
-        debug!("propagate_through_expr: {}", expr_to_str(expr));
+        debug!("propagate_through_expr: {}", expr_to_string(expr));
 
         match expr.node {
           // Interesting cases with control flow or which gen/kill
@@ -942,7 +942,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
           }
 
           ExprFnBlock(_, ref blk) | ExprProc(_, ref blk) => {
-              debug!("{} is an ExprFnBlock or ExprProc", expr_to_str(expr));
+              debug!("{} is an ExprFnBlock or ExprProc", expr_to_string(expr));
 
               /*
               The next-node for a break is the successor of the entire
@@ -1314,7 +1314,7 @@ fn propagate_through_loop(&mut self,
             first_merge = false;
         }
         debug!("propagate_through_loop: using id for loop body {} {}",
-               expr.id, block_to_str(body));
+               expr.id, block_to_string(body));
 
         let cond_ln = self.propagate_through_opt_expr(cond, ln);
         let body_ln = self.with_loop_nodes(expr.id, succ, ln, |this| {
index 96716ce09e0dc282332d79cfc4d876ed82cc6e8e..33ab2ed3632405adaa0fa90286535f4ae84cb4fa 100644 (file)
@@ -66,7 +66,7 @@
 use middle::ty;
 use middle::typeck;
 use util::nodemap::NodeMap;
-use util::ppaux::{ty_to_str, Repr};
+use util::ppaux::{ty_to_string, Repr};
 
 use syntax::ast::{MutImmutable, MutMutable};
 use syntax::ast;
@@ -217,7 +217,7 @@ pub fn deref_kind(tcx: &ty::ctxt, t: ty::t) -> deref_kind {
       None => {
         tcx.sess.bug(
             format!("deref_cat() invoked on non-derefable type {}",
-                    ty_to_str(tcx, t)).as_slice());
+                    ty_to_string(tcx, t)).as_slice());
       }
     }
 }
@@ -980,7 +980,7 @@ pub fn cat_pattern(&self,
         // get the type of the *subpattern* and use that.
 
         debug!("cat_pattern: id={} pat={} cmt={}",
-               pat.id, pprust::pat_to_str(pat),
+               pat.id, pprust::pat_to_string(pat),
                cmt.repr(self.tcx()));
 
         op(self, cmt.clone(), pat);
@@ -1105,7 +1105,7 @@ pub fn cat_pattern(&self,
         Ok(())
     }
 
-    pub fn cmt_to_str(&self, cmt: &cmt_) -> String {
+    pub fn cmt_to_string(&self, cmt: &cmt_) -> String {
         match cmt.cat {
           cat_static_item => {
               "static item".to_string()
@@ -1151,10 +1151,10 @@ pub fn cmt_to_str(&self, cmt: &cmt_) -> String {
               "captured outer variable".to_string()
           }
           cat_discr(ref cmt, _) => {
-            self.cmt_to_str(&**cmt)
+            self.cmt_to_string(&**cmt)
           }
           cat_downcast(ref cmt) => {
-            self.cmt_to_str(&**cmt)
+            self.cmt_to_string(&**cmt)
           }
         }
     }
@@ -1311,7 +1311,7 @@ impl Repr for InteriorKind {
     fn repr(&self, _tcx: &ty::ctxt) -> String {
         match *self {
             InteriorField(NamedField(fld)) => {
-                token::get_name(fld).get().to_str()
+                token::get_name(fld).get().to_string()
             }
             InteriorField(PositionalField(i)) => format!("#{:?}", i),
             InteriorElement(_) => "[]".to_string(),
index 76e962a3bc4da6a1894def5f64c29b5c0b374072..7630321bd559b0bbc5cd4b8b3b57e21e88bfa6db 100644 (file)
@@ -375,7 +375,7 @@ enum FieldName {
 impl<'a> PrivacyVisitor<'a> {
     // used when debugging
     fn nodestr(&self, id: ast::NodeId) -> String {
-        self.tcx.map.node_to_str(id).to_string()
+        self.tcx.map.node_to_string(id).to_string()
     }
 
     // Determines whether the given definition is public from the point of view
@@ -423,7 +423,7 @@ fn def_privacy(&self, did: ast::DefId) -> PrivacyResult {
         }
 
         debug!("privacy - local {} not public all the way down",
-               self.tcx.map.node_to_str(did.node));
+               self.tcx.map.node_to_string(did.node));
         // return quickly for things in the same module
         if self.parents.find(&did.node) == self.parents.find(&self.curitem) {
             debug!("privacy - same parent, we're done here");
index 682dcb2b709f396ff8bdfb1b8a61689002137838..26bb0b62cb05fbb1b8869c1bf4e34ad8057b3ba8 100644 (file)
@@ -336,7 +336,7 @@ fn propagate_node(&mut self, node: &ast_map::Node,
                     .bug(format!("found unexpected thingy in worklist: {}",
                                  self.tcx
                                      .map
-                                     .node_to_str(search_item)).as_slice())
+                                     .node_to_string(search_item)).as_slice())
             }
         }
     }
index 3b59736e292b51c2b4681367cb1fa660b931906f..df4d3b7efe432ea6ffada1db2c3bac9569f4bc8e 100644 (file)
@@ -821,7 +821,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
                                body.id={}, \
                                cx.parent={})",
            id,
-           visitor.sess.codemap().span_to_str(sp),
+           visitor.sess.codemap().span_to_string(sp),
            body.id,
            cx.parent);
 
index 30a513407a5d5bae7bb2fbb3f471ae127d1a2efd..8d1fc3cad07039f34cead17079f4d3e96d24a7cb 100644 (file)
@@ -790,7 +790,7 @@ fn intern(&mut self, string: &str, primitive_type: PrimTy) {
 }
 
 
-fn namespace_error_to_str(ns: NamespaceError) -> &'static str {
+fn namespace_error_to_string(ns: NamespaceError) -> &'static str {
     match ns {
         NoError                 => "",
         ModuleError | TypeError => "type or module",
@@ -1071,14 +1071,14 @@ fn add_child(&self,
                     let ns = ns.unwrap();
                     self.resolve_error(sp,
                         format!("duplicate definition of {} `{}`",
-                             namespace_error_to_str(duplicate_type),
+                             namespace_error_to_string(duplicate_type),
                              token::get_ident(name)).as_slice());
                     {
                         let r = child.span_for_namespace(ns);
                         for sp in r.iter() {
                             self.session.span_note(*sp,
                                  format!("first definition of {} `{}` here",
-                                      namespace_error_to_str(duplicate_type),
+                                      namespace_error_to_string(duplicate_type),
                                       token::get_ident(name)).as_slice());
                         }
                     }
@@ -1508,7 +1508,7 @@ fn build_reduced_graph_for_view_item(&mut self, view_item: &ViewItem,
                                                               false,
                                                               true));
                     debug!("(build reduced graph for item) found extern `{}`",
-                            self.module_to_str(&*external_module));
+                            self.module_to_string(&*external_module));
                     parent.module().external_module_children.borrow_mut()
                                    .insert(name.name, external_module.clone());
                     self.build_reduced_graph_for_external_crate(external_module);
@@ -1862,7 +1862,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self,
     /// Builds the reduced graph rooted at the given external module.
     fn populate_external_module(&mut self, module: Rc<Module>) {
         debug!("(populating external module) attempting to populate {}",
-               self.module_to_str(&*module));
+               self.module_to_string(&*module));
 
         let def_id = match module.def_id.get() {
             None => {
@@ -1930,7 +1930,7 @@ fn build_import_directive(&mut self,
             SingleImport(target, _) => {
                 debug!("(building import directive) building import \
                         directive: {}::{}",
-                       self.idents_to_str(module_.imports.borrow().last().unwrap()
+                       self.idents_to_string(module_.imports.borrow().last().unwrap()
                                                  .module_path.as_slice()),
                        token::get_ident(target));
 
@@ -2003,7 +2003,7 @@ fn resolve_imports(&mut self) {
     /// submodules.
     fn resolve_imports_for_module_subtree(&mut self, module_: Rc<Module>) {
         debug!("(resolving imports for module subtree) resolving {}",
-               self.module_to_str(&*module_));
+               self.module_to_string(&*module_));
         let orig_module = replace(&mut self.current_module, module_.clone());
         self.resolve_imports_for_module(module_.clone());
         self.current_module = orig_module;
@@ -2030,7 +2030,7 @@ fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
         if module.all_imports_resolved() {
             debug!("(resolving imports for module) all imports resolved for \
                    {}",
-                   self.module_to_str(&*module));
+                   self.module_to_string(&*module));
             return;
         }
 
@@ -2047,7 +2047,7 @@ fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
                         None => (import_directive.span, String::new())
                     };
                     let msg = format!("unresolved import `{}`{}",
-                                      self.import_path_to_str(
+                                      self.import_path_to_string(
                                           import_directive.module_path
                                                           .as_slice(),
                                           import_directive.subclass),
@@ -2063,7 +2063,7 @@ fn resolve_imports_for_module(&mut self, module: Rc<Module>) {
         }
     }
 
-    fn idents_to_str(&self, idents: &[Ident]) -> String {
+    fn idents_to_string(&self, idents: &[Ident]) -> String {
         let mut first = true;
         let mut result = String::new();
         for ident in idents.iter() {
@@ -2077,15 +2077,15 @@ fn idents_to_str(&self, idents: &[Ident]) -> String {
         result
     }
 
-    fn path_idents_to_str(&self, path: &Path) -> String {
+    fn path_idents_to_string(&self, path: &Path) -> String {
         let identifiers: Vec<ast::Ident> = path.segments
                                              .iter()
                                              .map(|seg| seg.identifier)
                                              .collect();
-        self.idents_to_str(identifiers.as_slice())
+        self.idents_to_string(identifiers.as_slice())
     }
 
-    fn import_directive_subclass_to_str(&mut self,
+    fn import_directive_subclass_to_string(&mut self,
                                         subclass: ImportDirectiveSubclass)
                                         -> String {
         match subclass {
@@ -2096,16 +2096,16 @@ fn import_directive_subclass_to_str(&mut self,
         }
     }
 
-    fn import_path_to_str(&mut self,
+    fn import_path_to_string(&mut self,
                           idents: &[Ident],
                           subclass: ImportDirectiveSubclass)
                           -> String {
         if idents.is_empty() {
-            self.import_directive_subclass_to_str(subclass)
+            self.import_directive_subclass_to_string(subclass)
         } else {
             (format!("{}::{}",
-                     self.idents_to_str(idents),
-                     self.import_directive_subclass_to_str(
+                     self.idents_to_string(idents),
+                     self.import_directive_subclass_to_string(
                          subclass))).to_string()
         }
     }
@@ -2124,8 +2124,8 @@ fn resolve_import_for_module(&mut self,
 
         debug!("(resolving import for module) resolving import `{}::...` in \
                 `{}`",
-               self.idents_to_str(module_path.as_slice()),
-               self.module_to_str(&*module_));
+               self.idents_to_string(module_path.as_slice()),
+               self.module_to_string(&*module_));
 
         // First, resolve the module path for the directive, if necessary.
         let container = if module_path.len() == 0 {
@@ -2231,9 +2231,9 @@ fn resolve_single_import(&mut self,
         debug!("(resolving single import) resolving `{}` = `{}::{}` from \
                 `{}` id {}, last private {:?}",
                token::get_ident(target),
-               self.module_to_str(&*containing_module),
+               self.module_to_string(&*containing_module),
                token::get_ident(source),
-               self.module_to_str(module_),
+               self.module_to_string(module_),
                directive.id,
                lp);
 
@@ -2420,7 +2420,7 @@ fn get_binding(this: &mut Resolver,
         if value_result.is_unbound() && type_result.is_unbound() {
             let msg = format!("There is no `{}` in `{}`",
                               token::get_ident(source),
-                              self.module_to_str(&*containing_module));
+                              self.module_to_string(&*containing_module));
             return Failed(Some((directive.span, msg)));
         }
         let value_used_public = value_used_reexport || value_used_public;
@@ -2494,7 +2494,7 @@ fn resolve_glob_import(&mut self,
             debug!("(resolving glob import) writing module resolution \
                     {:?} into `{}`",
                    target_import_resolution.type_target.is_none(),
-                   self.module_to_str(module_));
+                   self.module_to_string(module_));
 
             if !target_import_resolution.is_public {
                 debug!("(resolving glob import) nevermind, just kidding");
@@ -2590,9 +2590,9 @@ fn merge_import_resolution(&mut self,
 
         debug!("(resolving glob import) writing resolution `{}` in `{}` \
                to `{}`",
-               token::get_name(name).get().to_str(),
-               self.module_to_str(&*containing_module),
-               self.module_to_str(module_));
+               token::get_name(name).get().to_string(),
+               self.module_to_string(&*containing_module),
+               self.module_to_string(module_));
 
         // Merge the child item into the import resolution.
         if name_bindings.defined_in_public_namespace(ValueNS) {
@@ -2652,7 +2652,7 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                                               false) {
                 Failed(None) => {
                     let segment_name = token::get_ident(name);
-                    let module_name = self.module_to_str(&*search_module);
+                    let module_name = self.module_to_string(&*search_module);
                     let mut span = span;
                     let msg = if "???" == module_name.as_slice() {
                         span.hi = span.lo + Pos::from_uint(segment_name.get().len());
@@ -2660,10 +2660,10 @@ fn search_parent_externals(needle: Name, module: &Rc<Module>)
                         match search_parent_externals(name.name,
                                                      &self.current_module) {
                             Some(module) => {
-                                let path_str = self.idents_to_str(module_path);
-                                let target_mod_str = self.module_to_str(&*module);
+                                let path_str = self.idents_to_string(module_path);
+                                let target_mod_str = self.module_to_string(&*module);
                                 let current_mod_str =
-                                    self.module_to_str(&*self.current_module);
+                                    self.module_to_string(&*self.current_module);
 
                                 let prefix = if target_mod_str == current_mod_str {
                                     "self::".to_string()
@@ -2771,8 +2771,8 @@ fn resolve_module_path(&mut self,
 
         debug!("(resolving module path for import) processing `{}` rooted at \
                `{}`",
-               self.idents_to_str(module_path),
-               self.module_to_str(&*module_));
+               self.idents_to_string(module_path),
+               self.module_to_string(&*module_));
 
         // Resolve the module prefix, if any.
         let module_prefix_result = self.resolve_module_prefix(module_.clone(),
@@ -2783,7 +2783,7 @@ fn resolve_module_path(&mut self,
         let last_private;
         match module_prefix_result {
             Failed(None) => {
-                let mpath = self.idents_to_str(module_path);
+                let mpath = self.idents_to_string(module_path);
                 let mpath = mpath.as_slice();
                 match mpath.rfind(':') {
                     Some(idx) => {
@@ -2865,7 +2865,7 @@ fn resolve_item_in_lexical_scope(&mut self,
                 namespace {:?} in `{}`",
                token::get_ident(name),
                namespace,
-               self.module_to_str(&*module_));
+               self.module_to_string(&*module_));
 
         // The current module node is handled specially. First, check for
         // its immediate children.
@@ -3098,7 +3098,7 @@ fn resolve_module_prefix(&mut self,
                 break
             }
             debug!("(resolving module prefix) resolving `super` at {}",
-                   self.module_to_str(&*containing_module));
+                   self.module_to_string(&*containing_module));
             match self.get_nearest_normal_module_parent(containing_module) {
                 None => return Failed(None),
                 Some(new_module) => {
@@ -3109,7 +3109,7 @@ fn resolve_module_prefix(&mut self,
         }
 
         debug!("(resolving module prefix) finished resolving prefix at {}",
-               self.module_to_str(&*containing_module));
+               self.module_to_string(&*containing_module));
 
         return Success(PrefixFound(containing_module, i));
     }
@@ -3129,7 +3129,7 @@ fn resolve_name_in_module(&mut self,
                               -> ResolveResult<(Target, bool)> {
         debug!("(resolving name in module) resolving `{}` in `{}`",
                token::get_name(name).get(),
-               self.module_to_str(&*module_));
+               self.module_to_string(&*module_));
 
         // First, check the direct children of the module.
         self.populate_module_if_necessary(&module_);
@@ -3262,19 +3262,19 @@ fn record_exports_for_module_subtree(&mut self,
                 // OK. Continue.
                 debug!("(recording exports for module subtree) recording \
                         exports for local module `{}`",
-                       self.module_to_str(&*module_));
+                       self.module_to_string(&*module_));
             }
             None => {
                 // Record exports for the root module.
                 debug!("(recording exports for module subtree) recording \
                         exports for root module `{}`",
-                       self.module_to_str(&*module_));
+                       self.module_to_string(&*module_));
             }
             Some(_) => {
                 // Bail out.
                 debug!("(recording exports for module subtree) not recording \
                         exports for `{}`",
-                       self.module_to_str(&*module_));
+                       self.module_to_string(&*module_));
                 return;
             }
         }
@@ -3390,7 +3390,7 @@ fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
                     None => {
                         debug!("!!! (with scope) didn't find `{}` in `{}`",
                                token::get_ident(name),
-                               self.module_to_str(&*orig_module));
+                               self.module_to_string(&*orig_module));
                     }
                     Some(name_bindings) => {
                         match (*name_bindings).get_module_if_available() {
@@ -3398,7 +3398,7 @@ fn with_scope(&mut self, name: Option<Ident>, f: |&mut Resolver|) {
                                 debug!("!!! (with scope) didn't find module \
                                         for `{}` in `{}`",
                                        token::get_ident(name),
-                                       self.module_to_str(&*orig_module));
+                                       self.module_to_string(&*orig_module));
                             }
                             Some(module_) => {
                                 self.current_module = module_;
@@ -3892,7 +3892,7 @@ fn resolve_trait_reference(&mut self,
                                    reference_type: TraitReferenceType) {
         match self.resolve_path(id, &trait_reference.path, TypeNS, true) {
             None => {
-                let path_str = self.path_idents_to_str(&trait_reference.path);
+                let path_str = self.path_idents_to_string(&trait_reference.path);
                 let usage_str = match reference_type {
                     TraitBoundingTypeParameter => "bound type parameter with",
                     TraitImplementation        => "implement",
@@ -3911,7 +3911,7 @@ fn resolve_trait_reference(&mut self,
                     (def, _) => {
                         self.resolve_error(trait_reference.path.span,
                                            format!("`{}` is not a trait",
-                                                   self.path_idents_to_str(
+                                                   self.path_idents_to_string(
                                                         &trait_reference.path)));
 
                         // If it's a typedef, give a note
@@ -3959,7 +3959,7 @@ fn resolve_struct(&mut self,
                                                             .identifier),
                                        def);
                                 debug!("(resolving struct) writing resolution for `{}` (id {})",
-                                       this.path_idents_to_str(path),
+                                       this.path_idents_to_string(path),
                                        path_id);
                                 this.record_def(path_id, (def, lp));
                             }
@@ -4071,7 +4071,7 @@ fn check_trait_method(&self, method: &Method) {
             let method_name = method.ident.name;
 
             if self.method_map.borrow().find(&(method_name, did)).is_none() {
-                let path_str = self.path_idents_to_str(&trait_ref.path);
+                let path_str = self.path_idents_to_string(&trait_ref.path);
                 self.resolve_error(method.span,
                                     format!("method `{}` is not a member of trait `{}`",
                                             token::get_name(method_name),
@@ -4281,13 +4281,13 @@ fn resolve_type(&mut self, ty: &Ty) {
                         // Write the result into the def map.
                         debug!("(resolving type) writing resolution for `{}` \
                                 (id {})",
-                               self.path_idents_to_str(path),
+                               self.path_idents_to_string(path),
                                path_id);
                         self.record_def(path_id, def);
                     }
                     None => {
                         let msg = format!("use of undeclared type name `{}`",
-                                          self.path_idents_to_str(path));
+                                          self.path_idents_to_string(path));
                         self.resolve_error(ty.span, msg.as_slice());
                     }
                 }
@@ -4488,7 +4488,7 @@ struct or enum variant",
                             debug!("(resolving pattern) didn't find struct \
                                     def: {:?}", result);
                             let msg = format!("`{}` does not name a structure",
-                                              self.path_idents_to_str(path));
+                                              self.path_idents_to_string(path));
                             self.resolve_error(path.span, msg.as_slice());
                         }
                     }
@@ -4718,7 +4718,7 @@ fn resolve_module_relative_path(&mut self,
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared module `{}`",
-                                          self.idents_to_str(
+                                          self.idents_to_string(
                                                module_path_idents.as_slice()));
                         (path.span, msg)
                     }
@@ -4794,7 +4794,7 @@ fn resolve_crate_relative_path(&mut self,
                     Some((span, msg)) => (span, msg),
                     None => {
                         let msg = format!("Use of undeclared module `::{}`",
-                                          self.idents_to_str(
+                                          self.idents_to_string(
                                                module_path_idents.as_slice()));
                         (path.span, msg)
                     }
@@ -4999,7 +4999,7 @@ fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
         match get_module(self, path.span, ident_path.as_slice()) {
             Some(module) => match module.children.borrow().find(&name) {
                 Some(binding) => {
-                    let p_str = self.path_idents_to_str(&path);
+                    let p_str = self.path_idents_to_string(&path);
                     match binding.def_for_namespace(ValueNS) {
                         Some(DefStaticMethod(_, provenance, _)) => {
                             match provenance {
@@ -5021,7 +5021,7 @@ fn get_module(this: &mut Resolver, span: Span, ident_path: &[ast::Ident])
         let method_map = self.method_map.borrow();
         match self.current_trait_ref {
             Some((did, ref trait_ref)) => {
-                let path_str = self.path_idents_to_str(&trait_ref.path);
+                let path_str = self.path_idents_to_string(&trait_ref.path);
 
                 match method_map.find(&(name, did)) {
                     Some(&SelfStatic) => return StaticTraitMethod(path_str),
@@ -5094,7 +5094,7 @@ fn resolve_expr(&mut self, expr: &Expr) {
                     Some(def) => {
                         // Write the result into the def map.
                         debug!("(resolving expr) resolved `{}`",
-                               self.path_idents_to_str(path));
+                               self.path_idents_to_string(path));
 
                         // First-class methods are not supported yet; error
                         // out here.
@@ -5114,7 +5114,7 @@ fn resolve_expr(&mut self, expr: &Expr) {
                         self.record_def(expr.id, def);
                     }
                     None => {
-                        let wrong_name = self.path_idents_to_str(path);
+                        let wrong_name = self.path_idents_to_string(path);
                         // Be helpful if the name refers to a struct
                         // (The pattern matching def_tys where the id is in self.structs
                         // matches on regular structs while excluding tuple- and enum-like
@@ -5210,7 +5210,7 @@ fn resolve_expr(&mut self, expr: &Expr) {
                         debug!("(resolving expression) didn't find struct \
                                 def: {:?}", result);
                         let msg = format!("`{}` does not name a structure",
-                                          self.path_idents_to_str(path));
+                                          self.path_idents_to_string(path));
                         self.resolve_error(path.span, msg.as_slice());
                     }
                 }
@@ -5510,7 +5510,7 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
     //
 
     /// A somewhat inefficient routine to obtain the name of a module.
-    fn module_to_str(&self, module: &Module) -> String {
+    fn module_to_string(&self, module: &Module) -> String {
         let mut idents = Vec::new();
 
         fn collect_mod(idents: &mut Vec<ast::Ident>, module: &Module) {
@@ -5531,14 +5531,14 @@ fn collect_mod(idents: &mut Vec<ast::Ident>, module: &Module) {
         if idents.len() == 0 {
             return "???".to_string();
         }
-        self.idents_to_str(idents.move_iter().rev()
+        self.idents_to_string(idents.move_iter().rev()
                                  .collect::<Vec<ast::Ident>>()
                                  .as_slice())
     }
 
     #[allow(dead_code)]   // useful for debugging
     fn dump_module(&mut self, module_: Rc<Module>) {
-        debug!("Dump of module `{}`:", self.module_to_str(&*module_));
+        debug!("Dump of module `{}`:", self.module_to_string(&*module_));
 
         debug!("Children:");
         self.populate_module_if_necessary(&module_);
index 8ff5331cec2319dca978cf60064224f0dddde9c4..1c85413a8d8eb7a02f401790aa209e8620210036 100644 (file)
@@ -24,7 +24,7 @@
 use syntax::owned_slice::OwnedSlice;
 use syntax::parse::token::special_idents;
 use syntax::parse::token;
-use syntax::print::pprust::{lifetime_to_str};
+use syntax::print::pprust::{lifetime_to_string};
 use syntax::visit;
 use syntax::visit::Visitor;
 use util::nodemap::NodeMap;
@@ -372,7 +372,7 @@ fn insert_lifetime(&mut self,
         }
 
         debug!("lifetime_ref={} id={} resolved to {:?}",
-                lifetime_to_str(lifetime_ref),
+                lifetime_to_string(lifetime_ref),
                 lifetime_ref.id,
                 def);
         self.named_region_map.insert(lifetime_ref.id, def);
index 1bb5ffdccb504567b5ecb53602545424986aa932..d16e2bbf66b937ff57a33236813c1de91cdee6e6 100644 (file)
@@ -51,7 +51,7 @@
 use syntax::parse::token::{get_ident,keywords};
 use syntax::visit;
 use syntax::visit::Visitor;
-use syntax::print::pprust::{path_to_str,ty_to_str};
+use syntax::print::pprust::{path_to_string,ty_to_string};
 
 use middle::save::span_utils::SpanUtils;
 use middle::save::recorder::Recorder;
@@ -108,7 +108,7 @@ fn process_path_prefixes(&self, path: &ast::Path) -> Vec<(Span, String)> {
         if spans.len() < path.segments.len() {
             error!("Mis-calculated spans for path '{}'. \
                     Found {} spans, expected {}. Found spans:",
-                   path_to_str(path), spans.len(), path.segments.len());
+                   path_to_string(path), spans.len(), path.segments.len());
             for s in spans.iter() {
                 let loc = self.sess.codemap().lookup_char_pos(s.lo);
                 error!("    '{}' in {}, line {}",
@@ -126,7 +126,7 @@ fn process_path_prefixes(&self, path: &ast::Path) -> Vec<(Span, String)> {
             let sub_path = ast::Path{span: *span, // span for the last segment
                                      global: path.global,
                                      segments: segs};
-            let qualname = path_to_str(&sub_path);
+            let qualname = path_to_string(&sub_path);
             result.push((*span, qualname));
             segs = sub_path.segments;
         }
@@ -249,7 +249,7 @@ fn process_formals(&mut self, formals: &Vec<ast::Arg>, qualname: &str, e:DxrVisi
             self.collecting = false;
             let span_utils = self.span;
             for &(id, ref p, _, _) in self.collected_paths.iter() {
-                let typ = ppaux::ty_to_str(&self.analysis.ty_cx,
+                let typ = ppaux::ty_to_string(&self.analysis.ty_cx,
                     *self.analysis.ty_cx.node_types.borrow().get(&(id as uint)));
                 // get the span only for the name of the variable (I hope the path is only ever a
                 // variable name, but who knows?)
@@ -257,7 +257,7 @@ fn process_formals(&mut self, formals: &Vec<ast::Arg>, qualname: &str, e:DxrVisi
                                     span_utils.span_for_last_ident(p.span),
                                     id,
                                     qualname,
-                                    path_to_str(p).as_slice(),
+                                    path_to_string(p).as_slice(),
                                     typ.as_slice());
             }
             self.collected_paths.clear();
@@ -280,7 +280,7 @@ fn process_method(&mut self, method: &ast::Method, e:DxrVisitorEnv) {
                     match item.node {
                         ast::ItemImpl(_, _, ty, _) => {
                             let mut result = String::from_str("<");
-                            result.push_str(ty_to_str(&*ty).as_slice());
+                            result.push_str(ty_to_string(&*ty).as_slice());
 
                             match ty::trait_of_method(&self.analysis.ty_cx,
                                                       ast_util::local_def(method.id)) {
@@ -400,7 +400,7 @@ fn process_struct_field_def(&mut self,
             ast::NamedField(ident, _) => {
                 let name = get_ident(ident);
                 let qualname = format!("{}::{}", qualname, name);
-                let typ = ppaux::ty_to_str(&self.analysis.ty_cx,
+                let typ = ppaux::ty_to_string(&self.analysis.ty_cx,
                     *self.analysis.ty_cx.node_types.borrow().get(&(field.node.id as uint)));
                 match self.span.sub_span_before_token(field.span, token::COLON) {
                     Some(sub_span) => self.fmt.field_str(field.span,
@@ -452,7 +452,7 @@ fn process_fn(&mut self,
                   decl: ast::P<ast::FnDecl>,
                   ty_params: &ast::Generics,
                   body: ast::P<ast::Block>) {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
 
         let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Fn);
         self.fmt.fn_str(item.span,
@@ -482,7 +482,7 @@ fn process_static(&mut self,
                       mt: ast::Mutability,
                       expr: &ast::Expr)
     {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
 
         // If the variable is immutable, save the initialising expression.
         let value = match mt {
@@ -497,7 +497,7 @@ fn process_static(&mut self,
                             get_ident(item.ident).get(),
                             qualname.as_slice(),
                             value.as_slice(),
-                            ty_to_str(&*typ).as_slice(),
+                            ty_to_string(&*typ).as_slice(),
                             e.cur_scope);
 
         // walk type and init value
@@ -510,7 +510,7 @@ fn process_struct(&mut self,
                       e: DxrVisitorEnv,
                       def: &ast::StructDef,
                       ty_params: &ast::Generics) {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
 
         let ctor_id = match def.ctor_id {
             Some(node_id) => node_id,
@@ -538,7 +538,7 @@ fn process_enum(&mut self,
                     e: DxrVisitorEnv,
                     enum_definition: &ast::EnumDef,
                     ty_params: &ast::Generics) {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
         match self.span.sub_span_after_keyword(item.span, keywords::Enum) {
             Some(sub_span) => self.fmt.enum_str(item.span,
                                                 Some(sub_span),
@@ -639,7 +639,7 @@ fn process_trait(&mut self,
                      generics: &ast::Generics,
                      trait_refs: &Vec<ast::TraitRef>,
                      methods: &Vec<ast::TraitMethod>) {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
 
         let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Trait);
         self.fmt.trait_str(item.span,
@@ -678,7 +678,7 @@ fn process_mod(&mut self,
                    item: &ast::Item,  // The module in question, represented as an item.
                    e: DxrVisitorEnv,
                    m: &ast::Mod) {
-        let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
+        let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
 
         let cm = self.sess.codemap();
         let filename = cm.span_to_filename(m.inner);
@@ -971,8 +971,8 @@ fn visit_item(&mut self, item:&ast::Item, e: DxrVisitorEnv) {
                 self.process_trait(item, e, generics, trait_refs, methods),
             ast::ItemMod(ref m) => self.process_mod(item, e, m),
             ast::ItemTy(ty, ref ty_params) => {
-                let qualname = self.analysis.ty_cx.map.path_to_str(item.id);
-                let value = ty_to_str(&*ty);
+                let qualname = self.analysis.ty_cx.map.path_to_string(item.id);
+                let value = ty_to_string(&*ty);
                 let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Type);
                 self.fmt.typedef_str(item.span,
                                      sub_span,
@@ -1231,7 +1231,7 @@ fn visit_expr(&mut self, ex: &ast::Expr, e: DxrVisitorEnv) {
                     return
                 }
 
-                let id = String::from_str("$").append(ex.id.to_str().as_slice());
+                let id = String::from_str("$").append(ex.id.to_string().as_slice());
                 self.process_formals(&decl.inputs, id.as_slice(), e);
 
                 // walk arg and return types
@@ -1288,7 +1288,7 @@ fn visit_arm(&mut self, arm: &ast::Arm, e: DxrVisitorEnv) {
                 def::DefBinding(id, _)  => self.fmt.variable_str(p.span,
                                                                  sub_span,
                                                                  id,
-                                                                 path_to_str(p).as_slice(),
+                                                                 path_to_string(p).as_slice(),
                                                                  value.as_slice(),
                                                                  ""),
                 def::DefVariant(_,id,_) => self.fmt.ref_str(ref_kind,
@@ -1331,7 +1331,7 @@ fn visit_local(&mut self, l:&ast::Local, e: DxrVisitorEnv) {
         for &(id, ref p, ref immut, _) in self.collected_paths.iter() {
             let value = if *immut { value.to_owned() } else { "<mutable>".to_owned() };
             let types = self.analysis.ty_cx.node_types.borrow();
-            let typ = ppaux::ty_to_str(&self.analysis.ty_cx, *types.get(&(id as uint)));
+            let typ = ppaux::ty_to_string(&self.analysis.ty_cx, *types.get(&(id as uint)));
             // Get the span only for the name of the variable (I hope the path
             // is only ever a variable name, but who knows?).
             let sub_span = self.span.span_for_last_ident(p.span);
@@ -1339,7 +1339,7 @@ fn visit_local(&mut self, l:&ast::Local, e: DxrVisitorEnv) {
             self.fmt.variable_str(p.span,
                                   sub_span,
                                   id,
-                                  path_to_str(p).as_slice(),
+                                  path_to_string(p).as_slice(),
                                   value.as_slice(),
                                   typ.as_slice());
         }
index fd76d6d37d10d932709447f110e8c9a6e992c599..7869aec1683c20c115814223a1e706ecb478b516 100644 (file)
@@ -252,7 +252,7 @@ pub fn variable_str(&mut self,
         // the local case they can be overridden in one block and there is no nice way
         // to refer to such a scope in english, so we just hack it by appending the
         // variable def's node id
-        let qualname = String::from_str(name).append("$").append(id.to_str().as_slice());
+        let qualname = String::from_str(name).append("$").append(id.to_string().as_slice());
         self.check_and_record(Variable,
                               span,
                               sub_span,
index 11d09aa49cfcd3b7f2a7ae20e169aa8933c57184..3cfd1aaee8ff39a37e0f6c9a9d1dcfccdd01cfcd 100644 (file)
 use middle::trans::debuginfo;
 use middle::ty;
 use util::common::indenter;
-use util::ppaux::{Repr, vec_map_to_str};
+use util::ppaux::{Repr, vec_map_to_string};
 
 use std;
 use std::collections::HashMap;
@@ -409,7 +409,7 @@ fn expand_nested_bindings<'a, 'b>(
            bcx.to_str(),
            m.repr(bcx.tcx()),
            col,
-           bcx.val_to_str(val));
+           bcx.val_to_string(val));
     let _indenter = indenter();
 
     m.iter().map(|br| {
@@ -449,7 +449,7 @@ fn enter_match<'a, 'b>(
            bcx.to_str(),
            m.repr(bcx.tcx()),
            col,
-           bcx.val_to_str(val));
+           bcx.val_to_string(val));
     let _indenter = indenter();
 
     m.iter().filter_map(|br| {
@@ -485,7 +485,7 @@ fn enter_default<'a, 'b>(
            bcx.to_str(),
            m.repr(bcx.tcx()),
            col,
-           bcx.val_to_str(val));
+           bcx.val_to_string(val));
     let _indenter = indenter();
 
     // Collect all of the matches that can match against anything.
@@ -541,7 +541,7 @@ fn enter_opt<'a, 'b>(
            m.repr(bcx.tcx()),
            *opt,
            col,
-           bcx.val_to_str(val));
+           bcx.val_to_string(val));
     let _indenter = indenter();
 
     let ctor = match opt {
@@ -922,7 +922,7 @@ fn compare_str<'a>(cx: &'a Block<'a>,
         let did = langcall(cx,
                            None,
                            format!("comparison of `{}`",
-                                   cx.ty_to_str(rhs_t)).as_slice(),
+                                   cx.ty_to_string(rhs_t)).as_slice(),
                            StrEqFnLangItem);
         callee::trans_lang_call(cx, did, [lhs, rhs], None)
     }
@@ -988,7 +988,7 @@ fn insert_lllocals<'a>(mut bcx: &'a Block<'a>, bindings_map: &BindingsMap,
 
         debug!("binding {:?} to {}",
                binding_info.id,
-               bcx.val_to_str(llval));
+               bcx.val_to_string(llval));
         bcx.fcx.lllocals.borrow_mut().insert(binding_info.id, datum);
 
         if bcx.sess().opts.debuginfo == FullDebugInfo {
@@ -1011,9 +1011,9 @@ fn compile_guard<'a, 'b>(
                  -> &'b Block<'b> {
     debug!("compile_guard(bcx={}, guard_expr={}, m={}, vals={})",
            bcx.to_str(),
-           bcx.expr_to_str(guard_expr),
+           bcx.expr_to_string(guard_expr),
            m.repr(bcx.tcx()),
-           vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
+           vec_map_to_string(vals, |v| bcx.val_to_string(*v)));
     let _indenter = indenter();
 
     let mut bcx = insert_lllocals(bcx, &data.bindings_map, None);
@@ -1050,7 +1050,7 @@ fn compile_submatch<'a, 'b>(
     debug!("compile_submatch(bcx={}, m={}, vals={})",
            bcx.to_str(),
            m.repr(bcx.tcx()),
-           vec_map_to_str(vals, |v| bcx.val_to_str(*v)));
+           vec_map_to_string(vals, |v| bcx.val_to_string(*v)));
     let _indenter = indenter();
     let _icx = push_ctxt("match::compile_submatch");
     let mut bcx = bcx;
@@ -1155,7 +1155,7 @@ fn compile_submatch_continue<'a, 'b>(
     debug!("options={:?}", opts);
     let mut kind = no_branch;
     let mut test_val = val;
-    debug!("test_val={}", bcx.val_to_str(test_val));
+    debug!("test_val={}", bcx.val_to_string(test_val));
     if opts.len() > 0u {
         match *opts.get(0) {
             var(_, ref repr, _) => {
index 4c7db01657bc9e81950b90c77069ad1665ea5456..898cb036ea5374954c7bd9d59a812135cc9569cf 100644 (file)
@@ -63,7 +63,7 @@
 use syntax::ast;
 use syntax::attr;
 use syntax::attr::IntType;
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 type Hint = attr::ReprAttr;
 
@@ -135,7 +135,7 @@ pub fn represent_node(bcx: &Block, node: ast::NodeId) -> Rc<Repr> {
 
 /// Decides how to represent a given type.
 pub fn represent_type(cx: &CrateContext, t: ty::t) -> Rc<Repr> {
-    debug!("Representing: {}", ty_to_str(cx.tcx(), t));
+    debug!("Representing: {}", ty_to_string(cx.tcx(), t));
     match cx.adt_reprs.borrow().find(&t) {
         Some(repr) => return repr.clone(),
         None => {}
index 08cdde38c34601fe2dc94b9066eddfb1bad478c0..84b253306ff57ccf9a79adeca63140a4388c3ccb 100644 (file)
@@ -71,7 +71,7 @@
 use middle::ty;
 use middle::typeck;
 use util::common::indenter;
-use util::ppaux::{Repr, ty_to_str};
+use util::ppaux::{Repr, ty_to_string};
 use util::sha2::Sha256;
 use util::nodemap::NodeMap;
 
@@ -301,7 +301,7 @@ fn require_alloc_fn(bcx: &Block, info_ty: ty::t, it: LangItem) -> ast::DefId {
         Ok(id) => id,
         Err(s) => {
             bcx.sess().fatal(format!("allocation of `{}` {}",
-                                     bcx.ty_to_str(info_ty),
+                                     bcx.ty_to_string(info_ty),
                                      s).as_slice());
         }
     }
@@ -706,7 +706,7 @@ fn iter_variant<'r,
                       let variant_cx =
                           fcx.new_temp_block(
                               format!("enum-iter-variant-{}",
-                                      variant.disr_val.to_str().as_slice())
+                                      variant.disr_val.to_string().as_slice())
                                      .as_slice());
                       match adt::trans_case(cx, &*repr, variant.disr_val) {
                           _match::single_result(r) => {
@@ -809,7 +809,7 @@ pub fn fail_if_zero_or_overflows<'a>(
         }
         _ => {
             cx.sess().bug(format!("fail-if-zero on unexpected type: {}",
-                                  ty_to_str(cx.tcx(), rhs_t)).as_slice());
+                                  ty_to_string(cx.tcx(), rhs_t)).as_slice());
         }
     };
     let bcx = with_cond(cx, is_zero, |bcx| {
@@ -903,7 +903,7 @@ pub fn invoke<'a>(
             debug!("invoke at ???");
         }
         Some(id) => {
-            debug!("invoke at {}", bcx.tcx().map.node_to_str(id));
+            debug!("invoke at {}", bcx.tcx().map.node_to_string(id));
         }
     }
 
@@ -1173,7 +1173,7 @@ pub fn new_fn_ctxt<'a>(ccx: &'a CrateContext,
            if id == -1 {
                "".to_string()
            } else {
-               ccx.tcx.map.path_to_str(id).to_string()
+               ccx.tcx.map.path_to_string(id).to_string()
            },
            id, param_substs.repr(ccx.tcx()));
 
@@ -1474,7 +1474,7 @@ pub fn trans_fn(ccx: &CrateContext,
                 param_substs: &param_substs,
                 id: ast::NodeId,
                 attrs: &[ast::Attribute]) {
-    let _s = StatRecorder::new(ccx, ccx.tcx.map.path_to_str(id).to_string());
+    let _s = StatRecorder::new(ccx, ccx.tcx.map.path_to_string(id).to_string());
     debug!("trans_fn(param_substs={})", param_substs.repr(ccx.tcx()));
     let _icx = push_ctxt("trans_fn");
     let output_type = ty::ty_fn_ret(ty::node_id_to_type(ccx.tcx(), id));
@@ -1527,7 +1527,7 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
         _ => ccx.sess().bug(
             format!("trans_enum_variant_or_tuple_like_struct: \
                      unexpected ctor return type {}",
-                    ty_to_str(ccx.tcx(), ctor_ty)).as_slice())
+                    ty_to_string(ccx.tcx(), ctor_ty)).as_slice())
     };
 
     let arena = TypedArena::new();
@@ -2010,7 +2010,7 @@ fn exported_name(ccx: &CrateContext, id: ast::NodeId,
         _ => ccx.tcx.map.with_path(id, |mut path| {
             if attr::contains_name(attrs, "no_mangle") {
                 // Don't mangle
-                path.last().unwrap().to_str()
+                path.last().unwrap().to_string()
             } else {
                 match weak_lang_items::link_name(attrs) {
                     Some(name) => name.get().to_string(),
index e1c02f543bf9e7c4ee2046012efeeeb5ce3c69cc..ce11cd24f7b047688a4e3181a1d44cc0bd0fffcb 100644 (file)
@@ -122,8 +122,8 @@ pub fn Invoke(cx: &Block,
     check_not_terminated(cx);
     terminate(cx, "Invoke");
     debug!("Invoke({} with arguments ({}))",
-           cx.val_to_str(fn_),
-           args.iter().map(|a| cx.val_to_str(*a)).collect::<Vec<String>>().connect(", "));
+           cx.val_to_string(fn_),
+           args.iter().map(|a| cx.val_to_string(*a)).collect::<Vec<String>>().connect(", "));
     B(cx).invoke(fn_, args, then, catch, attributes)
 }
 
index a9c1adac3d7cf01e07c3926d4706708e8a087367..3a9e3e4cf9b07f5162f7b2a512c2e3b39d97b4f0 100644 (file)
@@ -161,9 +161,9 @@ pub fn invoke(&self,
         self.count_insn("invoke");
 
         debug!("Invoke {} with args ({})",
-               self.ccx.tn.val_to_str(llfn),
+               self.ccx.tn.val_to_string(llfn),
                args.iter()
-                   .map(|&v| self.ccx.tn.val_to_str(v))
+                   .map(|&v| self.ccx.tn.val_to_string(v))
                    .collect::<Vec<String>>()
                    .connect(", "));
 
@@ -497,8 +497,8 @@ pub fn load_range_assert(&self, ptr: ValueRef, lo: c_ulonglong,
 
     pub fn store(&self, val: ValueRef, ptr: ValueRef) {
         debug!("Store {} -> {}",
-               self.ccx.tn.val_to_str(val),
-               self.ccx.tn.val_to_str(ptr));
+               self.ccx.tn.val_to_string(val),
+               self.ccx.tn.val_to_string(ptr));
         assert!(self.llbuilder.is_not_null());
         self.count_insn("store");
         unsafe {
@@ -508,8 +508,8 @@ pub fn store(&self, val: ValueRef, ptr: ValueRef) {
 
     pub fn volatile_store(&self, val: ValueRef, ptr: ValueRef) {
         debug!("Store {} -> {}",
-               self.ccx.tn.val_to_str(val),
-               self.ccx.tn.val_to_str(ptr));
+               self.ccx.tn.val_to_string(val),
+               self.ccx.tn.val_to_string(ptr));
         assert!(self.llbuilder.is_not_null());
         self.count_insn("store.volatile");
         unsafe {
@@ -520,8 +520,8 @@ pub fn volatile_store(&self, val: ValueRef, ptr: ValueRef) {
 
     pub fn atomic_store(&self, val: ValueRef, ptr: ValueRef, order: AtomicOrdering) {
         debug!("Store {} -> {}",
-               self.ccx.tn.val_to_str(val),
-               self.ccx.tn.val_to_str(ptr));
+               self.ccx.tn.val_to_string(val),
+               self.ccx.tn.val_to_string(ptr));
         self.count_insn("store.atomic");
         unsafe {
             let ty = Type::from_ref(llvm::LLVMTypeOf(ptr));
@@ -760,7 +760,7 @@ pub fn add_span_comment(&self, sp: Span, text: &str) {
         if self.ccx.sess().asm_comments() {
             let s = format!("{} ({})",
                             text,
-                            self.ccx.sess().codemap().span_to_str(sp));
+                            self.ccx.sess().codemap().span_to_string(sp));
             debug!("{}", s.as_slice());
             self.add_comment(s.as_slice());
         }
@@ -794,11 +794,11 @@ pub fn inline_asm_call(&self, asm: *const c_char, cons: *const c_char,
                          else          { lib::llvm::False };
 
         let argtys = inputs.iter().map(|v| {
-            debug!("Asm Input Type: {:?}", self.ccx.tn.val_to_str(*v));
+            debug!("Asm Input Type: {:?}", self.ccx.tn.val_to_string(*v));
             val_ty(*v)
         }).collect::<Vec<_>>();
 
-        debug!("Asm Output Type: {:?}", self.ccx.tn.type_to_str(output));
+        debug!("Asm Output Type: {:?}", self.ccx.tn.type_to_string(output));
         let fty = Type::func(argtys.as_slice(), &output);
         unsafe {
             let v = llvm::LLVMInlineAsm(
@@ -812,9 +812,9 @@ pub fn call(&self, llfn: ValueRef, args: &[ValueRef],
         self.count_insn("call");
 
         debug!("Call {} with args ({})",
-               self.ccx.tn.val_to_str(llfn),
+               self.ccx.tn.val_to_string(llfn),
                args.iter()
-                   .map(|&v| self.ccx.tn.val_to_str(v))
+                   .map(|&v| self.ccx.tn.val_to_string(v))
                    .collect::<Vec<String>>()
                    .connect(", "));
 
index c5361045549eb94b09305f5d48fe8a9486c710fb..2e4a3d9fd7e3ed910a1fd38c8a7bbe27c3b3457a 100644 (file)
@@ -108,7 +108,7 @@ fn datum_callee<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {
                     expr.span,
                     format!("type of callee is neither bare-fn nor closure: \
                              {}",
-                            bcx.ty_to_str(datum.ty)).as_slice());
+                            bcx.ty_to_string(datum.ty)).as_slice());
             }
         }
     }
@@ -905,7 +905,7 @@ pub fn trans_arg_datum<'a>(
 
     let arg_datum_ty = arg_datum.ty;
 
-    debug!("   arg datum: {}", arg_datum.to_str(bcx.ccx()));
+    debug!("   arg datum: {}", arg_datum.to_string(bcx.ccx()));
 
     let mut val;
     if ty::type_is_bot(arg_datum_ty) {
@@ -949,11 +949,11 @@ pub fn trans_arg_datum<'a>(
             // this could happen due to e.g. subtyping
             let llformal_arg_ty = type_of::type_of_explicit_arg(ccx, formal_arg_ty);
             debug!("casting actual type ({}) to match formal ({})",
-                   bcx.val_to_str(val), bcx.llty_str(llformal_arg_ty));
+                   bcx.val_to_string(val), bcx.llty_str(llformal_arg_ty));
             val = PointerCast(bcx, val, llformal_arg_ty);
         }
     }
 
-    debug!("--- trans_arg_datum passing {}", bcx.val_to_str(val));
+    debug!("--- trans_arg_datum passing {}", bcx.val_to_string(val));
     Result::new(bcx, val)
 }
index 0bcf94997cdbbc23e6ef32f2ef17f50bc566d1bb..0485b100446577910abe00672a4dc468f1421012 100644 (file)
@@ -85,7 +85,7 @@ fn push_ast_cleanup_scope(&self, id: ast::NodeId) {
          */
 
         debug!("push_ast_cleanup_scope({})",
-               self.ccx.tcx.map.node_to_str(id));
+               self.ccx.tcx.map.node_to_string(id));
 
         // FIXME(#2202) -- currently closure bodies have a parent
         // region, which messes up the assertion below, since there
@@ -109,7 +109,7 @@ fn push_loop_cleanup_scope(&self,
                                id: ast::NodeId,
                                exits: [&'a Block<'a>, ..EXIT_MAX]) {
         debug!("push_loop_cleanup_scope({})",
-               self.ccx.tcx.map.node_to_str(id));
+               self.ccx.tcx.map.node_to_string(id));
         assert_eq!(Some(id), self.top_ast_scope());
 
         self.push_scope(CleanupScope::new(LoopScopeKind(id, exits)));
@@ -133,7 +133,7 @@ fn pop_and_trans_ast_cleanup_scope(&self,
          */
 
         debug!("pop_and_trans_ast_cleanup_scope({})",
-               self.ccx.tcx.map.node_to_str(cleanup_scope));
+               self.ccx.tcx.map.node_to_string(cleanup_scope));
 
         assert!(self.top_scope(|s| s.kind.is_ast_with_id(cleanup_scope)));
 
@@ -152,7 +152,7 @@ fn pop_loop_cleanup_scope(&self,
          */
 
         debug!("pop_loop_cleanup_scope({})",
-               self.ccx.tcx.map.node_to_str(cleanup_scope));
+               self.ccx.tcx.map.node_to_string(cleanup_scope));
 
         assert!(self.top_scope(|s| s.kind.is_loop_with_id(cleanup_scope)));
 
@@ -246,7 +246,7 @@ fn schedule_drop_mem(&self,
 
         debug!("schedule_drop_mem({:?}, val={}, ty={})",
                cleanup_scope,
-               self.ccx.tn.val_to_str(val),
+               self.ccx.tn.val_to_string(val),
                ty.repr(self.ccx.tcx()));
 
         self.schedule_clean(cleanup_scope, drop as Box<Cleanup>);
@@ -272,7 +272,7 @@ fn schedule_drop_and_zero_mem(&self,
 
         debug!("schedule_drop_and_zero_mem({:?}, val={}, ty={}, zero={})",
                cleanup_scope,
-               self.ccx.tn.val_to_str(val),
+               self.ccx.tn.val_to_string(val),
                ty.repr(self.ccx.tcx()),
                true);
 
@@ -298,7 +298,7 @@ fn schedule_drop_immediate(&self,
 
         debug!("schedule_drop_immediate({:?}, val={}, ty={})",
                cleanup_scope,
-               self.ccx.tn.val_to_str(val),
+               self.ccx.tn.val_to_string(val),
                ty.repr(self.ccx.tcx()));
 
         self.schedule_clean(cleanup_scope, drop as Box<Cleanup>);
@@ -318,7 +318,7 @@ fn schedule_free_value(&self,
 
         debug!("schedule_free_value({:?}, val={}, heap={:?})",
                cleanup_scope,
-               self.ccx.tn.val_to_str(val),
+               self.ccx.tn.val_to_string(val),
                heap);
 
         self.schedule_clean(cleanup_scope, drop as Box<Cleanup>);
@@ -358,7 +358,7 @@ fn schedule_clean_in_ast_scope(&self,
 
         self.ccx.sess().bug(
             format!("no cleanup scope {} found",
-                    self.ccx.tcx.map.node_to_str(cleanup_scope)).as_slice());
+                    self.ccx.tcx.map.node_to_string(cleanup_scope)).as_slice());
     }
 
     fn schedule_clean_in_custom_scope(&self,
index b2564936fa40668936e58a4de73297de9032b35e..ef147eb22b5064cf321ed6c2ad20b9853329b43b 100644 (file)
@@ -27,7 +27,7 @@
 use middle::trans::type_::Type;
 use middle::ty;
 use util::ppaux::Repr;
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 use arena::TypedArena;
 use syntax::ast;
@@ -104,8 +104,8 @@ pub struct EnvValue {
 }
 
 impl EnvValue {
-    pub fn to_str(&self, ccx: &CrateContext) -> String {
-        format!("{}({})", self.action, self.datum.to_str(ccx))
+    pub fn to_string(&self, ccx: &CrateContext) -> String {
+        format!("{}({})", self.action, self.datum.to_string(ccx))
     }
 }
 
@@ -124,7 +124,7 @@ pub fn mk_closure_tys(tcx: &ty::ctxt,
         }
     }).collect();
     let cdata_ty = ty::mk_tup(tcx, bound_tys);
-    debug!("cdata_ty={}", ty_to_str(tcx, cdata_ty));
+    debug!("cdata_ty={}", ty_to_string(tcx, cdata_ty));
     return cdata_ty;
 }
 
@@ -196,16 +196,16 @@ pub fn store_environment<'a>(
     let Result {bcx: bcx, val: llbox} = allocate_cbox(bcx, store, cdata_ty);
 
     let llbox = PointerCast(bcx, llbox, llboxptr_ty);
-    debug!("tuplify_box_ty = {}", ty_to_str(tcx, cbox_ty));
+    debug!("tuplify_box_ty = {}", ty_to_string(tcx, cbox_ty));
 
     // Copy expr values into boxed bindings.
     let mut bcx = bcx;
     for (i, bv) in bound_values.move_iter().enumerate() {
-        debug!("Copy {} into closure", bv.to_str(ccx));
+        debug!("Copy {} into closure", bv.to_string(ccx));
 
         if ccx.sess().asm_comments() {
             add_comment(bcx, format!("Copy {} into closure",
-                                     bv.to_str(ccx)).as_slice());
+                                     bv.to_string(ccx)).as_slice());
         }
 
         let bound_data = GEPi(bcx, llbox, [0u, abi::box_field_body, i]);
index de5de64e346c331830c5bdef060755532c7ed938..23a391cb86dfefd35e534603313cee49f4f8d4da 100644 (file)
@@ -196,13 +196,13 @@ pub fn validate(&self) {
     }
 }
 
-fn param_substs_to_str(this: &param_substs, tcx: &ty::ctxt) -> String {
+fn param_substs_to_string(this: &param_substs, tcx: &ty::ctxt) -> String {
     format!("param_substs({})", this.substs.repr(tcx))
 }
 
 impl Repr for param_substs {
     fn repr(&self, tcx: &ty::ctxt) -> String {
-        param_substs_to_str(self, tcx)
+        param_substs_to_string(self, tcx)
     }
 }
 
@@ -436,11 +436,11 @@ pub fn ident(&self, ident: Ident) -> String {
         token::get_ident(ident).get().to_string()
     }
 
-    pub fn node_id_to_str(&self, id: ast::NodeId) -> String {
-        self.tcx().map.node_to_str(id).to_string()
+    pub fn node_id_to_string(&self, id: ast::NodeId) -> String {
+        self.tcx().map.node_to_string(id).to_string()
     }
 
-    pub fn expr_to_str(&self, e: &ast::Expr) -> String {
+    pub fn expr_to_string(&self, e: &ast::Expr) -> String {
         e.repr(self.tcx())
     }
 
@@ -454,15 +454,15 @@ pub fn def(&self, nid: ast::NodeId) -> def::Def {
         }
     }
 
-    pub fn val_to_str(&self, val: ValueRef) -> String {
-        self.ccx().tn.val_to_str(val)
+    pub fn val_to_string(&self, val: ValueRef) -> String {
+        self.ccx().tn.val_to_string(val)
     }
 
     pub fn llty_str(&self, ty: Type) -> String {
-        self.ccx().tn.type_to_str(ty)
+        self.ccx().tn.type_to_string(ty)
     }
 
-    pub fn ty_to_str(&self, t: ty::t) -> String {
+    pub fn ty_to_string(&self, t: ty::t) -> String {
         t.repr(self.tcx())
     }
 
@@ -645,7 +645,7 @@ pub fn const_get_elt(cx: &CrateContext, v: ValueRef, us: &[c_uint])
         let r = llvm::LLVMConstExtractValue(v, us.as_ptr(), us.len() as c_uint);
 
         debug!("const_get_elt(v={}, us={:?}, r={})",
-               cx.tn.val_to_str(v), us, cx.tn.val_to_str(r));
+               cx.tn.val_to_string(v), us, cx.tn.val_to_string(r));
 
         return r;
     }
index 52a097ca6f0b03b248147fd76752067fdd0a1a16..c35767f99a8352b4bed711311a9f0783b5ebbc1c 100644 (file)
@@ -31,7 +31,7 @@
 use middle::trans::type_of;
 use middle::trans::debuginfo;
 use middle::ty;
-use util::ppaux::{Repr, ty_to_str};
+use util::ppaux::{Repr, ty_to_string};
 
 use std::c_str::ToCStr;
 use std::gc::Gc;
@@ -59,7 +59,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
                 _ => cx.sess().span_bug(lit.span,
                         format!("integer literal has type {} (expected int \
                                  or uint)",
-                                ty_to_str(cx.tcx(), lit_int_ty)).as_slice())
+                                ty_to_string(cx.tcx(), lit_int_ty)).as_slice())
             }
         }
         ast::LitFloat(ref fs, t) => {
@@ -155,14 +155,14 @@ fn const_deref(cx: &CrateContext, v: ValueRef, t: ty::t, explicit: bool)
                 }
                 _ => {
                     cx.sess().bug(format!("unexpected dereferenceable type {}",
-                                          ty_to_str(cx.tcx(), t)).as_slice())
+                                          ty_to_string(cx.tcx(), t)).as_slice())
                 }
             };
             (dv, mt.ty)
         }
         None => {
             cx.sess().bug(format!("can't dereference const of type {}",
-                                  ty_to_str(cx.tcx(), t)).as_slice())
+                                  ty_to_string(cx.tcx(), t)).as_slice())
         }
     }
 }
@@ -285,7 +285,7 @@ pub fn const_expr(cx: &CrateContext, e: &ast::Expr, is_local: bool) -> (ValueRef
             llvm::LLVMDumpValue(C_undef(llty));
         }
         cx.sess().bug(format!("const {} of type {} has size {} instead of {}",
-                         e.repr(cx.tcx()), ty_to_str(cx.tcx(), ety),
+                         e.repr(cx.tcx()), ty_to_string(cx.tcx(), ety),
                          csize, tsize).as_slice());
     }
     (llconst, inlineable)
index e9b1c56eb00320485f34ccc5767d3e328436ec6b..acc44d08d3cb041b0e548ff2e1b9e8df5d80ee8d 100644 (file)
@@ -126,8 +126,8 @@ pub fn trans_if<'a>(bcx: &'a Block<'a>,
                     dest: expr::Dest)
                     -> &'a Block<'a> {
     debug!("trans_if(bcx={}, if_id={}, cond={}, thn={:?}, dest={})",
-           bcx.to_str(), if_id, bcx.expr_to_str(cond), thn.id,
-           dest.to_str(bcx.ccx()));
+           bcx.to_str(), if_id, bcx.expr_to_string(cond), thn.id,
+           dest.to_string(bcx.ccx()));
     let _icx = push_ctxt("trans_if");
     let mut bcx = bcx;
 
index b93469ad2fba330a9315f428641a9ab383d47407..b65f5a5c7d6b69794d5270ecb01b5d8f9b995854 100644 (file)
@@ -23,7 +23,7 @@
 use middle::trans::tvec;
 use middle::trans::type_of;
 use middle::ty;
-use util::ppaux::{ty_to_str};
+use util::ppaux::{ty_to_string};
 
 use syntax::ast;
 
@@ -596,10 +596,10 @@ pub fn shallow_copy_and_take<'a>(&self,
     }
 
     #[allow(dead_code)] // useful for debugging
-    pub fn to_str(&self, ccx: &CrateContext) -> String {
+    pub fn to_string(&self, ccx: &CrateContext) -> String {
         format!("Datum({}, {}, {:?})",
-                ccx.tn.val_to_str(self.val),
-                ty_to_str(ccx.tcx(), self.ty),
+                ccx.tn.val_to_string(self.val),
+                ty_to_string(ccx.tcx(), self.ty),
                 self.kind)
     }
 
index f281d8e24486cb5ecdbe1c1f3b48626640a37283..9acd04871999aecf94f0dd2ee4e1e4467ee618ff 100644 (file)
@@ -270,7 +270,7 @@ fn register_type_with_metadata(&mut self,
                                    metadata: DIType) {
         if !self.type_to_metadata.insert(ty::type_id(type_), metadata) {
             cx.sess().bug(format!("Type metadata for ty::t '{}' is already in the TypeMap!",
-                                   ppaux::ty_to_str(cx.tcx(), type_)).as_slice());
+                                   ppaux::ty_to_string(cx.tcx(), type_)).as_slice());
         }
     }
 
@@ -504,7 +504,7 @@ fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: ty::t) -> Uni
             },
             _ => {
                 cx.sess().bug(format!("get_unique_type_id_of_type() - unexpected type: {}, {:?}",
-                                      ppaux::ty_to_str(cx.tcx(), type_).as_slice(),
+                                      ppaux::ty_to_string(cx.tcx(), type_).as_slice(),
                                       ty::get(type_).sty).as_slice())
             }
         };
@@ -808,7 +808,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
     let type_metadata = type_metadata(cx, variable_type, span);
 
     let namespace_node = namespace_for_item(cx, ast_util::local_def(node_id));
-    let var_name = token::get_ident(ident).get().to_str();
+    let var_name = token::get_ident(ident).get().to_string();
     let linkage_name =
         namespace_node.mangled_name_of_contained_item(var_name.as_slice());
     let var_scope = namespace_node.scope;
@@ -1056,7 +1056,7 @@ pub fn set_source_location(fcx: &FunctionContext,
         FunctionDebugContext(box ref function_debug_context) => {
             let cx = fcx.ccx;
 
-            debug!("set_source_location: {}", cx.sess().codemap().span_to_str(span));
+            debug!("set_source_location: {}", cx.sess().codemap().span_to_string(span));
 
             if function_debug_context.source_locations_enabled.get() {
                 let loc = span_start(cx, span);
@@ -1812,7 +1812,7 @@ fn finalize(&self, cx: &CrateContext) -> MetadataCreationResult {
                        type_map.find_metadata_for_type(unfinished_type).is_none() {
                         cx.sess().bug(format!("Forward declaration of potentially recursive type \
                                               '{}' was not found in TypeMap!",
-                                              ppaux::ty_to_str(cx.tcx(), unfinished_type))
+                                              ppaux::ty_to_string(cx.tcx(), unfinished_type))
                                       .as_slice());
                     }
                 }
@@ -2245,7 +2245,7 @@ fn describe_enum_variant(cx: &CrateContext,
         Some(ref names) => {
             names.iter()
                  .map(|ident| {
-                     token::get_ident(*ident).get().to_str().into_string()
+                     token::get_ident(*ident).get().to_string().into_string()
                  }).collect()
         }
         None => variant_info.args.iter().map(|_| "".to_string()).collect()
@@ -2872,7 +2872,7 @@ fn trait_pointer_metadata(cx: &CrateContext,
         ty::ty_uniq(pointee_type) => pointee_type,
         ty::ty_rptr(_, ty::mt { ty, .. }) => ty,
         _ => {
-            let pp_type_name = ppaux::ty_to_str(cx.tcx(), trait_pointer_type);
+            let pp_type_name = ppaux::ty_to_string(cx.tcx(), trait_pointer_type);
             cx.sess().bug(format!("debuginfo: Unexpected trait-pointer type in \
                                    trait_pointer_metadata(): {}",
                                    pp_type_name.as_slice()).as_slice());
@@ -2882,7 +2882,7 @@ fn trait_pointer_metadata(cx: &CrateContext,
     let def_id = match ty::get(trait_object_type).sty {
         ty::ty_trait(box ty::TyTrait { def_id, .. }) => def_id,
         _ => {
-            let pp_type_name = ppaux::ty_to_str(cx.tcx(), trait_object_type);
+            let pp_type_name = ppaux::ty_to_string(cx.tcx(), trait_object_type);
             cx.sess().bug(format!("debuginfo: Unexpected trait-object type in \
                                    trait_pointer_metadata(): {}",
                                    pp_type_name.as_slice()).as_slice());
@@ -3064,7 +3064,7 @@ fn type_metadata(cx: &CrateContext,
                                                  the debuginfo::TypeMap but it \
                                                  was not. (ty::t = {})",
                                                 unique_type_id_str.as_slice(),
-                                                ppaux::ty_to_str(cx.tcx(), t));
+                                                ppaux::ty_to_string(cx.tcx(), t));
                     cx.sess().span_bug(usage_site_span, error_message.as_slice());
                 }
             };
@@ -3079,7 +3079,7 @@ fn type_metadata(cx: &CrateContext,
                                                      debuginfo::TypeMap. \
                                                      UniqueTypeId={}, ty::t={}",
                             unique_type_id_str.as_slice(),
-                            ppaux::ty_to_str(cx.tcx(), t));
+                            ppaux::ty_to_string(cx.tcx(), t));
                         cx.sess().span_bug(usage_site_span, error_message.as_slice());
                     }
                 }
@@ -3879,7 +3879,7 @@ fn push_debuginfo_type_name(cx: &CrateContext,
         ty::ty_infer(_) |
         ty::ty_param(_) => {
             cx.sess().bug(format!("debuginfo: Trying to create type name for \
-                unexpected type: {}", ppaux::ty_to_str(cx.tcx(), t)).as_slice());
+                unexpected type: {}", ppaux::ty_to_string(cx.tcx(), t)).as_slice());
         }
     }
 
index 85e85f8ab55e0272b0fd438240085112cb7f41f4..516c46564cd9ffe32eeda2c7bb959b987a25b3c1 100644 (file)
@@ -75,7 +75,7 @@
 
 use syntax::ast;
 use syntax::codemap;
-use syntax::print::pprust::{expr_to_str};
+use syntax::print::pprust::{expr_to_string};
 
 use std::gc::Gc;
 
@@ -91,9 +91,9 @@ pub enum Dest {
 }
 
 impl Dest {
-    pub fn to_str(&self, ccx: &CrateContext) -> String {
+    pub fn to_string(&self, ccx: &CrateContext) -> String {
         match *self {
-            SaveIn(v) => format!("SaveIn({})", ccx.tn.val_to_str(v)),
+            SaveIn(v) => format!("SaveIn({})", ccx.tn.val_to_string(v)),
             Ignore => "Ignore".to_string()
         }
     }
@@ -148,7 +148,7 @@ pub fn trans<'a>(bcx: &'a Block<'a>,
      * the stack.
      */
 
-    debug!("trans(expr={})", bcx.expr_to_str(expr));
+    debug!("trans(expr={})", bcx.expr_to_string(expr));
 
     let mut bcx = bcx;
     let fcx = bcx.fcx;
@@ -178,7 +178,7 @@ fn apply_adjustments<'a>(bcx: &'a Block<'a>,
         Some(adj) => { adj }
     };
     debug!("unadjusted datum for expr {}: {}",
-           expr.id, datum.to_str(bcx.ccx()));
+           expr.id, datum.to_string(bcx.ccx()));
     match adjustment {
         AutoAddEnv(..) => {
             datum = unpack_datum!(bcx, add_env(bcx, expr, datum));
@@ -216,7 +216,7 @@ fn apply_adjustments<'a>(bcx: &'a Block<'a>,
             datum = scratch.to_expr_datum();
         }
     }
-    debug!("after adjustments, datum={}", datum.to_str(bcx.ccx()));
+    debug!("after adjustments, datum={}", datum.to_string(bcx.ccx()));
     return DatumBlock {bcx: bcx, datum: datum};
 
     fn auto_slice<'a>(
@@ -325,7 +325,7 @@ fn trans_unadjusted<'a>(bcx: &'a Block<'a>,
 
     let mut bcx = bcx;
 
-    debug!("trans_unadjusted(expr={})", bcx.expr_to_str(expr));
+    debug!("trans_unadjusted(expr={})", bcx.expr_to_string(expr));
     let _indenter = indenter();
 
     debuginfo::set_source_location(bcx.fcx, expr.id, expr.span);
@@ -545,8 +545,8 @@ fn trans_index<'a>(bcx: &'a Block<'a>,
 
             let (base, len) = base_datum.get_vec_base_and_len(bcx);
 
-            debug!("trans_index: base {}", bcx.val_to_str(base));
-            debug!("trans_index: len {}", bcx.val_to_str(len));
+            debug!("trans_index: base {}", bcx.val_to_string(base));
+            debug!("trans_index: len {}", bcx.val_to_string(len));
 
             let bounds_check = ICmp(bcx, lib::llvm::IntUGE, ix_val, len);
             let expect = ccx.get_intrinsic(&("llvm.expect.i1"));
@@ -780,7 +780,7 @@ fn trans_rvalue_dps_unadjusted<'a>(bcx: &'a Block<'a>,
             let expr_ty = expr_ty(bcx, expr);
             let store = ty::ty_closure_store(expr_ty);
             debug!("translating block function {} with type {}",
-                   expr_to_str(expr), expr_ty.repr(tcx));
+                   expr_to_string(expr), expr_ty.repr(tcx));
             closure::trans_expr_fn(bcx, store, &**decl, &**body, expr.id, dest)
         }
         ast::ExprCall(ref f, ref args) => {
@@ -893,7 +893,7 @@ fn trans_def_dps_unadjusted<'a>(
         _ => {
             bcx.tcx().sess.span_bug(ref_expr.span, format!(
                 "Non-DPS def {:?} referened by {}",
-                def, bcx.node_id_to_str(ref_expr.id)).as_slice());
+                def, bcx.node_id_to_string(ref_expr.id)).as_slice());
         }
     }
 }
@@ -974,7 +974,7 @@ fn take_local<'a>(bcx: &'a Block<'a>,
             }
         };
         debug!("take_local(nid={:?}, v={}, ty={})",
-               nid, bcx.val_to_str(datum.val), bcx.ty_to_str(datum.ty));
+               nid, bcx.val_to_string(datum.val), bcx.ty_to_string(datum.ty));
         datum
     }
 }
@@ -1462,13 +1462,13 @@ fn trans_binary<'a>(bcx: &'a Block<'a>,
 
             debug!("trans_binary (expr {}): lhs_datum={}",
                    expr.id,
-                   lhs_datum.to_str(ccx));
+                   lhs_datum.to_string(ccx));
             let lhs_ty = lhs_datum.ty;
             let lhs = lhs_datum.to_llscalarish(bcx);
 
             debug!("trans_binary (expr {}): rhs_datum={}",
                    expr.id,
-                   rhs_datum.to_str(ccx));
+                   rhs_datum.to_string(ccx));
             let rhs_ty = rhs_datum.ty;
             let rhs = rhs_datum.to_llscalarish(bcx);
             trans_eager_binop(bcx, expr, binop_ty, op,
@@ -1729,7 +1729,7 @@ fn trans_assign_op<'a>(
     let _icx = push_ctxt("trans_assign_op");
     let mut bcx = bcx;
 
-    debug!("trans_assign_op(expr={})", bcx.expr_to_str(expr));
+    debug!("trans_assign_op(expr={})", bcx.expr_to_string(expr));
 
     // User-defined operator methods cannot be used with `+=` etc right now
     assert!(!bcx.tcx().method_map.borrow().contains_key(&MethodCall::expr(expr.id)));
@@ -1799,7 +1799,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
 
     debug!("deref_once(expr={}, datum={}, method_call={})",
            expr.repr(bcx.tcx()),
-           datum.to_str(ccx),
+           datum.to_string(ccx),
            method_call);
 
     let mut bcx = bcx;
@@ -1877,7 +1877,7 @@ fn deref_once<'a>(bcx: &'a Block<'a>,
     };
 
     debug!("deref_once(expr={}, method_call={}, result={})",
-           expr.id, method_call, r.datum.to_str(ccx));
+           expr.id, method_call, r.datum.to_string(ccx));
 
     return r;
 
index 9d7261f809414672734024690b6d07c2966f1ced..0b12cd3da8254acc582fa84b204851de59c0056c 100644 (file)
@@ -266,8 +266,8 @@ pub fn trans_native_call<'a>(
             llfn={}, \
             llretptr={})",
            callee_ty.repr(tcx),
-           ccx.tn.val_to_str(llfn),
-           ccx.tn.val_to_str(llretptr));
+           ccx.tn.val_to_string(llfn),
+           ccx.tn.val_to_string(llretptr));
 
     let (fn_abi, fn_sig) = match ty::get(callee_ty).sty {
         ty::ty_bare_fn(ref fn_ty) => (fn_ty.abi, fn_ty.sig.clone()),
@@ -314,9 +314,9 @@ pub fn trans_native_call<'a>(
 
         debug!("argument {}, llarg_rust={}, rust_indirect={}, arg_ty={}",
                i,
-               ccx.tn.val_to_str(llarg_rust),
+               ccx.tn.val_to_string(llarg_rust),
                rust_indirect,
-               ccx.tn.type_to_str(arg_tys[i].ty));
+               ccx.tn.type_to_string(arg_tys[i].ty));
 
         // Ensure that we always have the Rust value indirectly,
         // because it makes bitcasting easier.
@@ -330,7 +330,7 @@ pub fn trans_native_call<'a>(
         }
 
         debug!("llarg_rust={} (after indirection)",
-               ccx.tn.val_to_str(llarg_rust));
+               ccx.tn.val_to_string(llarg_rust));
 
         // Check whether we need to do any casting
         match arg_tys[i].cast {
@@ -339,7 +339,7 @@ pub fn trans_native_call<'a>(
         }
 
         debug!("llarg_rust={} (after casting)",
-               ccx.tn.val_to_str(llarg_rust));
+               ccx.tn.val_to_string(llarg_rust));
 
         // Finally, load the value if needed for the foreign ABI
         let foreign_indirect = arg_tys[i].is_indirect();
@@ -355,7 +355,7 @@ pub fn trans_native_call<'a>(
         };
 
         debug!("argument {}, llarg_foreign={}",
-               i, ccx.tn.val_to_str(llarg_foreign));
+               i, ccx.tn.val_to_string(llarg_foreign));
 
         // fill padding with undef value
         match arg_tys[i].pad {
@@ -430,10 +430,10 @@ pub fn trans_native_call<'a>(
             None => fn_type.ret_ty.ty
         };
 
-        debug!("llretptr={}", ccx.tn.val_to_str(llretptr));
-        debug!("llforeign_retval={}", ccx.tn.val_to_str(llforeign_retval));
-        debug!("llrust_ret_ty={}", ccx.tn.type_to_str(llrust_ret_ty));
-        debug!("llforeign_ret_ty={}", ccx.tn.type_to_str(llforeign_ret_ty));
+        debug!("llretptr={}", ccx.tn.val_to_string(llretptr));
+        debug!("llforeign_retval={}", ccx.tn.val_to_string(llforeign_retval));
+        debug!("llrust_ret_ty={}", ccx.tn.type_to_string(llrust_ret_ty));
+        debug!("llforeign_ret_ty={}", ccx.tn.type_to_string(llforeign_ret_ty));
 
         if llrust_ret_ty == llforeign_ret_ty {
             base::store_ty(bcx, llforeign_retval, llretptr, fn_sig.output)
@@ -538,7 +538,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
     let llfn = base::register_fn_llvmty(ccx, sp, sym, node_id, cconv, llfn_ty);
     add_argument_attributes(&tys, llfn);
     debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
-           node_id, ccx.tn.type_to_str(llfn_ty), ccx.tn.val_to_str(llfn));
+           node_id, ccx.tn.type_to_string(llfn_ty), ccx.tn.val_to_string(llfn));
     llfn
 }
 
@@ -583,13 +583,13 @@ fn build_rust_fn(ccx: &CrateContext,
             _ => {
                 ccx.sess().bug(format!("build_rust_fn: extern fn {} has ty {}, \
                                         expected a bare fn ty",
-                                       ccx.tcx.map.path_to_str(id),
+                                       ccx.tcx.map.path_to_string(id),
                                        t.repr(tcx)).as_slice());
             }
         };
 
         debug!("build_rust_fn: path={} id={} t={}",
-               ccx.tcx.map.path_to_str(id),
+               ccx.tcx.map.path_to_string(id),
                id, t.repr(tcx));
 
         let llfn = base::decl_internal_rust_fn(ccx, t, ps.as_slice());
@@ -610,8 +610,8 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
         let t = ty::node_id_to_type(tcx, id);
 
         debug!("build_wrap_fn(llrustfn={}, llwrapfn={}, t={})",
-               ccx.tn.val_to_str(llrustfn),
-               ccx.tn.val_to_str(llwrapfn),
+               ccx.tn.val_to_string(llrustfn),
+               ccx.tn.val_to_string(llwrapfn),
                t.repr(ccx.tcx()));
 
         // Avoid all the Rust generation stuff and just generate raw
@@ -668,11 +668,11 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
             match foreign_outptr {
                 Some(llforeign_outptr) => {
                     debug!("out pointer, foreign={}",
-                           ccx.tn.val_to_str(llforeign_outptr));
+                           ccx.tn.val_to_string(llforeign_outptr));
                     let llrust_retptr =
                         builder.bitcast(llforeign_outptr, llrust_ret_ty.ptr_to());
                     debug!("out pointer, foreign={} (casted)",
-                           ccx.tn.val_to_str(llrust_retptr));
+                           ccx.tn.val_to_string(llrust_retptr));
                     llrust_args.push(llrust_retptr);
                     return_alloca = None;
                 }
@@ -683,8 +683,8 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
                             allocad={}, \
                             llrust_ret_ty={}, \
                             return_ty={}",
-                           ccx.tn.val_to_str(slot),
-                           ccx.tn.type_to_str(llrust_ret_ty),
+                           ccx.tn.val_to_string(slot),
+                           ccx.tn.type_to_string(llrust_ret_ty),
                            tys.fn_sig.output.repr(tcx));
                     llrust_args.push(slot);
                     return_alloca = Some(slot);
@@ -712,7 +712,7 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
             let mut llforeign_arg = llvm::LLVMGetParam(llwrapfn, foreign_index);
 
             debug!("llforeign_arg {}{}: {}", "#",
-                   i, ccx.tn.val_to_str(llforeign_arg));
+                   i, ccx.tn.val_to_string(llforeign_arg));
             debug!("rust_indirect = {}, foreign_indirect = {}",
                    rust_indirect, foreign_indirect);
 
@@ -751,12 +751,12 @@ unsafe fn build_wrap_fn(ccx: &CrateContext,
             };
 
             debug!("llrust_arg {}{}: {}", "#",
-                   i, ccx.tn.val_to_str(llrust_arg));
+                   i, ccx.tn.val_to_string(llrust_arg));
             llrust_args.push(llrust_arg);
         }
 
         // Perform the call itself
-        debug!("calling llrustfn = {}, t = {}", ccx.tn.val_to_str(llrustfn), t.repr(ccx.tcx()));
+        debug!("calling llrustfn = {}, t = {}", ccx.tn.val_to_string(llrustfn), t.repr(ccx.tcx()));
         let attributes = base::get_fn_llvm_attributes(ccx, t);
         let llrust_ret_val = builder.call(llrustfn, llrust_args.as_slice(), attributes.as_slice());
 
@@ -876,9 +876,9 @@ fn foreign_types_for_fn_ty(ccx: &CrateContext,
            ret_def={}",
            ty.repr(ccx.tcx()),
            ccx.tn.types_to_str(llsig.llarg_tys.as_slice()),
-           ccx.tn.type_to_str(llsig.llret_ty),
+           ccx.tn.type_to_string(llsig.llret_ty),
            ccx.tn.types_to_str(fn_ty.arg_tys.iter().map(|t| t.ty).collect::<Vec<_>>().as_slice()),
-           ccx.tn.type_to_str(fn_ty.ret_ty.ty),
+           ccx.tn.type_to_string(fn_ty.ret_ty.ty),
            ret_def);
 
     ForeignTypes {
index d046778485ccf9a90fc938cffbb70464930d4e36..4d9f004e3dcd111ea895016269df715a4b5f83ce 100644 (file)
@@ -167,11 +167,11 @@ pub fn lazily_emit_visit_glue(ccx: &CrateContext, ti: &tydesc_info) -> ValueRef
     match ti.visit_glue.get() {
         Some(visit_glue) => visit_glue,
         None => {
-            debug!("+++ lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_str(ccx.tcx(), ti.ty));
+            debug!("+++ lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_string(ccx.tcx(), ti.ty));
             let glue_fn = declare_generic_glue(ccx, ti.ty, llfnty, "visit");
             ti.visit_glue.set(Some(glue_fn));
             make_generic_glue(ccx, ti.ty, glue_fn, make_visit_glue, "visit");
-            debug!("--- lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_str(ccx.tcx(), ti.ty));
+            debug!("--- lazily_emit_tydesc_glue VISIT {}", ppaux::ty_to_string(ccx.tcx(), ti.ty));
             glue_fn
         }
     }
@@ -432,13 +432,13 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> tydesc_info {
 
     if ccx.sess().count_type_sizes() {
         println!("{}\t{}", llsize_of_real(ccx, llty),
-                 ppaux::ty_to_str(ccx.tcx(), t));
+                 ppaux::ty_to_string(ccx.tcx(), t));
     }
 
     let llsize = llsize_of(ccx, llty);
     let llalign = llalign_of(ccx, llty);
     let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
-    debug!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx(), t), name);
+    debug!("+++ declare_tydesc {} {}", ppaux::ty_to_string(ccx.tcx(), t), name);
     let gvar = name.as_slice().with_c_str(|buf| {
         unsafe {
             llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type().to_ref(), buf)
@@ -447,10 +447,10 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> tydesc_info {
     note_unique_llvm_symbol(ccx, name);
 
     let ty_name = token::intern_and_get_ident(
-        ppaux::ty_to_str(ccx.tcx(), t).as_slice());
+        ppaux::ty_to_string(ccx.tcx(), t).as_slice());
     let ty_name = C_str_slice(ccx, ty_name);
 
-    debug!("--- declare_tydesc {}", ppaux::ty_to_str(ccx.tcx(), t));
+    debug!("--- declare_tydesc {}", ppaux::ty_to_string(ccx.tcx(), t));
     tydesc_info {
         ty: t,
         tydesc: gvar,
@@ -468,7 +468,7 @@ fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type,
         ccx,
         t,
         format!("glue_{}", name).as_slice());
-    debug!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx(), t));
+    debug!("{} is for type {}", fn_nm, ppaux::ty_to_string(ccx.tcx(), t));
     let llfn = decl_cdecl_fn(ccx, fn_nm.as_slice(), llfnty, ty::mk_nil());
     note_unique_llvm_symbol(ccx, fn_nm);
     return llfn;
index 5022e0bf05ba82a9975c30a4536b8004422fb747..28bdc6852e8484f175ca5976689022c858dc0dbc 100644 (file)
@@ -29,7 +29,7 @@
 use syntax::ast;
 use syntax::ast_map;
 use syntax::parse::token;
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 pub fn get_simple_intrinsic(ccx: &CrateContext, item: &ast::ForeignItem) -> Option<ValueRef> {
     let name = match token::get_ident(item.ident).get() {
@@ -398,10 +398,10 @@ fn count_zeros_intrinsic(bcx: &Block, name: &'static str) {
                     format!("transmute called on types with different sizes: \
                              {} ({} bit{}) to \
                              {} ({} bit{})",
-                            ty_to_str(ccx.tcx(), in_type),
+                            ty_to_string(ccx.tcx(), in_type),
                             in_type_size,
                             if in_type_size == 1 {""} else {"s"},
-                            ty_to_str(ccx.tcx(), out_type),
+                            ty_to_string(ccx.tcx(), out_type),
                             out_type_size,
                             if out_type_size == 1 {""} else {"s"}).as_slice());
             }
@@ -587,14 +587,14 @@ pub fn check_intrinsics(ccx: &CrateContext) {
                .span_err(transmute_restriction.span,
                 format!("transmute called on types with different sizes: \
                          {} ({} bit{}) to {} ({} bit{})",
-                        ty_to_str(ccx.tcx(), transmute_restriction.from),
+                        ty_to_string(ccx.tcx(), transmute_restriction.from),
                         from_type_size as uint,
                         if from_type_size == 1 {
                             ""
                         } else {
                             "s"
                         },
-                        ty_to_str(ccx.tcx(), transmute_restriction.to),
+                        ty_to_string(ccx.tcx(), transmute_restriction.to),
                         to_type_size as uint,
                         if to_type_size == 1 {
                             ""
index 3cd1a59abef38c1a56b5b06f34f9cf71afc23151..f7884ca5643f76d5990c3bf2ae37ae8ef7f54ca9 100644 (file)
@@ -25,13 +25,13 @@ fn llrepr(&self, ccx: &CrateContext) -> String {
 
 impl LlvmRepr for Type {
     fn llrepr(&self, ccx: &CrateContext) -> String {
-        ccx.tn.type_to_str(*self)
+        ccx.tn.type_to_string(*self)
     }
 }
 
 impl LlvmRepr for ValueRef {
     fn llrepr(&self, ccx: &CrateContext) -> String {
-        ccx.tn.val_to_str(*self)
+        ccx.tn.val_to_string(*self)
     }
 }
 
index ee581f756340bc980c43d1e170c08cab0fd6f21d..e50eb8f0be99353c77e94f67535404414401f733 100644 (file)
@@ -23,7 +23,7 @@
 use middle::trans::type_::Type;
 use middle::trans::type_of::*;
 use middle::ty;
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 use std::rc::Rc;
 use arena::TypedArena;
@@ -98,7 +98,7 @@ pub fn visit(&mut self, ty_name: &str, args: &[ValueRef]) {
         debug!("passing {} args:", args.len());
         let mut bcx = self.bcx;
         for (i, a) in args.iter().enumerate() {
-            debug!("arg {}: {}", i, bcx.val_to_str(*a));
+            debug!("arg {}: {}", i, bcx.val_to_string(*a));
         }
         let result = unpack_result!(bcx, callee::trans_call_inner(
             self.bcx, None, mth_ty,
@@ -129,7 +129,7 @@ pub fn leaf(&mut self, name: &str) {
     pub fn visit_ty(&mut self, t: ty::t) {
         let bcx = self.bcx;
         let tcx = bcx.tcx();
-        debug!("reflect::visit_ty {}", ty_to_str(bcx.tcx(), t));
+        debug!("reflect::visit_ty {}", ty_to_string(bcx.tcx(), t));
 
         match ty::get(t).sty {
           ty::ty_bot => self.leaf("bot"),
@@ -175,7 +175,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
                   ty::ty_trait(..) => {
                       let extra = [
                           self.c_slice(token::intern_and_get_ident(
-                                  ty_to_str(tcx, t).as_slice()))
+                                  ty_to_string(tcx, t).as_slice()))
                       ];
                       self.visit("trait", extra);
                   }
@@ -204,7 +204,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
                   ty::ty_trait(..) => {
                       let extra = [
                           self.c_slice(token::intern_and_get_ident(
-                                  ty_to_str(tcx, t).as_slice()))
+                                  ty_to_string(tcx, t).as_slice()))
                       ];
                       self.visit("trait", extra);
                   }
@@ -269,7 +269,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
 
               let extra = (vec!(
                   self.c_slice(
-                      token::intern_and_get_ident(ty_to_str(tcx,
+                      token::intern_and_get_ident(ty_to_string(tcx,
                                                             t).as_slice())),
                   self.c_bool(named_fields),
                   self.c_uint(fields.len())
index 19d7d6c6a0091472d94a075a3d9f252fbd0f0c21..a6e554039e77e6ff9f12d2178830577491d9739b 100644 (file)
@@ -29,7 +29,7 @@
 use middle::trans::type_::Type;
 use middle::trans::type_of;
 use middle::ty;
-use util::ppaux::ty_to_str;
+use util::ppaux::ty_to_string;
 
 use syntax::ast;
 use syntax::parse::token::InternedString;
@@ -73,12 +73,12 @@ pub struct VecTypes {
 }
 
 impl VecTypes {
-    pub fn to_str(&self, ccx: &CrateContext) -> String {
+    pub fn to_string(&self, ccx: &CrateContext) -> String {
         format!("VecTypes {{unit_ty={}, llunit_ty={}, \
                  llunit_size={}, llunit_alloc_size={}}}",
-                ty_to_str(ccx.tcx(), self.unit_ty),
-                ccx.tn.type_to_str(self.llunit_ty),
-                ccx.tn.val_to_str(self.llunit_size),
+                ty_to_string(ccx.tcx(), self.unit_ty),
+                ccx.tn.type_to_string(self.llunit_ty),
+                ccx.tn.val_to_string(self.llunit_size),
                 self.llunit_alloc_size)
     }
 }
@@ -97,7 +97,7 @@ pub fn trans_fixed_vstore<'a>(
     // generate the content.
 
     debug!("trans_fixed_vstore(vstore_expr={}, dest={:?})",
-           bcx.expr_to_str(vstore_expr), dest.to_str(bcx.ccx()));
+           bcx.expr_to_string(vstore_expr), dest.to_string(bcx.ccx()));
 
     let vt = vec_types_from_expr(bcx, vstore_expr);
 
@@ -129,7 +129,7 @@ pub fn trans_slice_vstore<'a>(
     let mut bcx = bcx;
 
     debug!("trans_slice_vstore(vstore_expr={}, dest={})",
-           bcx.expr_to_str(vstore_expr), dest.to_str(ccx));
+           bcx.expr_to_string(vstore_expr), dest.to_string(ccx));
 
     // Handle the &"..." case:
     match content_expr.node {
@@ -150,7 +150,7 @@ pub fn trans_slice_vstore<'a>(
     // Handle the &[...] case:
     let vt = vec_types_from_expr(bcx, vstore_expr);
     let count = elements_required(bcx, content_expr);
-    debug!("vt={}, count={:?}", vt.to_str(ccx), count);
+    debug!("vt={}, count={:?}", vt.to_string(ccx), count);
 
     let llcount = C_uint(ccx, count);
     let llfixed;
@@ -202,8 +202,8 @@ pub fn trans_lit_str<'a>(
      */
 
     debug!("trans_lit_str(lit_expr={}, dest={})",
-           bcx.expr_to_str(lit_expr),
-           dest.to_str(bcx.ccx()));
+           bcx.expr_to_string(lit_expr),
+           dest.to_string(bcx.ccx()));
 
     match dest {
         Ignore => bcx,
@@ -233,7 +233,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>,
      * the array elements into them.
      */
 
-    debug!("trans_uniq_vstore(vstore_expr={})", bcx.expr_to_str(vstore_expr));
+    debug!("trans_uniq_vstore(vstore_expr={})", bcx.expr_to_string(vstore_expr));
     let fcx = bcx.fcx;
     let ccx = fcx.ccx;
 
@@ -297,7 +297,7 @@ pub fn trans_uniq_vstore<'a>(bcx: &'a Block<'a>,
     let dataptr = get_dataptr(bcx, val);
 
     debug!("alloc_uniq_vec() returned val={}, dataptr={}",
-           bcx.val_to_str(val), bcx.val_to_str(dataptr));
+           bcx.val_to_string(val), bcx.val_to_string(dataptr));
 
     let bcx = write_content(bcx, &vt, vstore_expr,
                             content_expr, SaveIn(dataptr));
@@ -319,9 +319,9 @@ pub fn write_content<'a>(
     let mut bcx = bcx;
 
     debug!("write_content(vt={}, dest={}, vstore_expr={:?})",
-           vt.to_str(bcx.ccx()),
-           dest.to_str(bcx.ccx()),
-           bcx.expr_to_str(vstore_expr));
+           vt.to_string(bcx.ccx()),
+           dest.to_string(bcx.ccx()),
+           bcx.expr_to_string(vstore_expr));
 
     match content_expr.node {
         ast::ExprLit(lit) => {
@@ -361,7 +361,7 @@ pub fn write_content<'a>(
                     for (i, element) in elements.iter().enumerate() {
                         let lleltptr = GEPi(bcx, lldest, [i]);
                         debug!("writing index {:?} with lleltptr={:?}",
-                               i, bcx.val_to_str(lleltptr));
+                               i, bcx.val_to_string(lleltptr));
                         bcx = expr::trans_into(bcx, &**element,
                                                SaveIn(lleltptr));
                         fcx.schedule_drop_mem(
index 028722071a6999a3bfadc25fc6d32ed5d33fbd97..50c81596edffe9ac1145979f97804c934131c217 100644 (file)
@@ -199,7 +199,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
                 t,
                 t_norm.repr(cx.tcx()),
                 t_norm,
-                cx.tn.type_to_str(llty));
+                cx.tn.type_to_string(llty));
         cx.lltypes.borrow_mut().insert(t, llty);
         return llty;
     }
@@ -291,7 +291,7 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
     debug!("--> mapped t={} {:?} to llty={}",
             t.repr(cx.tcx()),
             t,
-            cx.tn.type_to_str(llty));
+            cx.tn.type_to_string(llty));
 
     cx.lltypes.borrow_mut().insert(t, llty);
 
index 282ccf1155df0a5ab4d2fa15d508acd3388bc53f..f9eda70d16ef201e94efd0312ab9a5a3e9369fd7 100644 (file)
@@ -32,8 +32,8 @@
 use middle::ty_fold;
 use middle::ty_fold::{TypeFoldable,TypeFolder};
 use middle;
-use util::ppaux::{note_and_explain_region, bound_region_ptr_to_str};
-use util::ppaux::{trait_store_to_str, ty_to_str};
+use util::ppaux::{note_and_explain_region, bound_region_ptr_to_string};
+use util::ppaux::{trait_store_to_string, ty_to_string};
 use util::ppaux::{Repr, UserString};
 use util::common::{indenter};
 use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet, FnvHashMap};
@@ -2243,8 +2243,8 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool {
     fn type_requires(cx: &ctxt, seen: &mut Vec<DefId>,
                      r_ty: t, ty: t) -> bool {
         debug!("type_requires({}, {})?",
-               ::util::ppaux::ty_to_str(cx, r_ty),
-               ::util::ppaux::ty_to_str(cx, ty));
+               ::util::ppaux::ty_to_string(cx, r_ty),
+               ::util::ppaux::ty_to_string(cx, ty));
 
         let r = {
             get(r_ty).sty == get(ty).sty ||
@@ -2252,8 +2252,8 @@ fn type_requires(cx: &ctxt, seen: &mut Vec<DefId>,
         };
 
         debug!("type_requires({}, {})? {}",
-               ::util::ppaux::ty_to_str(cx, r_ty),
-               ::util::ppaux::ty_to_str(cx, ty),
+               ::util::ppaux::ty_to_string(cx, r_ty),
+               ::util::ppaux::ty_to_string(cx, ty),
                r);
         return r;
     }
@@ -2261,8 +2261,8 @@ fn type_requires(cx: &ctxt, seen: &mut Vec<DefId>,
     fn subtypes_require(cx: &ctxt, seen: &mut Vec<DefId>,
                         r_ty: t, ty: t) -> bool {
         debug!("subtypes_require({}, {})?",
-               ::util::ppaux::ty_to_str(cx, r_ty),
-               ::util::ppaux::ty_to_str(cx, ty));
+               ::util::ppaux::ty_to_string(cx, r_ty),
+               ::util::ppaux::ty_to_string(cx, ty));
 
         let r = match get(ty).sty {
             // fixed length vectors need special treatment compared to
@@ -2337,8 +2337,8 @@ fn subtypes_require(cx: &ctxt, seen: &mut Vec<DefId>,
         };
 
         debug!("subtypes_require({}, {})? {}",
-               ::util::ppaux::ty_to_str(cx, r_ty),
-               ::util::ppaux::ty_to_str(cx, ty),
+               ::util::ppaux::ty_to_string(cx, r_ty),
+               ::util::ppaux::ty_to_string(cx, ty),
                r);
 
         return r;
@@ -2381,7 +2381,7 @@ fn find_nonrepresentable<It: Iterator<t>>(cx: &ctxt, sp: Span, seen: &mut Vec<De
     fn type_structurally_recursive(cx: &ctxt, sp: Span, seen: &mut Vec<DefId>,
                                    ty: t) -> Representability {
         debug!("type_structurally_recursive: {}",
-               ::util::ppaux::ty_to_str(cx, ty));
+               ::util::ppaux::ty_to_string(cx, ty));
 
         // Compare current type to previously seen types
         match get(ty).sty {
@@ -2441,7 +2441,7 @@ fn type_structurally_recursive(cx: &ctxt, sp: Span, seen: &mut Vec<DefId>,
     }
 
     debug!("is_type_representable: {}",
-           ::util::ppaux::ty_to_str(cx, ty));
+           ::util::ppaux::ty_to_string(cx, ty));
 
     // To avoid a stack overflow when checking an enum variant or struct that
     // contains a different, structurally recursive type, maintain a stack
@@ -2595,7 +2595,7 @@ pub fn node_id_to_trait_ref(cx: &ctxt, id: ast::NodeId) -> Rc<ty::TraitRef> {
         Some(t) => t.clone(),
         None => cx.sess.bug(
             format!("node_id_to_trait_ref: no trait ref for node `{}`",
-                    cx.map.node_to_str(id)).as_slice())
+                    cx.map.node_to_string(id)).as_slice())
     }
 }
 
@@ -2608,7 +2608,7 @@ pub fn node_id_to_type(cx: &ctxt, id: ast::NodeId) -> t {
        Some(t) => t,
        None => cx.sess.bug(
            format!("node_id_to_type: no type for node `{}`",
-                   cx.map.node_to_str(id)).as_slice())
+                   cx.map.node_to_string(id)).as_slice())
     }
 }
 
@@ -2842,7 +2842,7 @@ pub fn adjust_ty(cx: &ctxt,
                                         format!("the {}th autoderef failed: \
                                                 {}",
                                                 i,
-                                                ty_to_str(cx, adjusted_ty))
+                                                ty_to_string(cx, adjusted_ty))
                                                           .as_slice());
                                 }
                             }
@@ -3220,11 +3220,11 @@ pub fn param_tys_in_type(ty: t) -> Vec<ParamTy> {
     rslt
 }
 
-pub fn ty_sort_str(cx: &ctxt, t: t) -> String {
+pub fn ty_sort_string(cx: &ctxt, t: t) -> String {
     match get(t).sty {
         ty_nil | ty_bot | ty_bool | ty_char | ty_int(_) |
         ty_uint(_) | ty_float(_) | ty_str => {
-            ::util::ppaux::ty_to_str(cx, t)
+            ::util::ppaux::ty_to_string(cx, t)
         }
 
         ty_enum(id, _) => format!("enum {}", item_path_str(cx, id)),
@@ -3277,18 +3277,18 @@ fn tstore_to_closure(s: &TraitStore) -> String {
         terr_mismatch => "types differ".to_string(),
         terr_fn_style_mismatch(values) => {
             format!("expected {} fn but found {} fn",
-                    values.expected.to_str(),
-                    values.found.to_str())
+                    values.expected.to_string(),
+                    values.found.to_string())
         }
         terr_abi_mismatch(values) => {
             format!("expected {} fn but found {} fn",
-                    values.expected.to_str(),
-                    values.found.to_str())
+                    values.expected.to_string(),
+                    values.found.to_string())
         }
         terr_onceness_mismatch(values) => {
             format!("expected {} fn but found {} fn",
-                    values.expected.to_str(),
-                    values.found.to_str())
+                    values.expected.to_string(),
+                    values.found.to_string())
         }
         terr_sigil_mismatch(values) => {
             format!("expected {}, found {}",
@@ -3344,22 +3344,22 @@ fn tstore_to_closure(s: &TraitStore) -> String {
         terr_regions_insufficiently_polymorphic(br, _) => {
             format!("expected bound lifetime parameter {}, \
                      but found concrete lifetime",
-                    bound_region_ptr_to_str(cx, br))
+                    bound_region_ptr_to_string(cx, br))
         }
         terr_regions_overly_polymorphic(br, _) => {
             format!("expected concrete lifetime, \
                      but found bound lifetime parameter {}",
-                    bound_region_ptr_to_str(cx, br))
+                    bound_region_ptr_to_string(cx, br))
         }
         terr_trait_stores_differ(_, ref values) => {
             format!("trait storage differs: expected `{}` but found `{}`",
-                    trait_store_to_str(cx, (*values).expected),
-                    trait_store_to_str(cx, (*values).found))
+                    trait_store_to_string(cx, (*values).expected),
+                    trait_store_to_string(cx, (*values).found))
         }
         terr_sorts(values) => {
             format!("expected {} but found {}",
-                    ty_sort_str(cx, values.expected),
-                    ty_sort_str(cx, values.found))
+                    ty_sort_string(cx, values.expected),
+                    ty_sort_string(cx, values.found))
         }
         terr_traits(values) => {
             format!("expected trait `{}` but found trait `{}`",
@@ -3384,13 +3384,13 @@ fn tstore_to_closure(s: &TraitStore) -> String {
         }
         terr_int_mismatch(ref values) => {
             format!("expected `{}` but found `{}`",
-                    values.expected.to_str(),
-                    values.found.to_str())
+                    values.expected.to_string(),
+                    values.found.to_string())
         }
         terr_float_mismatch(ref values) => {
             format!("expected `{}` but found `{}`",
-                    values.expected.to_str(),
-                    values.found.to_str())
+                    values.expected.to_string(),
+                    values.found.to_string())
         }
         terr_variadic_mismatch(ref values) => {
             format!("expected {} fn but found {} function",
@@ -3701,7 +3701,7 @@ pub fn substd_enum_variants(cx: &ctxt,
 }
 
 pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String {
-    with_path(cx, id, |path| ast_map::path_to_str(path)).to_string()
+    with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
 }
 
 pub enum DtorKind {
@@ -3973,7 +3973,7 @@ fn each_super_struct(cx: &ctxt, mut did: ast::DefId, f: |ast::DefId|) {
             None => {
                 cx.sess.bug(
                     format!("ID not mapped to super-struct: {}",
-                            cx.map.node_to_str(did.node)).as_slice());
+                            cx.map.node_to_string(did.node)).as_slice());
             }
         }
     }
@@ -3995,7 +3995,7 @@ pub fn lookup_struct_fields(cx: &ctxt, did: ast::DefId) -> Vec<field_ty> {
                 _ => {
                     cx.sess.bug(
                         format!("ID not mapped to struct fields: {}",
-                                cx.map.node_to_str(did.node)).as_slice());
+                                cx.map.node_to_string(did.node)).as_slice());
                 }
             }
         });
@@ -4621,7 +4621,7 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 {
 }
 
 impl Variance {
-    pub fn to_str(self) -> &'static str {
+    pub fn to_string(self) -> &'static str {
         match self {
             Covariant => "+",
             Contravariant => "-",
index 286cb5364758a9d5c157d19c99fe190012e36125..d565f144f36567cc4231239605d627928b1bd643 100644 (file)
@@ -66,7 +66,7 @@
 use syntax::{ast, ast_util};
 use syntax::codemap::Span;
 use syntax::owned_slice::OwnedSlice;
-use syntax::print::pprust::{lifetime_to_str, path_to_str};
+use syntax::print::pprust::{lifetime_to_string, path_to_string};
 
 pub trait AstConv {
     fn tcx<'a>(&'a self) -> &'a ty::ctxt;
@@ -108,7 +108,7 @@ pub fn ast_region_to_region(tcx: &ty::ctxt, lifetime: &ast::Lifetime)
     };
 
     debug!("ast_region_to_region(lifetime={} id={}) yields {}",
-            lifetime_to_str(lifetime),
+            lifetime_to_string(lifetime),
             lifetime.id, r.repr(tcx));
 
     r
@@ -142,7 +142,7 @@ pub fn opt_ast_region_to_region<AC:AstConv,RS:RegionScope>(
     };
 
     debug!("opt_ast_region_to_region(opt_lifetime={:?}) yields {}",
-            opt_lifetime.as_ref().map(|e| lifetime_to_str(e)),
+            opt_lifetime.as_ref().map(|e| lifetime_to_string(e)),
             r.repr(this.tcx()));
 
     r
@@ -331,7 +331,7 @@ pub fn ast_ty_to_prim_ty(tcx: &ty::ctxt, ast_ty: &ast::Ty) -> Option<ty::t> {
                 None => {
                     tcx.sess.span_bug(ast_ty.span,
                                       format!("unbound path {}",
-                                              path_to_str(path)).as_slice())
+                                              path_to_string(path)).as_slice())
                 }
                 Some(&d) => d
             };
@@ -394,7 +394,7 @@ pub fn ast_ty_to_builtin_ty<AC:AstConv,
                         .sess
                         .span_bug(ast_ty.span,
                                   format!("unbound path {}",
-                                          path_to_str(path)).as_slice())
+                                          path_to_string(path)).as_slice())
                 }
                 Some(&d) => d
             };
@@ -793,7 +793,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
                         tcx.sess
                            .span_bug(ast_ty.span,
                                      format!("unbound path {}",
-                                             path_to_str(path)).as_slice())
+                                             path_to_string(path)).as_slice())
                     }
                     Some(&d) => d
                 };
@@ -808,7 +808,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
                 }
                 match a_def {
                     def::DefTrait(_) => {
-                        let path_str = path_to_str(path);
+                        let path_str = path_to_string(path);
                         tcx.sess.span_err(
                             ast_ty.span,
                             format!("reference to trait `{name}` where a \
@@ -835,7 +835,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
                     def::DefMod(id) => {
                         tcx.sess.span_fatal(ast_ty.span,
                             format!("found module name used as a type: {}",
-                                    tcx.map.node_to_str(id.node)).as_slice());
+                                    tcx.map.node_to_string(id.node)).as_slice());
                     }
                     def::DefPrimTy(_) => {
                         fail!("DefPrimTy arm missed in previous ast_ty_to_prim_ty call");
index a5e7db1d6fdab70e2cb257ca6a491b6703b612d9..2232cc4965785fcab7d6aa3b4f787a27c6665c48 100644 (file)
@@ -399,11 +399,11 @@ pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
                                     variant_id, substitutions, etc);
         }
         Some(&def::DefStruct(..)) | Some(&def::DefVariant(..)) => {
-            let name = pprust::path_to_str(path);
+            let name = pprust::path_to_string(path);
             tcx.sess.span_err(span,
                               format!("mismatched types: expected `{}` but \
                                        found `{}`",
-                                      fcx.infcx().ty_to_str(expected),
+                                      fcx.infcx().ty_to_string(expected),
                                       name).as_slice());
         }
         _ => {
@@ -525,9 +525,9 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
                        .span_err(path.span,
                                  format!("`{}` does not name the \
                                           structure `{}`",
-                                         pprust::path_to_str(path),
+                                         pprust::path_to_string(path),
                                          fcx.infcx()
-                                            .ty_to_str(expected)).as_slice())
+                                            .ty_to_string(expected)).as_slice())
                 }
 
                 check_struct_pat(pcx, pat.id, pat.span, expected, path,
@@ -747,7 +747,7 @@ fn check_pointer_pat(pcx: &pat_ctxt,
                 tcx.sess.span_err(
                     span,
                     format!("type `{}` cannot be dereferenced",
-                            fcx.infcx().ty_to_str(expected)).as_slice());
+                            fcx.infcx().ty_to_string(expected)).as_slice());
                 fcx.write_error(pat_id);
             }
             _ => {
index 6e44665fb3b46bc5e9b625be38f8fa4e27a953c8..c1a000841a4d1f4cfb274c2ead2798896d6279d8 100644 (file)
@@ -30,14 +30,14 @@ impl like `impl Foo` are inherent methods.  Nothing needs to be
 module as the type itself).
 
 Inherent candidates are not always derived from impls.  If you have a
-trait instance, such as a value of type `Box<ToStr>`, then the trait
-methods (`to_str()`, in this case) are inherently associated with it.
+trait instance, such as a value of type `Box<ToString>`, then the trait
+methods (`to_string()`, in this case) are inherently associated with it.
 Another case is type parameters, in which case the methods of their
 bounds are inherent.
 
 Extension candidates are derived from imported traits.  If I have the
-trait `ToStr` imported, and I call `to_str()` on a value of type `T`,
-then we will go off to find out whether there is an impl of `ToStr`
+trait `ToString` imported, and I call `to_string()` on a value of type `T`,
+then we will go off to find out whether there is an impl of `ToString`
 for `T`.  These kinds of method calls are called "extension methods".
 They can be defined in any module, not only the one that defined `T`.
 Furthermore, you must import the trait to call such a method.
@@ -376,7 +376,7 @@ fn search_step(&self,
                    autoderefs: uint)
                    -> Option<Option<MethodCallee>> {
         debug!("search_step: self_ty={} autoderefs={}",
-               self.ty_to_str(self_ty), autoderefs);
+               self.ty_to_string(self_ty), autoderefs);
 
         match self.deref_args {
             check::DontDerefArgs => {
@@ -508,7 +508,7 @@ fn push_inherent_candidates_from_object(&mut self,
                                             did: DefId,
                                             substs: &subst::Substs) {
         debug!("push_inherent_candidates_from_object(did={}, substs={})",
-               self.did_to_str(did),
+               self.did_to_string(did),
                substs.repr(self.tcx()));
         let _indenter = indenter();
         let tcx = self.tcx();
@@ -733,7 +733,7 @@ fn search_for_autoderefd_method(&self,
             None => None,
             Some(method) => {
                 debug!("(searching for autoderef'd method) writing \
-                       adjustment {:?} for {}", adjustment, self.ty_to_str( self_ty));
+                       adjustment {:?} for {}", adjustment, self.ty_to_string( self_ty));
                 match adjustment {
                     Some((self_expr_id, adj)) => {
                         self.fcx.write_adjustment(self_expr_id, adj);
@@ -809,7 +809,7 @@ fn default_method_hack(self_mt: ty::mt) -> bool {
 
     fn auto_slice_vec(&self, mt: ty::mt, autoderefs: uint) -> Option<MethodCallee> {
         let tcx = self.tcx();
-        debug!("auto_slice_vec {}", ppaux::ty_to_str(tcx, mt.ty));
+        debug!("auto_slice_vec {}", ppaux::ty_to_string(tcx, mt.ty));
 
         // First try to borrow to a slice
         let entry = self.search_for_some_kind_of_autorefd_method(
@@ -886,7 +886,7 @@ fn search_for_autosliced_method(&self,
          * `~[]` to `&[]`.
          */
 
-        debug!("search_for_autosliced_method {}", ppaux::ty_to_str(self.tcx(), self_ty));
+        debug!("search_for_autosliced_method {}", ppaux::ty_to_string(self.tcx(), self_ty));
 
         let sty = ty::get(self_ty).sty.clone();
         match sty {
@@ -939,7 +939,7 @@ fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
 
             ty_infer(TyVar(_)) => {
                 self.bug(format!("unexpected type: {}",
-                                 self.ty_to_str(self_ty)).as_slice());
+                                 self.ty_to_string(self_ty)).as_slice());
             }
         }
     }
@@ -993,7 +993,7 @@ fn search_for_some_kind_of_autorefd_method(
     }
 
     fn search_for_method(&self, rcvr_ty: ty::t) -> Option<MethodCallee> {
-        debug!("search_for_method(rcvr_ty={})", self.ty_to_str(rcvr_ty));
+        debug!("search_for_method(rcvr_ty={})", self.ty_to_string(rcvr_ty));
         let _indenter = indenter();
 
         // I am not sure that inherent methods should have higher
@@ -1094,7 +1094,7 @@ fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
         let tcx = self.tcx();
 
         debug!("confirm_candidate(rcvr_ty={}, candidate={})",
-               self.ty_to_str(rcvr_ty),
+               self.ty_to_string(rcvr_ty),
                candidate.repr(self.tcx()));
 
         self.enforce_object_limitations(candidate);
@@ -1177,7 +1177,7 @@ fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
             fn_style: bare_fn_ty.fn_style,
             abi: bare_fn_ty.abi.clone(),
         });
-        debug!("after replacing bound regions, fty={}", self.ty_to_str(fty));
+        debug!("after replacing bound regions, fty={}", self.ty_to_string(fty));
 
         // Before, we only checked whether self_ty could be a subtype
         // of rcvr_ty; now we actually make it so (this may cause
@@ -1191,8 +1191,8 @@ fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
             Err(_) => {
                 self.bug(format!(
                         "{} was a subtype of {} but now is not?",
-                        self.ty_to_str(rcvr_ty),
-                        self.ty_to_str(transformed_self_ty)).as_slice());
+                        self.ty_to_string(rcvr_ty),
+                        self.ty_to_string(transformed_self_ty)).as_slice());
             }
         }
 
@@ -1288,7 +1288,7 @@ fn enforce_drop_trait_limitations(&self, candidate: &Candidate) {
     // candidate method's `self_ty`.
     fn is_relevant(&self, rcvr_ty: ty::t, candidate: &Candidate) -> bool {
         debug!("is_relevant(rcvr_ty={}, candidate={})",
-               self.ty_to_str(rcvr_ty), candidate.repr(self.tcx()));
+               self.ty_to_string(rcvr_ty), candidate.repr(self.tcx()));
 
         return match candidate.method_ty.explicit_self {
             SelfStatic => {
@@ -1457,11 +1457,11 @@ fn tcx(&self) -> &'a ty::ctxt {
         self.fcx.tcx()
     }
 
-    fn ty_to_str(&self, t: ty::t) -> String {
-        self.fcx.infcx().ty_to_str(t)
+    fn ty_to_string(&self, t: ty::t) -> String {
+        self.fcx.infcx().ty_to_string(t)
     }
 
-    fn did_to_str(&self, did: DefId) -> String {
+    fn did_to_string(&self, did: DefId) -> String {
         ty::item_path_str(self.tcx(), did)
     }
 
index 1d0c3074a4f12a576915027aacb6dacca18a4074..9f5fcb61f5fd0e9646416a7d13f12b9c1853376d 100644 (file)
@@ -397,8 +397,8 @@ fn visit_local(&mut self, local: &ast::Local, _: ()) {
         };
         self.assign(local.id, o_ty);
         debug!("Local variable {} is assigned type {}",
-               self.fcx.pat_to_str(&*local.pat),
-               self.fcx.infcx().ty_to_str(
+               self.fcx.pat_to_string(&*local.pat),
+               self.fcx.infcx().ty_to_string(
                    self.fcx.inh.locals.borrow().get_copy(&local.id)));
         visit::walk_local(self, local, ());
     }
@@ -411,7 +411,7 @@ fn visit_pat(&mut self, p: &ast::Pat, _: ()) {
                 self.assign(p.id, None);
                 debug!("Pattern binding {} is assigned to {}",
                        token::get_ident(path1.node),
-                       self.fcx.infcx().ty_to_str(
+                       self.fcx.infcx().ty_to_string(
                            self.fcx.inh.locals.borrow().get_copy(&p.id)));
               }
               _ => {}
@@ -534,7 +534,7 @@ fn span_for_field(tcx: &ty::ctxt, field: &ty::field_ty, struct_id: ast::DefId) -
     let item = match tcx.map.find(struct_id.node) {
         Some(ast_map::NodeItem(item)) => item,
         None => fail!("node not in ast map: {}", struct_id.node),
-        _ => fail!("expected item, found {}", tcx.map.node_to_str(struct_id.node))
+        _ => fail!("expected item, found {}", tcx.map.node_to_string(struct_id.node))
     };
 
     match item.node {
@@ -803,7 +803,7 @@ fn check_impl_methods_against_trait(ccx: &CrateCtxt,
                     format!(
                         "method `{}` is not a member of trait `{}`",
                         token::get_ident(impl_method_ty.ident),
-                        pprust::path_to_str(&ast_trait_ref.path)).as_slice());
+                        pprust::path_to_string(&ast_trait_ref.path)).as_slice());
             }
         }
     }
@@ -870,7 +870,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 format!("method `{}` has a `{}` declaration in the impl, \
                         but not in the trait",
                         token::get_ident(trait_m.ident),
-                        pprust::explicit_self_to_str(
+                        pprust::explicit_self_to_string(
                             impl_m.explicit_self)).as_slice());
             return;
         }
@@ -880,7 +880,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                 format!("method `{}` has a `{}` declaration in the trait, \
                         but not in the impl",
                         token::get_ident(trait_m.ident),
-                        pprust::explicit_self_to_str(
+                        pprust::explicit_self_to_string(
                             trait_m.explicit_self)).as_slice());
             return;
         }
@@ -1051,7 +1051,7 @@ fn compare_impl_method(tcx: &ty::ctxt,
                                            declaration",
                                           token::get_ident(trait_m.ident),
                                           i,
-                                          ppaux::trait_ref_to_str(
+                                          ppaux::trait_ref_to_string(
                                               tcx,
                                               &*impl_trait_bound)).as_slice())
             }
@@ -1101,8 +1101,8 @@ fn check_cast(fcx: &FnCtxt,
 
     let t_e = fcx.expr_ty(e);
 
-    debug!("t_1={}", fcx.infcx().ty_to_str(t_1));
-    debug!("t_e={}", fcx.infcx().ty_to_str(t_e));
+    debug!("t_1={}", fcx.infcx().ty_to_string(t_1));
+    debug!("t_e={}", fcx.infcx().ty_to_string(t_e));
 
     if ty::type_is_error(t_e) {
         fcx.write_error(id);
@@ -1126,13 +1126,13 @@ fn check_cast(fcx: &FnCtxt,
         fcx.type_error_message(span, |actual| {
             format!("cast from nil: `{}` as `{}`",
                     actual,
-                    fcx.infcx().ty_to_str(t_1))
+                    fcx.infcx().ty_to_string(t_1))
         }, t_e, None);
     } else if ty::type_is_nil(t_1) {
         fcx.type_error_message(span, |actual| {
             format!("cast to nil: `{}` as `{}`",
                     actual,
-                    fcx.infcx().ty_to_str(t_1))
+                    fcx.infcx().ty_to_string(t_1))
         }, t_e, None);
     }
 
@@ -1149,7 +1149,7 @@ fn check_cast(fcx: &FnCtxt,
                 format!("illegal cast; cast through an \
                          integer first: `{}` as `{}`",
                         actual,
-                        fcx.infcx().ty_to_str(t_1))
+                        fcx.infcx().ty_to_string(t_1))
             }, t_e, None);
         }
         // casts from C-like enums are allowed
@@ -1217,7 +1217,7 @@ fn types_compatible(fcx: &FnCtxt, sp: Span,
         fcx.type_error_message(span, |actual| {
             format!("non-scalar cast: `{}` as `{}`",
                     actual,
-                    fcx.infcx().ty_to_str(t_1))
+                    fcx.infcx().ty_to_string(t_1))
         }, t_e, None);
     }
 
@@ -1286,7 +1286,7 @@ pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t {
     #[inline]
     pub fn write_ty(&self, node_id: ast::NodeId, ty: ty::t) {
         debug!("write_ty({}, {}) in fcx {}",
-               node_id, ppaux::ty_to_str(self.tcx(), ty), self.tag());
+               node_id, ppaux::ty_to_string(self.tcx(), ty), self.tag());
         self.inh.node_types.borrow_mut().insert(node_id, ty);
     }
 
@@ -1343,7 +1343,7 @@ pub fn to_ty(&self, ast_t: &ast::Ty) -> ty::t {
         ast_ty_to_ty(self, self.infcx(), ast_t)
     }
 
-    pub fn pat_to_str(&self, pat: &ast::Pat) -> String {
+    pub fn pat_to_string(&self, pat: &ast::Pat) -> String {
         pat.repr(self.tcx())
     }
 
@@ -1363,7 +1363,7 @@ pub fn node_ty(&self, id: ast::NodeId) -> ty::t {
             None => {
                 self.tcx().sess.bug(
                     format!("no type for node {}: {} in fcx {}",
-                            id, self.tcx().map.node_to_str(id),
+                            id, self.tcx().map.node_to_string(id),
                             self.tag()).as_slice());
             }
         }
@@ -1375,7 +1375,7 @@ pub fn method_ty_substs(&self, id: ast::NodeId) -> subst::Substs {
             None => {
                 self.tcx().sess.bug(
                     format!("no method entry for node {}: {} in fcx {}",
-                            id, self.tcx().map.node_to_str(id),
+                            id, self.tcx().map.node_to_string(id),
                             self.tag()).as_slice());
             }
         }
@@ -1842,7 +1842,7 @@ fn check_argument_types(fcx: &FnCtxt,
     };
 
     debug!("check_argument_types: formal_tys={:?}",
-           formal_tys.iter().map(|t| fcx.infcx().ty_to_str(*t)).collect::<Vec<String>>());
+           formal_tys.iter().map(|t| fcx.infcx().ty_to_string(*t)).collect::<Vec<String>>());
 
     // Check the arguments.
     // We do this in a pretty awful way: first we typecheck any arguments
@@ -2410,7 +2410,7 @@ fn check_binop(fcx: &FnCtxt,
                                              operation `{}` not \
                                              supported for floating \
                                              point SIMD vector `{}`",
-                                            ast_util::binop_to_str(op),
+                                            ast_util::binop_to_string(op),
                                             actual)
                                 },
                                 lhs_t,
@@ -2440,7 +2440,7 @@ fn check_binop(fcx: &FnCtxt,
                                    |actual| {
                     format!("binary operation `{}` cannot be applied \
                              to type `{}`",
-                            ast_util::binop_to_str(op),
+                            ast_util::binop_to_string(op),
                             actual)
                 },
                 lhs_t,
@@ -2457,7 +2457,7 @@ fn check_binop(fcx: &FnCtxt,
                                                  operation `{}=` \
                                                  cannot be applied to \
                                                  type `{}`",
-                                                ast_util::binop_to_str(op),
+                                                ast_util::binop_to_string(op),
                                                 actual)
                                    },
                                    lhs_t,
@@ -2506,7 +2506,7 @@ fn check_user_binop(fcx: &FnCtxt,
                          trait_did, [lhs_expr, rhs], DontAutoderefReceiver, || {
             fcx.type_error_message(ex.span, |actual| {
                 format!("binary operation `{}` cannot be applied to type `{}`",
-                        ast_util::binop_to_str(op),
+                        ast_util::binop_to_string(op),
                         actual)
             }, lhs_resolved_t, None)
         })
@@ -2594,7 +2594,7 @@ fn check_expr_fn(fcx: &FnCtxt,
                                            expected_sig);
         let fty_sig = fn_ty.sig.clone();
         let fty = ty::mk_closure(tcx, fn_ty);
-        debug!("check_expr_fn fty={}", fcx.infcx().ty_to_str(fty));
+        debug!("check_expr_fn fty={}", fcx.infcx().ty_to_string(fty));
 
         fcx.write_ty(expr.id, fty);
 
@@ -2628,7 +2628,7 @@ fn check_field(fcx: &FnCtxt,
             autoderef(fcx, expr.span, expr_t, Some(base.id), lvalue_pref, |base_t, _| {
                 match ty::get(base_t).sty {
                     ty::ty_struct(base_id, ref substs) => {
-                        debug!("struct named {}", ppaux::ty_to_str(tcx, base_t));
+                        debug!("struct named {}", ppaux::ty_to_string(tcx, base_t));
                         let fields = ty::lookup_struct_fields(tcx, base_id);
                         lookup_field_ty(tcx, base_id, fields.as_slice(),
                                         field.node.name, &(*substs))
@@ -3386,7 +3386,7 @@ fn check_fn_for_vec_elements_expected(fcx: &FnCtxt,
                         tcx.sess
                            .span_err(path.span,
                                      format!("`{}` does not name a structure",
-                                             pprust::path_to_str(
+                                             pprust::path_to_string(
                                                  path)).as_slice())
                     }
                 }
@@ -3454,10 +3454,10 @@ fn check_fn_for_vec_elements_expected(fcx: &FnCtxt,
     }
 
     debug!("type of expr({}) {} is...", expr.id,
-           syntax::print::pprust::expr_to_str(expr));
+           syntax::print::pprust::expr_to_string(expr));
     debug!("... {}, expected is {}",
-           ppaux::ty_to_str(tcx, fcx.expr_ty(expr)),
-           expected.repr(tcx))
+           ppaux::ty_to_string(tcx, fcx.expr_ty(expr)),
+           expected.repr(tcx));
 
     unifier();
 }
@@ -3792,7 +3792,7 @@ pub fn check_instantiable(tcx: &ty::ctxt,
                      format!("this type cannot be instantiated without an \
                               instance of itself; consider using \
                               `Option<{}>`",
-                             ppaux::ty_to_str(tcx, item_ty)).as_slice());
+                             ppaux::ty_to_string(tcx, item_ty)).as_slice());
         false
     } else {
         true
@@ -3853,7 +3853,7 @@ pub fn check_enum_variants_sized(ccx: &CrateCtxt,
                                         dynamically sized types may only \
                                         appear as the final type in a \
                                         variant",
-                                       ppaux::ty_to_str(ccx.tcx,
+                                       ppaux::ty_to_string(ccx.tcx,
                                                         *t)).as_slice());
                     }
                 }
@@ -3918,7 +3918,7 @@ fn do_check(ccx: &CrateCtxt,
 
             match v.node.disr_expr {
                 Some(e) => {
-                    debug!("disr expr, checking {}", pprust::expr_to_str(&*e));
+                    debug!("disr expr, checking {}", pprust::expr_to_string(&*e));
 
                     let inh = blank_inherited_fields(ccx);
                     let fcx = blank_fn_ctxt(ccx, &inh, rty, e.id);
@@ -4522,7 +4522,7 @@ pub fn check_bounds_are_used(ccx: &CrateCtxt,
                              tps: &OwnedSlice<ast::TyParam>,
                              ty: ty::t) {
     debug!("check_bounds_are_used(n_tps={}, ty={})",
-           tps.len(), ppaux::ty_to_str(ccx.tcx, ty));
+           tps.len(), ppaux::ty_to_string(ccx.tcx, ty));
 
     // make a vector of booleans initially false, set to true when used
     if tps.len() == 0u { return; }
@@ -4840,7 +4840,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
                            fty,
                            || {
                 format!("intrinsic has wrong type: expected `{}`",
-                        ppaux::ty_to_str(ccx.tcx, fty))
+                        ppaux::ty_to_string(ccx.tcx, fty))
             });
     }
 }
index 07fb43d0d34dfdb824b55b89e123f6ee9b4769c3..924934e4bcdc5e34eac00cc6af2f3b450e597988 100644 (file)
@@ -133,7 +133,7 @@ fn get_i(x: &'a Bar) -> &'a int {
 use middle::typeck::MethodCall;
 use middle::pat_util;
 use util::nodemap::NodeMap;
-use util::ppaux::{ty_to_str, region_to_str, Repr};
+use util::ppaux::{ty_to_string, region_to_string, Repr};
 
 use syntax::ast;
 use syntax::codemap::Span;
@@ -876,7 +876,7 @@ fn constrain_autoderefs(rcx: &mut Rcx,
     let r_deref_expr = ty::ReScope(deref_expr.id);
     for i in range(0u, derefs) {
         debug!("constrain_autoderefs(deref_expr=?, derefd_ty={}, derefs={:?}/{:?}",
-               rcx.fcx.infcx().ty_to_str(derefd_ty),
+               rcx.fcx.infcx().ty_to_string(derefd_ty),
                i, derefs);
 
         let method_call = MethodCall::autoderef(deref_expr.id, i);
@@ -948,7 +948,7 @@ fn constrain_index(rcx: &mut Rcx,
      */
 
     debug!("constrain_index(index_expr=?, indexed_ty={}",
-           rcx.fcx.infcx().ty_to_str(indexed_ty));
+           rcx.fcx.infcx().ty_to_string(indexed_ty));
 
     let r_index_expr = ty::ReScope(index_expr.id);
     match ty::get(indexed_ty).sty {
@@ -984,7 +984,7 @@ fn constrain_regions_in_type_of_node(
                            |method_call| rcx.resolve_method_type(method_call));
     debug!("constrain_regions_in_type_of_node(\
             ty={}, ty0={}, id={}, minimum_lifetime={:?})",
-           ty_to_str(tcx, ty), ty_to_str(tcx, ty0),
+           ty_to_string(tcx, ty), ty_to_string(tcx, ty0),
            id, minimum_lifetime);
     constrain_regions_in_type(rcx, minimum_lifetime, origin, ty);
 }
@@ -1011,8 +1011,8 @@ fn constrain_regions_in_type(
     let tcx = rcx.fcx.ccx.tcx;
 
     debug!("constrain_regions_in_type(minimum_lifetime={}, ty={})",
-           region_to_str(tcx, "", false, minimum_lifetime),
-           ty_to_str(tcx, ty));
+           region_to_string(tcx, "", false, minimum_lifetime),
+           ty_to_string(tcx, ty));
 
     relate_nested_regions(tcx, Some(minimum_lifetime), ty, |r_sub, r_sup| {
         debug!("relate_nested_regions(r_sub={}, r_sup={})",
@@ -1190,7 +1190,7 @@ fn link_region_from_node_type(rcx: &Rcx,
     let rptr_ty = rcx.resolve_node_type(id);
     if !ty::type_is_bot(rptr_ty) && !ty::type_is_error(rptr_ty) {
         let tcx = rcx.fcx.ccx.tcx;
-        debug!("rptr_ty={}", ty_to_str(tcx, rptr_ty));
+        debug!("rptr_ty={}", ty_to_string(tcx, rptr_ty));
         let r = ty::ty_region(tcx, span, rptr_ty);
         link_region(rcx, span, r, ty::BorrowKind::from_mutbl(mutbl),
                     cmt_borrowed);
index 146b42a00ffafe191df5e4aa002c8c694f9481ba..53e26f8696f61fe9e2f964bef5d03e41fccb2e25 100644 (file)
@@ -30,7 +30,7 @@ pub fn replace_late_bound_regions_in_fn_sig(
     let mut map = HashMap::new();
     let fn_sig = {
         let mut f = ty_fold::RegionFolder::regions(tcx, |r| {
-            debug!("region r={}", r.to_str());
+            debug!("region r={}", r.to_string());
             match r {
                 ty::ReLateBound(s, br) if s == fn_sig.binder_id => {
                     *map.find_or_insert_with(br, |_| mapf(br))
@@ -153,7 +153,7 @@ pub fn relate_free_regions(tcx: &ty::ctxt, fn_sig: &ty::FnSig) {
     }
 
     for &t in all_tys.iter() {
-        debug!("relate_free_regions(t={})", ppaux::ty_to_str(tcx, t));
+        debug!("relate_free_regions(t={})", ppaux::ty_to_string(tcx, t));
         relate_nested_regions(tcx, None, t, |a, b| {
             match (&a, &b) {
                 (&ty::ReFree(free_a), &ty::ReFree(free_b)) => {
index bda47d99ed7146d0ec7b12ab9dd292a8d19df9ae..d2a1ef786bd29f209ed1bba40cfa5dd3e5539cab 100644 (file)
@@ -16,7 +16,7 @@
 use middle::typeck::check::{FnCtxt, impl_self_ty};
 use middle::typeck::check::{structurally_resolved_type};
 use middle::typeck::check::writeback;
-use middle::typeck::infer::fixup_err_to_str;
+use middle::typeck::infer::fixup_err_to_string;
 use middle::typeck::infer::{resolve_and_force_all_but_regions, resolve_type};
 use middle::typeck::infer;
 use middle::typeck::{vtable_origin, vtable_res, vtable_param_res};
@@ -35,7 +35,7 @@
 use syntax::ast;
 use syntax::ast_util;
 use syntax::codemap::Span;
-use syntax::print::pprust::expr_to_str;
+use syntax::print::pprust::expr_to_string;
 use syntax::visit;
 use syntax::visit::Visitor;
 
@@ -154,8 +154,8 @@ fn lookup_vtables_for_param(vcx: &VtableContext,
                 vcx.tcx().sess.span_fatal(span,
                     format!("failed to find an implementation of \
                           trait {} for {}",
-                         vcx.infcx.trait_ref_to_str(&*trait_ref),
-                         vcx.infcx.ty_to_str(ty)).as_slice());
+                         vcx.infcx.trait_ref_to_string(&*trait_ref),
+                         vcx.infcx.ty_to_string(ty)).as_slice());
             }
         }
         true
@@ -205,8 +205,8 @@ fn relate_trait_refs(vcx: &VtableContext,
                 let tcx = vcx.tcx();
                 tcx.sess.span_err(span,
                     format!("expected {}, but found {} ({})",
-                            ppaux::trait_ref_to_str(tcx, &r_exp_trait_ref),
-                            ppaux::trait_ref_to_str(tcx, &r_act_trait_ref),
+                            ppaux::trait_ref_to_string(tcx, &r_exp_trait_ref),
+                            ppaux::trait_ref_to_string(tcx, &r_act_trait_ref),
                             ty::type_err_to_str(tcx, err)).as_slice());
             }
         }
@@ -385,8 +385,8 @@ fn search_for_vtable(vcx: &VtableContext,
 
         debug!("(checking vtable) num 2 relating trait \
                 ty {} to of_trait_ref {}",
-               vcx.infcx.trait_ref_to_str(&*trait_ref),
-               vcx.infcx.trait_ref_to_str(&*of_trait_ref));
+               vcx.infcx.trait_ref_to_string(&*trait_ref),
+               vcx.infcx.trait_ref_to_string(&*of_trait_ref));
 
         relate_trait_refs(vcx, span, of_trait_ref, trait_ref.clone());
 
@@ -488,7 +488,7 @@ fn fixup_ty(vcx: &VtableContext,
             tcx.sess.span_fatal(span,
                 format!("cannot determine a type for this bounded type \
                          parameter: {}",
-                        fixup_err_to_str(e)).as_slice())
+                        fixup_err_to_string(e)).as_slice())
         }
         Err(_) => {
             None
@@ -527,7 +527,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
     }
 
     debug!("vtable: early_resolve_expr() ex with id {:?} (early: {}): {}",
-           ex.id, is_early, expr_to_str(ex));
+           ex.id, is_early, expr_to_string(ex));
     let _indent = indenter();
 
     let cx = fcx.ccx;
@@ -626,7 +626,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                           ex.span,
                           format!("can only cast an boxed pointer \
                                    to a boxed object, not a {}",
-                               ty::ty_sort_str(fcx.tcx(), src_ty)).as_slice());
+                               ty::ty_sort_string(fcx.tcx(), src_ty)).as_slice());
                   }
                   _ => {}
               }
@@ -639,7 +639,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
                           ex.span,
                           format!("can only cast an &-pointer \
                                    to an &-object, not a {}",
-                                  ty::ty_sort_str(fcx.tcx(), src_ty)).as_slice());
+                                  ty::ty_sort_string(fcx.tcx(), src_ty)).as_slice());
                   }
                   _ => {}
               }
@@ -657,7 +657,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
             let did = def.def_id();
             let item_ty = ty::lookup_item_type(cx.tcx, did);
             debug!("early resolve expr: def {:?} {:?}, {:?}, {}", ex.id, did, def,
-                   fcx.infcx().ty_to_str(item_ty.ty));
+                   fcx.infcx().ty_to_string(item_ty.ty));
             debug!("early_resolve_expr: looking up vtables for type params {}",
                    item_ty.generics.types.repr(fcx.tcx()));
             let vcx = fcx.vtable_context();
index eb43144571e2abc9173e58c0aa05507250fd4f4e..59b65fdbec790231b0b999bf282a642c21834278 100644 (file)
@@ -31,7 +31,7 @@
 
 use syntax::ast;
 use syntax::codemap::Span;
-use syntax::print::pprust::pat_to_str;
+use syntax::print::pprust::pat_to_string;
 use syntax::visit;
 use syntax::visit::Visitor;
 
@@ -159,7 +159,7 @@ fn visit_pat(&mut self, p: &ast::Pat, _: ()) {
         self.visit_node_id(ResolvingPattern(p.span), p.id);
 
         debug!("Type for pattern binding {} (id {}) resolved to {}",
-               pat_to_str(p),
+               pat_to_string(p),
                p.id,
                ty::node_id_to_type(self.tcx(), p.id).repr(self.tcx()));
 
@@ -403,7 +403,7 @@ fn report_error(&self, e: infer::fixup_err) {
                         span,
                         format!("cannot determine a type for \
                                  this expression: {}",
-                                infer::fixup_err_to_str(e)).as_slice())
+                                infer::fixup_err_to_string(e)).as_slice())
                 }
 
                 ResolvingLocal(span) => {
@@ -411,7 +411,7 @@ fn report_error(&self, e: infer::fixup_err) {
                         span,
                         format!("cannot determine a type for \
                                  this local variable: {}",
-                                infer::fixup_err_to_str(e)).as_slice())
+                                infer::fixup_err_to_string(e)).as_slice())
                 }
 
                 ResolvingPattern(span) => {
@@ -419,7 +419,7 @@ fn report_error(&self, e: infer::fixup_err) {
                         span,
                         format!("cannot determine a type for \
                                  this pattern binding: {}",
-                                infer::fixup_err_to_str(e)).as_slice())
+                                infer::fixup_err_to_string(e)).as_slice())
                 }
 
                 ResolvingUpvar(upvar_id) => {
@@ -430,8 +430,8 @@ fn report_error(&self, e: infer::fixup_err) {
                                  captured variable `{}`: {}",
                                 ty::local_var_name_str(
                                     self.tcx,
-                                    upvar_id.var_id).get().to_str(),
-                                infer::fixup_err_to_str(e)).as_slice());
+                                    upvar_id.var_id).get().to_string(),
+                                infer::fixup_err_to_string(e)).as_slice());
                 }
 
                 ResolvingImplRes(span) => {
index bf88ec5c438f28a62e3d52f61327a2b1dbb2b6af..11a8d9e42762a3b4b409fcb8fa8e54e74b6a7b6d 100644 (file)
@@ -63,7 +63,7 @@
 use syntax::owned_slice::OwnedSlice;
 use syntax::parse::token::special_idents;
 use syntax::parse::token;
-use syntax::print::pprust::{path_to_str};
+use syntax::print::pprust::{path_to_string};
 use syntax::visit;
 
 struct CollectItemTypesVisitor<'a> {
@@ -665,7 +665,7 @@ pub fn instantiate_trait_ref(ccx: &CrateCtxt,
             ccx.tcx.sess.span_fatal(
                 ast_trait_ref.path.span,
                 format!("`{}` is not a trait",
-                        path_to_str(&ast_trait_ref.path)).as_slice());
+                        path_to_string(&ast_trait_ref.path)).as_slice());
         }
     }
 }
@@ -844,7 +844,7 @@ pub fn ty_of_item(ccx: &CrateCtxt, it: &ast::Item)
             debug!("type of {} (id {}) is {}",
                     token::get_ident(it.ident),
                     it.id,
-                    ppaux::ty_to_str(tcx, pty.ty));
+                    ppaux::ty_to_string(tcx, pty.ty));
 
             ccx.tcx.tcache.borrow_mut().insert(local_def(it.id), pty.clone());
             return pty;
@@ -1144,7 +1144,7 @@ fn check_bounds_compatible(tcx: &ty::ctxt,
                         format!("incompatible bounds on type parameter {}, \
                                  bound {} does not allow unsized type",
                         token::get_ident(ident),
-                        ppaux::trait_ref_to_str(tcx,
+                        ppaux::trait_ref_to_string(tcx,
                                                 &*trait_ref)).as_slice());
                 }
                 true
index 053a75e72602ae8eb75e50eb345a7c6727663faf..2b5c95990c3860fe96d8d76a3a8a651fd5c9508a 100644 (file)
@@ -90,7 +90,7 @@
 use syntax::parse::token;
 use syntax::print::pprust;
 use util::ppaux::UserString;
-use util::ppaux::bound_region_to_str;
+use util::ppaux::bound_region_to_string;
 use util::ppaux::note_and_explain_region;
 
 pub trait ErrorReporting {
@@ -442,7 +442,7 @@ fn report_concrete_failure(&self,
                             ty::local_var_name_str(self.tcx,
                                                    upvar_id.var_id)
                                 .get()
-                                .to_str()).as_slice());
+                                .to_string()).as_slice());
                 note_and_explain_region(
                     self.tcx,
                     "...the borrowed pointer is valid for ",
@@ -454,7 +454,7 @@ fn report_concrete_failure(&self,
                             ty::local_var_name_str(self.tcx,
                                                    upvar_id.var_id)
                                 .get()
-                                .to_str()).as_slice(),
+                                .to_string()).as_slice(),
                     sup,
                     "");
             }
@@ -500,7 +500,7 @@ fn report_concrete_failure(&self,
                             outlive the enclosing closure",
                             ty::local_var_name_str(self.tcx,
                                                    id).get()
-                                                      .to_str()).as_slice());
+                                                      .to_string()).as_slice());
                 note_and_explain_region(
                     self.tcx,
                     "captured variable is valid for ",
@@ -1046,7 +1046,7 @@ fn rebuild_arg_ty_or_output(&self,
                                 .sess
                                 .fatal(format!(
                                         "unbound path {}",
-                                        pprust::path_to_str(path)).as_slice())
+                                        pprust::path_to_string(path)).as_slice())
                         }
                         Some(&d) => d
                     };
@@ -1231,7 +1231,7 @@ fn give_expl_lifetime_param(&self,
                                 opt_explicit_self: Option<ast::ExplicitSelf_>,
                                 generics: &ast::Generics,
                                 span: codemap::Span) {
-        let suggested_fn = pprust::fun_to_str(decl, fn_style, ident,
+        let suggested_fn = pprust::fun_to_string(decl, fn_style, ident,
                                               opt_explicit_self, generics);
         let msg = format!("consider using an explicit lifetime \
                            parameter as shown: {}", suggested_fn);
@@ -1249,11 +1249,11 @@ fn report_inference_failure(&self,
             infer::Coercion(_) => " for automatic coercion".to_string(),
             infer::LateBoundRegion(_, br) => {
                 format!(" for {}in function call",
-                        bound_region_to_str(self.tcx, "lifetime parameter ", true, br))
+                        bound_region_to_string(self.tcx, "lifetime parameter ", true, br))
             }
             infer::BoundRegionInFnType(_, br) => {
                 format!(" for {}in function type",
-                        bound_region_to_str(self.tcx, "lifetime parameter ", true, br))
+                        bound_region_to_string(self.tcx, "lifetime parameter ", true, br))
             }
             infer::EarlyBoundRegion(_, name) => {
                 format!(" for lifetime parameter `{}",
@@ -1265,7 +1265,7 @@ fn report_inference_failure(&self,
             }
             infer::UpvarRegion(ref upvar_id, _) => {
                 format!(" for capture of `{}` by closure",
-                        ty::local_var_name_str(self.tcx, upvar_id.var_id).get().to_str())
+                        ty::local_var_name_str(self.tcx, upvar_id.var_id).get().to_string())
             }
         };
 
@@ -1334,7 +1334,7 @@ fn note_region_origin(&self, origin: SubregionOrigin) {
                         "...so that closure can access `{}`",
                         ty::local_var_name_str(self.tcx, upvar_id.var_id)
                             .get()
-                            .to_str()).as_slice())
+                            .to_string()).as_slice())
             }
             infer::InfStackClosure(span) => {
                 self.tcx.sess.span_note(
@@ -1359,7 +1359,7 @@ fn note_region_origin(&self, origin: SubregionOrigin) {
                             does not outlive the enclosing closure",
                             ty::local_var_name_str(
                                 self.tcx,
-                                id).get().to_str()).as_slice());
+                                id).get().to_string()).as_slice());
             }
             infer::IndexSlice(span) => {
                 self.tcx.sess.span_note(
@@ -1508,7 +1508,7 @@ fn give_lifetime(&self) -> ast::Lifetime {
         let mut lifetime;
         loop {
             let mut s = String::from_str("'");
-            s.push_str(num_to_str(self.counter.get()).as_slice());
+            s.push_str(num_to_string(self.counter.get()).as_slice());
             if !self.taken.contains(&s) {
                 lifetime = name_to_dummy_lifetime(
                                     token::str_to_ident(s.as_slice()).name);
@@ -1521,7 +1521,7 @@ fn give_lifetime(&self) -> ast::Lifetime {
         return lifetime;
 
         // 0 .. 25 generates a .. z, 26 .. 51 generates aa .. zz, and so on
-        fn num_to_str(counter: uint) -> String {
+        fn num_to_string(counter: uint) -> String {
             let mut s = String::new();
             let (n, r) = (counter/26 + 1, counter % 26);
             let letter: char = from_u32((r+97) as u32).unwrap();
index d2c27330a94ade27e266e64a360615ac46b8d28a..b6628c22ae60ae2961b34a5c911e34a21f773d3e 100644 (file)
@@ -26,7 +26,7 @@
 use syntax::ast::{Onceness, FnStyle};
 use std::collections::HashMap;
 use util::common::{indenter};
-use util::ppaux::mt_to_str;
+use util::ppaux::mt_to_string;
 use util::ppaux::Repr;
 
 pub struct Glb<'f>(pub CombineFields<'f>);  // "greatest lower bound" (common subtype)
@@ -50,8 +50,8 @@ fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
 
         debug!("{}.mts({}, {})",
                self.tag(),
-               mt_to_str(tcx, a),
-               mt_to_str(tcx, b));
+               mt_to_string(tcx, a),
+               mt_to_string(tcx, b));
 
         match (a.mutbl, b.mutbl) {
           // If one side or both is mut, then the GLB must use
index 1b3d96e474e4b5f051aae01b892f3eb4c9a959fd..708eb498f8421ea5fb059a08ccf5b109b9a2459d 100644 (file)
@@ -39,7 +39,7 @@
 use middle::typeck::infer::combine::*;
 use middle::typeck::infer::glb::Glb;
 use middle::typeck::infer::lub::Lub;
-use middle::typeck::infer::unify::{Root, UnifyKey};
+use middle::typeck::infer::unify::*;
 use middle::typeck::infer::sub::Sub;
 use util::ppaux::Repr;
 
@@ -436,8 +436,7 @@ pub enum LatticeVarResult<K,T> {
  * - If the variables do not both have an upper bound, we will unify
  *   the variables and return the unified variable, in which case the
  *   result is a variable.  This is indicated with a `VarResult`
- *   return.
- */
+ *   return. */
 pub fn lattice_vars<L:LatticeDir+Combine,
                     T:LatticeValue,
                     K:UnifyKey<Bounds<T>>>(
index 7ccffdfeb062fc1ffa4ba2d735784ba41798c354..6a50038afe77fc20ea89f51d6648952e9ea1972c 100644 (file)
@@ -25,7 +25,7 @@
 use syntax::ast::{NormalFn, UnsafeFn};
 use syntax::ast::{Onceness, FnStyle};
 use syntax::ast::{MutMutable, MutImmutable};
-use util::ppaux::mt_to_str;
+use util::ppaux::mt_to_string;
 use util::ppaux::Repr;
 
 pub struct Lub<'f>(pub CombineFields<'f>);  // least-upper-bound: common supertype
@@ -49,8 +49,8 @@ fn mts(&self, a: &ty::mt, b: &ty::mt) -> cres<ty::mt> {
 
         debug!("{}.mts({}, {})",
                self.tag(),
-               mt_to_str(tcx, a),
-               mt_to_str(tcx, b));
+               mt_to_string(tcx, a),
+               mt_to_string(tcx, b));
 
         if a.mutbl != b.mutbl {
             return Err(ty::terr_mutability)
index b505536a59db2b210b9d6d8bdaad8b137b310c03..16e758df9dbbd2ad7c3354f7d716bace80d93f5b 100644 (file)
@@ -44,7 +44,7 @@
 use syntax::codemap;
 use syntax::codemap::Span;
 use util::common::indent;
-use util::ppaux::{bound_region_to_str, ty_to_str, trait_ref_to_str, Repr};
+use util::ppaux::{bound_region_to_string, ty_to_string, trait_ref_to_string, Repr};
 
 pub mod doc;
 pub mod macros;
@@ -245,7 +245,7 @@ pub enum fixup_err {
     region_var_bound_by_region_var(RegionVid, RegionVid)
 }
 
-pub fn fixup_err_to_str(f: fixup_err) -> String {
+pub fn fixup_err_to_string(f: fixup_err) -> String {
     match f {
       unresolved_int_ty(_) => {
           "cannot determine the type of this integer; add a suffix to \
@@ -662,19 +662,19 @@ pub fn resolve_regions_and_report_errors(&self) {
         self.report_region_errors(&errors); // see error_reporting.rs
     }
 
-    pub fn ty_to_str(&self, t: ty::t) -> String {
-        ty_to_str(self.tcx,
+    pub fn ty_to_string(&self, t: ty::t) -> String {
+        ty_to_string(self.tcx,
                   self.resolve_type_vars_if_possible(t))
     }
 
-    pub fn tys_to_str(&self, ts: &[ty::t]) -> String {
-        let tstrs: Vec<String> = ts.iter().map(|t| self.ty_to_str(*t)).collect();
+    pub fn tys_to_string(&self, ts: &[ty::t]) -> String {
+        let tstrs: Vec<String> = ts.iter().map(|t| self.ty_to_string(*t)).collect();
         format!("({})", tstrs.connect(", "))
     }
 
-    pub fn trait_ref_to_str(&self, t: &ty::TraitRef) -> String {
+    pub fn trait_ref_to_string(&self, t: &ty::TraitRef) -> String {
         let t = self.resolve_type_vars_in_trait_ref_if_possible(t);
-        trait_ref_to_str(self.tcx, &t)
+        trait_ref_to_string(self.tcx, &t)
     }
 
     pub fn resolve_type_vars_if_possible(&self, typ: ty::t) -> ty::t {
@@ -707,8 +707,8 @@ pub fn resolve_type_vars_in_trait_ref_if_possible(&self,
                 self.tcx.sess.bug(
                     format!("resolve_type_vars_if_possible() yielded {} \
                              when supplied with {}",
-                            self.ty_to_str(dummy0),
-                            self.ty_to_str(dummy1)).as_slice());
+                            self.ty_to_string(dummy0),
+                            self.ty_to_string(dummy1)).as_slice());
             }
         }
     }
@@ -761,7 +761,7 @@ pub fn type_error_message_str_with_expected(&self,
                 Some(e) => {
                     self.tcx.sess.span_err(sp,
                         format!("{}{}",
-                                mk_msg(Some(self.ty_to_str(e)), actual_ty),
+                                mk_msg(Some(self.ty_to_string(e)), actual_ty),
                                 error_str).as_slice());
                 }
             }
@@ -783,7 +783,7 @@ pub fn type_error_message(&self,
             return;
         }
 
-        self.type_error_message_str(sp, |_e, a| { mk_msg(a) }, self.ty_to_str(actual_ty), err);
+        self.type_error_message_str(sp, |_e, a| { mk_msg(a) }, self.ty_to_string(actual_ty), err);
     }
 
     pub fn report_mismatched_types(&self,
@@ -800,7 +800,7 @@ pub fn report_mismatched_types(&self,
                 // if I leave out : String, it infers &str and complains
                 |actual: String| {
                     format!("mismatched types: expected `{}` but found `{}`",
-                            self.ty_to_str(resolved_expected),
+                            self.ty_to_string(resolved_expected),
                             actual)
                 }
             }
@@ -819,7 +819,7 @@ pub fn replace_late_bound_regions_with_fresh_regions(&self,
                 let rvar = self.next_region_var(
                     BoundRegionInFnType(trace.origin.span(), br));
                 debug!("Bound region {} maps to {:?}",
-                       bound_region_to_str(self.tcx, "", false, br),
+                       bound_region_to_string(self.tcx, "", false, br),
                        rvar);
                 rvar
             });
index adfbe9de2d5bf8b72769c6784a879a16dd64b702..2ae95309d41d98a76e6c00b8f254ddffd415a08c 100644 (file)
@@ -56,7 +56,7 @@
 use middle::typeck::infer::{unresolved_ty};
 use syntax::codemap::Span;
 use util::common::indent;
-use util::ppaux::{Repr, ty_to_str};
+use util::ppaux::{Repr, ty_to_string};
 
 pub static resolve_nested_tvar: uint = 0b0000000001;
 pub static resolve_rvar: uint        = 0b0000000010;
@@ -121,7 +121,7 @@ pub fn resolve_type_chk(&mut self,
         self.err = None;
 
         debug!("Resolving {} (modes={:x})",
-               ty_to_str(self.infcx.tcx, typ),
+               ty_to_string(self.infcx.tcx, typ),
                self.modes);
 
         // n.b. This is a hokey mess because the current fold doesn't
@@ -133,8 +133,8 @@ pub fn resolve_type_chk(&mut self,
         match self.err {
           None => {
             debug!("Resolved to {} + {} (modes={:x})",
-                   ty_to_str(self.infcx.tcx, rty),
-                   ty_to_str(self.infcx.tcx, rty),
+                   ty_to_string(self.infcx.tcx, rty),
+                   ty_to_string(self.infcx.tcx, rty),
                    self.modes);
             return Ok(rty);
           }
index 856237c4bcaa4c3634468e23839267db6a4d74f3..44c147bfe7f62f962b75c813b4e608b4136d5deb 100644 (file)
@@ -22,7 +22,7 @@
 use middle::typeck::infer::then;
 use middle::typeck::infer::{TypeTrace, Subtype};
 use util::common::{indenter};
-use util::ppaux::{bound_region_to_str, Repr};
+use util::ppaux::{bound_region_to_string, Repr};
 
 use syntax::ast::{Onceness, FnStyle, MutImmutable, MutMutable};
 
@@ -176,7 +176,7 @@ fn fn_sigs(&self, a: &ty::FnSig, b: &ty::FnSig) -> cres<ty::FnSig> {
             replace_late_bound_regions_in_fn_sig(self.get_ref().infcx.tcx, b, |br| {
                 let skol = self.get_ref().infcx.region_vars.new_skolemized(br);
                 debug!("Bound region {} skolemized to {:?}",
-                       bound_region_to_str(self.get_ref().infcx.tcx, "", false, br),
+                       bound_region_to_string(self.get_ref().infcx.tcx, "", false, br),
                        skol);
                 skol
             })
index ff9f855c987573e5c29f171fa14b4cc3d546388c..e66dcd118c92892186cb85857d2e6a4b4ef801c7 100644 (file)
@@ -37,7 +37,7 @@
 use syntax::codemap::{Span, CodeMap, DUMMY_SP};
 use syntax::diagnostic::{Level, RenderSpan, Bug, Fatal, Error, Warning, Note};
 use syntax::ast;
-use util::ppaux::{ty_to_str, UserString};
+use util::ppaux::{ty_to_string, UserString};
 
 struct Env<'a> {
     krate: ast::Crate,
@@ -225,16 +225,16 @@ pub fn is_subtype(&self, a: ty::t, b: ty::t) -> bool {
     pub fn assert_subtype(&self, a: ty::t, b: ty::t) {
         if !self.is_subtype(a, b) {
             fail!("{} is not a subtype of {}, but it should be",
-                  self.ty_to_str(a),
-                  self.ty_to_str(b));
+                  self.ty_to_string(a),
+                  self.ty_to_string(b));
         }
     }
 
     pub fn assert_not_subtype(&self, a: ty::t, b: ty::t) {
         if self.is_subtype(a, b) {
             fail!("{} is a subtype of {}, but it shouldn't be",
-                  self.ty_to_str(a),
-                  self.ty_to_str(b));
+                  self.ty_to_string(a),
+                  self.ty_to_string(b));
         }
     }
 
@@ -243,8 +243,8 @@ pub fn assert_eq(&self, a: ty::t, b: ty::t) {
         self.assert_subtype(b, a);
     }
 
-    pub fn ty_to_str(&self, a: ty::t) -> String {
-        ty_to_str(self.tcx, a)
+    pub fn ty_to_string(&self, a: ty::t) -> String {
+        ty_to_string(self.tcx, a)
     }
 
     pub fn t_fn(&self,
@@ -328,9 +328,9 @@ pub fn check_lub(&self, t1: ty::t, t2: ty::t, t_lub: ty::t) {
     /// Checks that `GLB(t1,t2) == t_glb`
     pub fn check_glb(&self, t1: ty::t, t2: ty::t, t_glb: ty::t) {
         debug!("check_glb(t1={}, t2={}, t_glb={})",
-               self.ty_to_str(t1),
-               self.ty_to_str(t2),
-               self.ty_to_str(t_glb));
+               self.ty_to_string(t1),
+               self.ty_to_string(t2),
+               self.ty_to_string(t_glb));
         match self.glb().tys(t1, t2) {
             Err(e) => {
                 fail!("unexpected error computing LUB: {:?}", e)
@@ -350,7 +350,7 @@ pub fn check_no_lub(&self, t1: ty::t, t2: ty::t) {
         match self.lub().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
-                fail!("unexpected success computing LUB: {}", self.ty_to_str(t))
+                fail!("unexpected success computing LUB: {}", self.ty_to_string(t))
             }
         }
     }
@@ -360,7 +360,7 @@ pub fn check_no_glb(&self, t1: ty::t, t2: ty::t) {
         match self.glb().tys(t1, t2) {
             Err(_) => {}
             Ok(t) => {
-                fail!("unexpected success computing GLB: {}", self.ty_to_str(t))
+                fail!("unexpected success computing GLB: {}", self.ty_to_string(t))
             }
         }
     }
index 7b6935df42079a561fd0e8a12006937679511f71..ad6864ba487921680001aa59e6b180a3032207ac 100644 (file)
@@ -276,7 +276,7 @@ pub struct CrateCtxt<'a> {
 
 // Functions that write types into the node type table
 pub fn write_ty_to_tcx(tcx: &ty::ctxt, node_id: ast::NodeId, ty: ty::t) {
-    debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_str(tcx, ty));
+    debug!("write_ty_to_tcx({}, {})", node_id, ppaux::ty_to_string(tcx, ty));
     assert!(!ty::type_needs_infer(ty));
     tcx.node_types.borrow_mut().insert(node_id as uint, ty);
 }
@@ -383,14 +383,14 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
             require_same_types(tcx, None, false, main_span, main_t, se_ty,
                 || {
                     format!("main function expects type: `{}`",
-                            ppaux::ty_to_str(ccx.tcx, se_ty))
+                            ppaux::ty_to_string(ccx.tcx, se_ty))
                 });
         }
         _ => {
             tcx.sess.span_bug(main_span,
                               format!("main has a non-function type: found \
                                        `{}`",
-                                      ppaux::ty_to_str(tcx,
+                                      ppaux::ty_to_string(tcx,
                                                        main_t)).as_slice());
         }
     }
@@ -436,7 +436,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
             require_same_types(tcx, None, false, start_span, start_t, se_ty,
                 || {
                     format!("start function expects type: `{}`",
-                            ppaux::ty_to_str(ccx.tcx, se_ty))
+                            ppaux::ty_to_string(ccx.tcx, se_ty))
                 });
 
         }
@@ -444,7 +444,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
             tcx.sess.span_bug(start_span,
                               format!("start has a non-function type: found \
                                        `{}`",
-                                      ppaux::ty_to_str(tcx,
+                                      ppaux::ty_to_string(tcx,
                                                        start_t)).as_slice());
         }
     }
index fb3ce391d8e34b12d4756de47e2f5c904933faf9..8b5d16620b0f5898d02a5f0b89bdea289b6a34c2 100644 (file)
@@ -547,7 +547,7 @@ fn inferred_index(&self, param_id: ast::NodeId) -> InferredIndex {
             None => {
                 self.tcx().sess.bug(format!(
                         "no inferred index entry for {}",
-                        self.tcx().map.node_to_str(param_id)).as_slice());
+                        self.tcx().map.node_to_string(param_id)).as_slice());
             }
         }
     }
@@ -588,8 +588,8 @@ fn is_to_be_inferred(&self, param_id: ast::NodeId) -> bool {
             let is_inferred;
             macro_rules! cannot_happen { () => { {
                 fail!("invalid parent: {:s} for {:s}",
-                      tcx.map.node_to_str(parent_id),
-                      tcx.map.node_to_str(param_id));
+                      tcx.map.node_to_string(parent_id),
+                      tcx.map.node_to_string(param_id));
             } } }
 
             match parent {
@@ -658,7 +658,7 @@ fn add_constraint(&mut self,
                       InferredIndex(index): InferredIndex,
                       variance: VarianceTermPtr<'a>) {
         debug!("add_constraint(index={}, variance={})",
-                index, variance.to_str());
+                index, variance.to_string());
         self.constraints.push(Constraint { inferred: InferredIndex(index),
                                            variance: variance });
     }
@@ -975,7 +975,7 @@ fn solve(&mut self) {
                                 .param_id,
                             old_value,
                             new_value,
-                            term.to_str());
+                            term.to_string());
 
                     *self.solutions.get_mut(inferred) = new_value;
                     changed = true;
index f228ea32ae522ffb6be2c8649c38e09a6a66e898..542bc68ef738cf260464a69e20e1160bab7206f8 100644 (file)
@@ -105,7 +105,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region)
           BrFresh(_) => "an anonymous lifetime defined on".to_string(),
           _ => {
               format!("the lifetime {} as defined on",
-                      bound_region_ptr_to_str(cx, fr.bound_region))
+                      bound_region_ptr_to_string(cx, fr.bound_region))
           }
         };
 
@@ -145,11 +145,11 @@ fn explain_span(cx: &ctxt, heading: &str, span: Span)
     }
 }
 
-pub fn bound_region_ptr_to_str(cx: &ctxt, br: BoundRegion) -> String {
-    bound_region_to_str(cx, "", false, br)
+pub fn bound_region_ptr_to_string(cx: &ctxt, br: BoundRegion) -> String {
+    bound_region_to_string(cx, "", false, br)
 }
 
-pub fn bound_region_to_str(cx: &ctxt,
+pub fn bound_region_to_string(cx: &ctxt,
                            prefix: &str, space: bool,
                            br: BoundRegion) -> String {
     let space_str = if space { " " } else { "" };
@@ -170,11 +170,11 @@ pub fn bound_region_to_str(cx: &ctxt,
 // In general, if you are giving a region error message,
 // you should use `explain_region()` or, better yet,
 // `note_and_explain_region()`
-pub fn region_ptr_to_str(cx: &ctxt, region: Region) -> String {
-    region_to_str(cx, "&", true, region)
+pub fn region_ptr_to_string(cx: &ctxt, region: Region) -> String {
+    region_to_string(cx, "&", true, region)
 }
 
-pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> String {
+pub fn region_to_string(cx: &ctxt, prefix: &str, space: bool, region: Region) -> String {
     let space_str = if space { " " } else { "" };
 
     if cx.sess.verbose() {
@@ -190,10 +190,10 @@ pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> St
         ty::ReEarlyBound(_, _, _, name) => {
             token::get_name(name).get().to_string()
         }
-        ty::ReLateBound(_, br) => bound_region_to_str(cx, prefix, space, br),
-        ty::ReFree(ref fr) => bound_region_to_str(cx, prefix, space, fr.bound_region),
+        ty::ReLateBound(_, br) => bound_region_to_string(cx, prefix, space, br),
+        ty::ReFree(ref fr) => bound_region_to_string(cx, prefix, space, fr.bound_region),
         ty::ReInfer(ReSkolemized(_, br)) => {
-            bound_region_to_str(cx, prefix, space, br)
+            bound_region_to_string(cx, prefix, space, br)
         }
         ty::ReInfer(ReVar(_)) => prefix.to_string(),
         ty::ReStatic => format!("{}'static{}", prefix, space_str),
@@ -201,45 +201,55 @@ pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> St
     }
 }
 
-pub fn mutability_to_str(m: ast::Mutability) -> String {
+pub fn mutability_to_string(m: ast::Mutability) -> String {
     match m {
         ast::MutMutable => "mut ".to_string(),
         ast::MutImmutable => "".to_string(),
     }
 }
 
-pub fn mt_to_str(cx: &ctxt, m: &mt) -> String {
-    format!("{}{}", mutability_to_str(m.mutbl), ty_to_str(cx, m.ty))
+pub fn mt_to_string(cx: &ctxt, m: &mt) -> String {
+    format!("{}{}", mutability_to_string(m.mutbl), ty_to_string(cx, m.ty))
 }
 
+#[cfg(stage0)]
 pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> String {
+    trait_store_to_string(cx, s)
+}
+
+pub fn trait_store_to_string(cx: &ctxt, s: ty::TraitStore) -> String {
     match s {
         ty::UniqTraitStore => "Box ".to_string(),
         ty::RegionTraitStore(r, m) => {
-            format!("{}{}", region_ptr_to_str(cx, r), mutability_to_str(m))
+            format!("{}{}", region_ptr_to_string(cx, r), mutability_to_string(m))
         }
     }
 }
 
-pub fn vec_map_to_str<T>(ts: &[T], f: |t: &T| -> String) -> String {
+pub fn vec_map_to_string<T>(ts: &[T], f: |t: &T| -> String) -> String {
     let tstrs = ts.iter().map(f).collect::<Vec<String>>();
     format!("[{}]", tstrs.connect(", "))
 }
 
-pub fn fn_sig_to_str(cx: &ctxt, typ: &ty::FnSig) -> String {
+pub fn fn_sig_to_string(cx: &ctxt, typ: &ty::FnSig) -> String {
     format!("fn{}{} -> {}", typ.binder_id, typ.inputs.repr(cx),
             typ.output.repr(cx))
 }
 
-pub fn trait_ref_to_str(cx: &ctxt, trait_ref: &ty::TraitRef) -> String {
+pub fn trait_ref_to_string(cx: &ctxt, trait_ref: &ty::TraitRef) -> String {
     trait_ref.user_string(cx).to_string()
 }
 
+#[cfg(stage0)]
 pub fn ty_to_str(cx: &ctxt, typ: t) -> String {
-    fn fn_input_to_str(cx: &ctxt, input: ty::t) -> String {
-        ty_to_str(cx, input).to_string()
+    ty_to_string(cx, typ)
+}
+
+pub fn ty_to_string(cx: &ctxt, typ: t) -> String {
+    fn fn_input_to_string(cx: &ctxt, input: ty::t) -> String {
+        ty_to_string(cx, input).to_string()
     }
-    fn bare_fn_to_str(cx: &ctxt,
+    fn bare_fn_to_string(cx: &ctxt,
                       fn_style: ast::FnStyle,
                       abi: abi::Abi,
                       ident: Option<ast::Ident>,
@@ -249,13 +259,13 @@ fn bare_fn_to_str(cx: &ctxt,
         match fn_style {
             ast::NormalFn => {}
             _ => {
-                s.push_str(fn_style.to_str().as_slice());
+                s.push_str(fn_style.to_string().as_slice());
                 s.push_char(' ');
             }
         };
 
         if abi != abi::Rust {
-            s.push_str(format!("extern {} ", abi.to_str()).as_slice());
+            s.push_str(format!("extern {} ", abi.to_string()).as_slice());
         };
 
         s.push_str("fn");
@@ -268,25 +278,25 @@ fn bare_fn_to_str(cx: &ctxt,
             _ => { }
         }
 
-        push_sig_to_str(cx, &mut s, '(', ')', sig);
+        push_sig_to_string(cx, &mut s, '(', ')', sig);
 
         s
     }
 
-    fn closure_to_str(cx: &ctxt, cty: &ty::ClosureTy) -> String {
+    fn closure_to_string(cx: &ctxt, cty: &ty::ClosureTy) -> String {
         let mut s = String::new();
 
         match cty.store {
             ty::UniqTraitStore => {}
             ty::RegionTraitStore(region, _) => {
-                s.push_str(region_to_str(cx, "", true, region).as_slice());
+                s.push_str(region_to_string(cx, "", true, region).as_slice());
             }
         }
 
         match cty.fn_style {
             ast::NormalFn => {}
             _ => {
-                s.push_str(cty.fn_style.to_str().as_slice());
+                s.push_str(cty.fn_style.to_string().as_slice());
                 s.push_char(' ');
             }
         };
@@ -295,14 +305,14 @@ fn closure_to_str(cx: &ctxt, cty: &ty::ClosureTy) -> String {
             ty::UniqTraitStore => {
                 assert_eq!(cty.onceness, ast::Once);
                 s.push_str("proc");
-                push_sig_to_str(cx, &mut s, '(', ')', &cty.sig);
+                push_sig_to_string(cx, &mut s, '(', ')', &cty.sig);
             }
             ty::RegionTraitStore(..) => {
                 match cty.onceness {
                     ast::Many => {}
                     ast::Once => s.push_str("once ")
                 }
-                push_sig_to_str(cx, &mut s, '|', '|', &cty.sig);
+                push_sig_to_string(cx, &mut s, '|', '|', &cty.sig);
             }
         }
 
@@ -314,13 +324,13 @@ fn closure_to_str(cx: &ctxt, cty: &ty::ClosureTy) -> String {
         s
     }
 
-    fn push_sig_to_str(cx: &ctxt,
+    fn push_sig_to_string(cx: &ctxt,
                        s: &mut String,
                        bra: char,
                        ket: char,
                        sig: &ty::FnSig) {
         s.push_char(bra);
-        let strs: Vec<String> = sig.inputs.iter().map(|a| fn_input_to_str(cx, *a)).collect();
+        let strs: Vec<String> = sig.inputs.iter().map(|a| fn_input_to_string(cx, *a)).collect();
         s.push_str(strs.connect(", ").as_slice());
         if sig.variadic {
             s.push_str(", ...");
@@ -332,7 +342,7 @@ fn push_sig_to_str(cx: &ctxt,
             if ty::type_is_bot(sig.output) {
                 s.push_char('!');
             } else {
-                s.push_str(ty_to_str(cx, sig.output).as_slice());
+                s.push_str(ty_to_string(cx, sig.output).as_slice());
             }
         }
     }
@@ -349,33 +359,33 @@ fn push_sig_to_str(cx: &ctxt,
       ty_bot => "!".to_string(),
       ty_bool => "bool".to_string(),
       ty_char => "char".to_string(),
-      ty_int(t) => ast_util::int_ty_to_str(t, None).to_string(),
-      ty_uint(t) => ast_util::uint_ty_to_str(t, None).to_string(),
-      ty_float(t) => ast_util::float_ty_to_str(t).to_string(),
-      ty_box(typ) => format!("Gc<{}>", ty_to_str(cx, typ)),
-      ty_uniq(typ) => format!("Box<{}>", ty_to_str(cx, typ)),
+      ty_int(t) => ast_util::int_ty_to_string(t, None).to_string(),
+      ty_uint(t) => ast_util::uint_ty_to_string(t, None).to_string(),
+      ty_float(t) => ast_util::float_ty_to_string(t).to_string(),
+      ty_box(typ) => format!("Gc<{}>", ty_to_string(cx, typ)),
+      ty_uniq(typ) => format!("Box<{}>", ty_to_string(cx, typ)),
       ty_ptr(ref tm) => {
           format!("*{} {}", match tm.mutbl {
               ast::MutMutable => "mut",
               ast::MutImmutable => "const",
-          }, ty_to_str(cx, tm.ty))
+          }, ty_to_string(cx, tm.ty))
       }
       ty_rptr(r, ref tm) => {
-          let mut buf = region_ptr_to_str(cx, r);
-          buf.push_str(mt_to_str(cx, tm).as_slice());
+          let mut buf = region_ptr_to_string(cx, r);
+          buf.push_str(mt_to_string(cx, tm).as_slice());
           buf
       }
       ty_tup(ref elems) => {
-        let strs: Vec<String> = elems.iter().map(|elem| ty_to_str(cx, *elem)).collect();
+        let strs: Vec<String> = elems.iter().map(|elem| ty_to_string(cx, *elem)).collect();
         format!("({})", strs.connect(","))
       }
       ty_closure(ref f) => {
-          closure_to_str(cx, *f)
+          closure_to_string(cx, *f)
       }
       ty_bare_fn(ref f) => {
-          bare_fn_to_str(cx, f.fn_style, f.abi, None, &f.sig)
+          bare_fn_to_string(cx, f.fn_style, f.abi, None, &f.sig)
       }
-      ty_infer(infer_ty) => infer_ty.to_str(),
+      ty_infer(infer_ty) => infer_ty.to_string(),
       ty_err => "[type error]".to_string(),
       ty_param(ParamTy {idx: id, def_id: did, ..}) => {
           let ident = match cx.ty_param_defs.borrow().find(&did.node) {
@@ -413,9 +423,9 @@ fn push_sig_to_str(cx: &ctxt,
       ty_vec(ref mt, sz) => {
           match sz {
               Some(n) => {
-                  format!("[{}, .. {}]", mt_to_str(cx, mt), n)
+                  format!("[{}, .. {}]", mt_to_string(cx, mt), n)
               }
-              None => format!("[{}]", ty_to_str(cx, mt.ty)),
+              None => format!("[{}]", ty_to_string(cx, mt.ty)),
           }
       }
     }
@@ -433,7 +443,7 @@ pub fn parameterized(cx: &ctxt,
         subst::ErasedRegions => { }
         subst::NonerasedRegions(ref regions) => {
             for &r in regions.iter() {
-                let s = region_to_str(cx, "", false, r);
+                let s = region_to_string(cx, "", false, r);
                 if !s.is_empty() {
                     strs.push(s)
                 } else {
@@ -463,7 +473,7 @@ pub fn parameterized(cx: &ctxt,
     };
 
     for t in tps.slice_to(tps.len() - num_defaults).iter() {
-        strs.push(ty_to_str(cx, *t))
+        strs.push(ty_to_string(cx, *t))
     }
 
     if cx.sess.verbose() {
@@ -530,7 +540,7 @@ fn repr(&self, tcx: &ctxt) -> String {
 }
 
 fn repr_vec<T:Repr>(tcx: &ctxt, v: &[T]) -> String {
-    vec_map_to_str(v, |t| t.repr(tcx))
+    vec_map_to_string(v, |t| t.repr(tcx))
 }
 
 impl<'a, T:Repr> Repr for &'a [T] {
@@ -576,13 +586,13 @@ fn repr(&self, _tcx: &ctxt) -> String {
 
 impl Repr for ty::t {
     fn repr(&self, tcx: &ctxt) -> String {
-        ty_to_str(tcx, *self)
+        ty_to_string(tcx, *self)
     }
 }
 
 impl Repr for ty::mt {
     fn repr(&self, tcx: &ctxt) -> String {
-        mt_to_str(tcx, self)
+        mt_to_string(tcx, self)
     }
 }
 
@@ -639,25 +649,25 @@ fn repr(&self, tcx: &ctxt) -> String {
 
 impl Repr for ty::TraitRef {
     fn repr(&self, tcx: &ctxt) -> String {
-        trait_ref_to_str(tcx, self)
+        trait_ref_to_string(tcx, self)
     }
 }
 
 impl Repr for ast::Expr {
     fn repr(&self, _tcx: &ctxt) -> String {
-        format!("expr({}: {})", self.id, pprust::expr_to_str(self))
+        format!("expr({}: {})", self.id, pprust::expr_to_string(self))
     }
 }
 
 impl Repr for ast::Path {
     fn repr(&self, _tcx: &ctxt) -> String {
-        format!("path({})", pprust::path_to_str(self))
+        format!("path({})", pprust::path_to_string(self))
     }
 }
 
 impl Repr for ast::Item {
     fn repr(&self, tcx: &ctxt) -> String {
-        format!("item({})", tcx.map.node_to_str(self.id))
+        format!("item({})", tcx.map.node_to_string(self.id))
     }
 }
 
@@ -665,13 +675,13 @@ impl Repr for ast::Stmt {
     fn repr(&self, _tcx: &ctxt) -> String {
         format!("stmt({}: {})",
                 ast_util::stmt_id(self),
-                pprust::stmt_to_str(self))
+                pprust::stmt_to_string(self))
     }
 }
 
 impl Repr for ast::Pat {
     fn repr(&self, _tcx: &ctxt) -> String {
-        format!("pat({}: {})", self.id, pprust::pat_to_str(self))
+        format!("pat({}: {})", self.id, pprust::pat_to_string(self))
     }
 }
 
@@ -787,10 +797,10 @@ fn repr(&self, tcx: &ctxt) -> String {
 
 impl Repr for ty::Variance {
     fn repr(&self, _: &ctxt) -> String {
-        // The first `.to_str()` returns a &'static str (it is not an implementation
-        // of the ToStr trait). Because of that, we need to call `.to_str()` again
+        // The first `.to_string()` returns a &'static str (it is not an implementation
+        // of the ToString trait). Because of that, we need to call `.to_string()` again
         // if we want to have a `String`.
-        self.to_str().to_str()
+        self.to_string().to_string()
     }
 }
 
@@ -835,14 +845,14 @@ impl Repr for ty::BareFnTy {
     fn repr(&self, tcx: &ctxt) -> String {
         format!("BareFnTy {{fn_style: {:?}, abi: {}, sig: {}}}",
                 self.fn_style,
-                self.abi.to_str(),
+                self.abi.to_string(),
                 self.sig.repr(tcx))
     }
 }
 
 impl Repr for ty::FnSig {
     fn repr(&self, tcx: &ctxt) -> String {
-        fn_sig_to_str(tcx, self)
+        fn_sig_to_string(tcx, self)
     }
 }
 
@@ -892,7 +902,7 @@ fn repr(&self, tcx: &ctxt) -> String {
 
 impl Repr for ty::TraitStore {
     fn repr(&self, tcx: &ctxt) -> String {
-        trait_store_to_str(tcx, *self)
+        trait_store_to_string(tcx, *self)
     }
 }
 
@@ -922,7 +932,7 @@ fn repr(&self, tcx: &ctxt) -> String {
 
 impl Repr for Span {
     fn repr(&self, tcx: &ctxt) -> String {
-        tcx.sess.codemap().span_to_str(*self).to_string()
+        tcx.sess.codemap().span_to_string(*self).to_string()
     }
 }
 
@@ -953,7 +963,7 @@ fn user_string(&self, tcx: &ctxt) -> String {
 
 impl UserString for ty::t {
     fn user_string(&self, tcx: &ctxt) -> String {
-        ty_to_str(tcx, *self)
+        ty_to_string(tcx, *self)
     }
 }
 
@@ -965,13 +975,13 @@ fn user_string(&self, _tcx: &ctxt) -> String {
 
 impl Repr for abi::Abi {
     fn repr(&self, _tcx: &ctxt) -> String {
-        self.to_str()
+        self.to_string()
     }
 }
 
 impl UserString for abi::Abi {
     fn user_string(&self, _tcx: &ctxt) -> String {
-        self.to_str()
+        self.to_string()
     }
 }
 
index 2d498e7f302d3fca3330b0182ea547608eac6c68..b3891432e2146e280317216cdedcb4f2aa877c16 100644 (file)
@@ -99,7 +99,7 @@ fn try_inline_def(cx: &core::DocContext,
     cx.inlined.borrow_mut().get_mut_ref().insert(did);
     ret.push(clean::Item {
         source: clean::Span::empty(),
-        name: Some(fqn.last().unwrap().to_str()),
+        name: Some(fqn.last().unwrap().to_string()),
         attrs: load_attrs(tcx, did),
         inner: inner,
         visibility: Some(ast::Public),
@@ -136,7 +136,7 @@ pub fn record_extern_fqn(cx: &core::DocContext,
     match cx.maybe_typed {
         core::Typed(ref tcx) => {
             let fqn = csearch::get_item_path(tcx, did);
-            let fqn = fqn.move_iter().map(|i| i.to_str()).collect();
+            let fqn = fqn.move_iter().map(|i| i.to_string()).collect();
             cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, kind));
         }
         core::NotTyped(..) => {}
index 1ddd97e2ed45f35e65a8a2ed3b214015a2a41484..6c40ee21040ad2f41c0c6c2c0548cd90d5dba1bd 100644 (file)
@@ -408,7 +408,7 @@ fn clean(&self) -> Attribute {
                 List(s.get().to_string(), l.clean().move_iter().collect())
             }
             ast::MetaNameValue(ref s, ref v) => {
-                NameValue(s.get().to_string(), lit_to_str(v))
+                NameValue(s.get().to_string(), lit_to_string(v))
             }
         }
     }
@@ -539,7 +539,7 @@ fn clean(&self) -> TyParamBound {
                  external_path("Share", &empty)),
         };
         let fqn = csearch::get_item_path(tcx, did);
-        let fqn = fqn.move_iter().map(|i| i.to_str()).collect();
+        let fqn = fqn.move_iter().map(|i| i.to_string()).collect();
         cx.external_paths.borrow_mut().get_mut_ref().insert(did,
                                                             (fqn, TypeTrait));
         TraitBound(ResolvedPath {
@@ -558,7 +558,7 @@ fn clean(&self) -> TyParamBound {
             core::NotTyped(_) => return RegionBound,
         };
         let fqn = csearch::get_item_path(tcx, self.def_id);
-        let fqn = fqn.move_iter().map(|i| i.to_str())
+        let fqn = fqn.move_iter().map(|i| i.to_string())
                      .collect::<Vec<String>>();
         let path = external_path(fqn.last().unwrap().as_slice(),
                                  &self.substs);
@@ -1137,7 +1137,7 @@ fn find(attrs: &[Attribute]) -> Option<Primitive> {
         return None
     }
 
-    pub fn to_str(&self) -> &'static str {
+    pub fn to_string(&self) -> &'static str {
         match *self {
             Int => "int",
             I8 => "i8",
@@ -1163,7 +1163,7 @@ pub fn to_str(&self) -> &'static str {
     pub fn to_url_str(&self) -> &'static str {
         match *self {
             Unit => "unit",
-            other => other.to_str(),
+            other => other.to_string(),
         }
     }
 
@@ -1242,7 +1242,7 @@ fn clean(&self) -> Type {
                     lifetimes: Vec::new(), type_params: Vec::new()
                 },
                 decl: (ast_util::local_def(0), &fty.sig).clean(),
-                abi: fty.abi.to_str(),
+                abi: fty.abi.to_string(),
             }),
             ty::ty_closure(ref fty) => {
                 let decl = box ClosureDecl {
@@ -1262,14 +1262,14 @@ fn clean(&self) -> Type {
             ty::ty_trait(box ty::TyTrait { def_id: did, ref substs, .. }) => {
                 let fqn = csearch::get_item_path(get_cx().tcx(), did);
                 let fqn: Vec<String> = fqn.move_iter().map(|i| {
-                    i.to_str()
+                    i.to_string()
                 }).collect();
                 let kind = match ty::get(*self).sty {
                     ty::ty_struct(..) => TypeStruct,
                     ty::ty_trait(..) => TypeTrait,
                     _ => TypeEnum,
                 };
-                let path = external_path(fqn.last().unwrap().to_str().as_slice(),
+                let path = external_path(fqn.last().unwrap().to_string().as_slice(),
                                          substs);
                 get_cx().external_paths.borrow_mut().get_mut_ref()
                                        .insert(did, (fqn, kind));
@@ -1577,7 +1577,7 @@ fn clean(&self) -> PathSegment {
     }
 }
 
-fn path_to_str(p: &ast::Path) -> String {
+fn path_to_string(p: &ast::Path) -> String {
     let mut s = String::new();
     let mut first = true;
     for i in p.segments.iter().map(|x| token::get_ident(x.identifier)) {
@@ -1643,7 +1643,7 @@ fn clean(&self) -> BareFunctionDecl {
                 type_params: Vec::new(),
             },
             decl: self.decl.clean(),
-            abi: self.abi.to_str(),
+            abi: self.abi.to_string(),
         }
     }
 }
@@ -1916,7 +1916,7 @@ fn to_src(&self) -> String {
     }
 }
 
-fn lit_to_str(lit: &ast::Lit) -> String {
+fn lit_to_string(lit: &ast::Lit) -> String {
     match lit.node {
         ast::LitStr(ref st, _) => st.get().to_string(),
         ast::LitBinary(ref data) => format!("{:?}", data.as_slice()),
@@ -1929,12 +1929,12 @@ fn lit_to_str(lit: &ast::Lit) -> String {
             res
         },
         ast::LitChar(c) => format!("'{}'", c),
-        ast::LitInt(i, _t) => i.to_str(),
-        ast::LitUint(u, _t) => u.to_str(),
-        ast::LitIntUnsuffixed(i) => i.to_str(),
+        ast::LitInt(i, _t) => i.to_string(),
+        ast::LitUint(u, _t) => u.to_string(),
+        ast::LitIntUnsuffixed(i) => i.to_string(),
         ast::LitFloat(ref f, _t) => f.get().to_string(),
         ast::LitFloatUnsuffixed(ref f) => f.get().to_string(),
-        ast::LitBool(b) => b.to_str(),
+        ast::LitBool(b) => b.to_string(),
         ast::LitNil => "".to_string(),
     }
 }
@@ -1947,7 +1947,7 @@ fn name_from_pat(p: &ast::Pat) -> String {
         PatWild => "_".to_string(),
         PatWildMulti => "..".to_string(),
         PatIdent(_, ref p, _) => token::get_ident(p.node).get().to_string(),
-        PatEnum(ref p, _) => path_to_str(p),
+        PatEnum(ref p, _) => path_to_string(p),
         PatStruct(..) => fail!("tried to get argument name from pat_struct, \
                                 which is not allowed in function arguments"),
         PatTup(..) => "(tuple arg NYI)".to_string(),
index cec665768d1ee86ab4aad758480f60792d7f5283..382e299d28d9690b81c40315d1ab228f9850b6b3 100644 (file)
@@ -351,7 +351,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 tybounds(f, typarams)
             }
             clean::Self(..) => f.write("Self".as_bytes()),
-            clean::Primitive(prim) => primitive_link(f, prim, prim.to_str()),
+            clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
             clean::Closure(ref decl, ref region) => {
                 write!(f, "{style}{lifetimes}|{args}|{bounds}{arrow}",
                        style = FnStyleSpace(decl.fn_style),
@@ -405,7 +405,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                        } else {
                            let mut m = decl.bounds
                                            .iter()
-                                           .map(|s| s.to_str());
+                                           .map(|s| s.to_string());
                            format!(
                                ": {}",
                                m.collect::<Vec<String>>().connect(" + "))
@@ -607,7 +607,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *stab {
             Some(ref stability) => {
                 write!(f, "<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
-                       lvl = stability.level.to_str(),
+                       lvl = stability.level.to_string(),
                        reason = stability.text)
             }
             None => Ok(())
@@ -621,7 +621,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *stab {
             Some(ref stability) => {
                 write!(f, "<a class='stability {lvl}' title='{lvl}{colon}{reason}'></a>",
-                       lvl = stability.level.to_str(),
+                       lvl = stability.level.to_string(),
                        colon = if stability.text.len() > 0 { ": " } else { "" },
                        reason = stability.text)
             }
index de4bbeb6e30c8a6439c31d1f46424392796f15cf..19a9bcb9a17ab97878d6d73fe031bb47df1c0da1 100644 (file)
@@ -229,7 +229,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result {
         // Transform the contents of the header into a hyphenated string
         let id = s.as_slice().words().map(|s| {
             match s.to_ascii_opt() {
-                Some(s) => s.to_lower().into_str(),
+                Some(s) => s.to_lower().into_string(),
                 None => s.to_string()
             }
         }).collect::<Vec<String>>().connect("-");
index 917eab4eeb9918e547fc2e42f105b85c83c2d516..eeeee8cedf1831a1c5cc07c590140abd90cd472e 100644 (file)
@@ -428,7 +428,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
         }
         try!(write!(&mut w, r#"[{:u},"{}","{}",{}"#,
                     item.ty, item.name, path,
-                    item.desc.to_json().to_str()));
+                    item.desc.to_json().to_string()));
         match item.parent {
             Some(nodeid) => {
                 let pathid = *nodeid_to_pathid.find(&nodeid).unwrap();
index 7d6f44f5d168a7a3bddeba9791eed749f9dec1d3..b53363738ac94f59c5c8ab26281052b73b78de60 100644 (file)
@@ -367,7 +367,7 @@ fn json_input(input: &str) -> Result<Output, String> {
         }
     };
     match json::from_reader(&mut input) {
-        Err(s) => Err(s.to_str()),
+        Err(s) => Err(s.to_string()),
         Ok(json::Object(obj)) => {
             let mut obj = obj;
             // Make sure the schema is what we expect
index 161d3ed5e65e1cf70b259481e2321f7b2ebbb754..06f4e71871d40ba4c3d36a483a1d62b8abcd5ef3 100644 (file)
@@ -804,7 +804,7 @@ fn check(s: &str, c_str: *const libc::c_char) {
         Mary had a little lamb, Little lamb
         Mary had a little lamb, Little lamb";
 
-    fn bench_to_str(b: &mut Bencher, s: &str) {
+    fn bench_to_string(b: &mut Bencher, s: &str) {
         b.iter(|| {
             let c_str = s.to_c_str();
             check(s, c_str.as_ptr());
@@ -813,17 +813,17 @@ fn bench_to_str(b: &mut Bencher, s: &str) {
 
     #[bench]
     fn bench_to_c_str_short(b: &mut Bencher) {
-        bench_to_str(b, s_short)
+        bench_to_string(b, s_short)
     }
 
     #[bench]
     fn bench_to_c_str_medium(b: &mut Bencher) {
-        bench_to_str(b, s_medium)
+        bench_to_string(b, s_medium)
     }
 
     #[bench]
     fn bench_to_c_str_long(b: &mut Bencher) {
-        bench_to_str(b, s_long)
+        bench_to_string(b, s_long)
     }
 
     fn bench_to_c_str_unchecked(b: &mut Bencher, s: &str) {
index a9e6a6a4a9a871d4976fea095f0bd20cf3b80ec5..972a28dda62bb8dbffa0cde586e61493cf087ad0 100644 (file)
@@ -393,7 +393,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 #[test]
 fn error_smoke_test() {
     let err: UvError = UvError(uvll::EOF);
-    assert_eq!(err.to_str(), "EOF: end of file".to_string());
+    assert_eq!(err.to_string(), "EOF: end of file".to_string());
 }
 
 #[cfg(unix)]
index ddcaeccbc190f9927235259a31b0f3fddba16032..45f93d9d1289801e52a1cd5c66b9acdab06aba3b 100644 (file)
@@ -676,7 +676,7 @@ fn send_to(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> Result<(), IoError>
     fn join_multicast(&mut self, multi: rtio::IpAddr) -> Result<(), IoError> {
         let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
-            multi.to_str().with_c_str(|m_addr| {
+            multi.to_string().with_c_str(|m_addr| {
                 uvll::uv_udp_set_membership(self.handle,
                                             m_addr, ptr::null(),
                                             uvll::UV_JOIN_GROUP)
@@ -687,7 +687,7 @@ fn join_multicast(&mut self, multi: rtio::IpAddr) -> Result<(), IoError> {
     fn leave_multicast(&mut self, multi: rtio::IpAddr) -> Result<(), IoError> {
         let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
-            multi.to_str().with_c_str(|m_addr| {
+            multi.to_string().with_c_str(|m_addr| {
                 uvll::uv_udp_set_membership(self.handle,
                                             m_addr, ptr::null(),
                                             uvll::UV_LEAVE_GROUP)
index 31a065a14498ea14d9f8eaf6c6605f660d56e0f5..95eac25ab5bd126247ec9f7860b026a1ab9fc6c7 100644 (file)
@@ -270,7 +270,7 @@ pub fn parse(s: &str) -> Option<Version> {
     let v = parse_iter(&mut s.chars());
     match v {
         Some(v) => {
-            if v.to_str().equiv(&s) {
+            if v.to_string().equiv(&s) {
                 Some(v)
             } else {
                 None
@@ -391,11 +391,11 @@ fn test_show() {
 }
 
 #[test]
-fn test_to_str() {
-    assert_eq!(parse("1.2.3").unwrap().to_str(), "1.2.3".to_string());
-    assert_eq!(parse("1.2.3-alpha1").unwrap().to_str(), "1.2.3-alpha1".to_string());
-    assert_eq!(parse("1.2.3+build.42").unwrap().to_str(), "1.2.3+build.42".to_string());
-    assert_eq!(parse("1.2.3-alpha1+42").unwrap().to_str(), "1.2.3-alpha1+42".to_string());
+fn test_to_string() {
+    assert_eq!(parse("1.2.3").unwrap().to_string(), "1.2.3".to_string());
+    assert_eq!(parse("1.2.3-alpha1").unwrap().to_string(), "1.2.3-alpha1".to_string());
+    assert_eq!(parse("1.2.3+build.42").unwrap().to_string(), "1.2.3+build.42".to_string());
+    assert_eq!(parse("1.2.3-alpha1+42").unwrap().to_string(), "1.2.3-alpha1+42".to_string());
 }
 
 #[test]
index f4e5c27a14b33638bb7b2db1f03921841d3a944d..df4d3437b1ce673b9385e2c829cff26325d03b7f 100644 (file)
@@ -130,7 +130,7 @@ fn main() {
     // Serialize using `ToJson`
     let test2 = TestStruct1 {data_int: 1, data_str:"toto".to_string(), data_vector:vec![2,3,4,5]};
     let tjson: json::Json = test2.to_json();
-    let json_str: String = tjson.to_str();
+    let json_str: String = tjson.to_string();
 
     // Deserialize like before
     let decoded: TestStruct1 = json::decode(json_str.as_slice()).unwrap();
@@ -2202,59 +2202,59 @@ fn test_from_str_trait() {
 
     #[test]
     fn test_write_null() {
-        assert_eq!(Null.to_str().into_string(), "null".to_string());
+        assert_eq!(Null.to_string().into_string(), "null".to_string());
         assert_eq!(Null.to_pretty_str().into_string(), "null".to_string());
     }
 
 
     #[test]
     fn test_write_number() {
-        assert_eq!(Number(3.0).to_str().into_string(), "3".to_string());
+        assert_eq!(Number(3.0).to_string().into_string(), "3".to_string());
         assert_eq!(Number(3.0).to_pretty_str().into_string(), "3".to_string());
 
-        assert_eq!(Number(3.1).to_str().into_string(), "3.1".to_string());
+        assert_eq!(Number(3.1).to_string().into_string(), "3.1".to_string());
         assert_eq!(Number(3.1).to_pretty_str().into_string(), "3.1".to_string());
 
-        assert_eq!(Number(-1.5).to_str().into_string(), "-1.5".to_string());
+        assert_eq!(Number(-1.5).to_string().into_string(), "-1.5".to_string());
         assert_eq!(Number(-1.5).to_pretty_str().into_string(), "-1.5".to_string());
 
-        assert_eq!(Number(0.5).to_str().into_string(), "0.5".to_string());
+        assert_eq!(Number(0.5).to_string().into_string(), "0.5".to_string());
         assert_eq!(Number(0.5).to_pretty_str().into_string(), "0.5".to_string());
 
-        assert_eq!(Number(f64::NAN).to_str().into_string(), "null".to_string());
+        assert_eq!(Number(f64::NAN).to_string().into_string(), "null".to_string());
         assert_eq!(Number(f64::NAN).to_pretty_str().into_string(), "null".to_string());
 
-        assert_eq!(Number(f64::INFINITY).to_str().into_string(), "null".to_string());
+        assert_eq!(Number(f64::INFINITY).to_string().into_string(), "null".to_string());
         assert_eq!(Number(f64::INFINITY).to_pretty_str().into_string(), "null".to_string());
 
-        assert_eq!(Number(f64::NEG_INFINITY).to_str().into_string(), "null".to_string());
+        assert_eq!(Number(f64::NEG_INFINITY).to_string().into_string(), "null".to_string());
         assert_eq!(Number(f64::NEG_INFINITY).to_pretty_str().into_string(), "null".to_string());
     }
 
     #[test]
     fn test_write_str() {
-        assert_eq!(String("".to_string()).to_str().into_string(), "\"\"".to_string());
+        assert_eq!(String("".to_string()).to_string().into_string(), "\"\"".to_string());
         assert_eq!(String("".to_string()).to_pretty_str().into_string(), "\"\"".to_string());
 
-        assert_eq!(String("foo".to_string()).to_str().into_string(), "\"foo\"".to_string());
+        assert_eq!(String("foo".to_string()).to_string().into_string(), "\"foo\"".to_string());
         assert_eq!(String("foo".to_string()).to_pretty_str().into_string(), "\"foo\"".to_string());
     }
 
     #[test]
     fn test_write_bool() {
-        assert_eq!(Boolean(true).to_str().into_string(), "true".to_string());
+        assert_eq!(Boolean(true).to_string().into_string(), "true".to_string());
         assert_eq!(Boolean(true).to_pretty_str().into_string(), "true".to_string());
 
-        assert_eq!(Boolean(false).to_str().into_string(), "false".to_string());
+        assert_eq!(Boolean(false).to_string().into_string(), "false".to_string());
         assert_eq!(Boolean(false).to_pretty_str().into_string(), "false".to_string());
     }
 
     #[test]
     fn test_write_list() {
-        assert_eq!(List(vec![]).to_str().into_string(), "[]".to_string());
+        assert_eq!(List(vec![]).to_string().into_string(), "[]".to_string());
         assert_eq!(List(vec![]).to_pretty_str().into_string(), "[]".to_string());
 
-        assert_eq!(List(vec![Boolean(true)]).to_str().into_string(), "[true]".to_string());
+        assert_eq!(List(vec![Boolean(true)]).to_string().into_string(), "[true]".to_string());
         assert_eq!(
             List(vec![Boolean(true)]).to_pretty_str().into_string(),
             "\
@@ -2268,7 +2268,7 @@ fn test_write_list() {
             Null,
             List(vec![String("foo\nbar".to_string()), Number(3.5)])]);
 
-        assert_eq!(long_test_list.to_str().into_string(),
+        assert_eq!(long_test_list.to_string().into_string(),
             "[false,null,[\"foo\\nbar\",3.5]]".to_string());
         assert_eq!(
             long_test_list.to_pretty_str().into_string(),
@@ -2286,13 +2286,13 @@ fn test_write_list() {
 
     #[test]
     fn test_write_object() {
-        assert_eq!(mk_object([]).to_str().into_string(), "{}".to_string());
+        assert_eq!(mk_object([]).to_string().into_string(), "{}".to_string());
         assert_eq!(mk_object([]).to_pretty_str().into_string(), "{}".to_string());
 
         assert_eq!(
             mk_object([
                 ("a".to_string(), Boolean(true))
-            ]).to_str().into_string(),
+            ]).to_string().into_string(),
             "{\"a\":true}".to_string()
         );
         assert_eq!(
@@ -2311,7 +2311,7 @@ fn test_write_object() {
             ]);
 
         assert_eq!(
-            complex_obj.to_str().into_string(),
+            complex_obj.to_string().into_string(),
             "{\
                 \"b\":[\
                     {\"c\":\"\\f\\r\"},\
@@ -2344,7 +2344,7 @@ fn test_write_object() {
 
         // We can't compare the strings directly because the object fields be
         // printed in a different order.
-        assert_eq!(a.clone(), from_str(a.to_str().as_slice()).unwrap());
+        assert_eq!(a.clone(), from_str(a.to_string().as_slice()).unwrap());
         assert_eq!(a.clone(),
                    from_str(a.to_pretty_str().as_slice()).unwrap());
     }
index fae1b933210d52a9c2f8f49499583eeb03f49873..796147ce7a05dd0c14a52806c93ceade93da5b45 100644 (file)
@@ -345,10 +345,10 @@ fn eq_ignore_case(self, other: &[Ascii]) -> bool {
 
 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 @@ fn test_ascii_vec() {
         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 @@ fn test_ascii_vec() {
 
     #[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 @@ fn test_ascii_as_str() {
     }
 
     #[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 @@ fn test_eq_ignore_ascii_case() {
     }
 
     #[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());
     }
 
index 08f11581e838a17a74f5ee8badd66b350e230066..a02402271d08383bdc76faa2ebd942459e7f444e 100644 (file)
@@ -319,20 +319,20 @@ fn test_change_capacity() {
     }
 
     #[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 @@ fn test_clear() {
         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());
     }
 }
index 728875ce2601012f3d25b645de37fddae4212a36..86283f03381dd1c68d4c7130f49bd726c57ff3f1 100644 (file)
@@ -209,13 +209,11 @@ fn test_errors_do_not_crash() {
 #[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 fn check_for_errors_in<T>(f: || -> T) -> Result<T, String> {
             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
index 1ca72bca20bdb5cbec9b983e2e90f7f8e7991262..21b1e0560a5dba49ff6d0b715196d0f4d91ba957 100644 (file)
@@ -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 @@ fn from_str(s: &str) -> Option<bool> {
 impl FromStr for String {
     #[inline]
     fn from_str(s: &str) -> Option<String> {
-        Some(s.to_string())
+        Some(String::from_str(s))
     }
 }
 
index e7f26c7bd910e5d21d61de30a703734684f9f1a4..ed183cbf3bc2191dac321c7a6f582144080f4d9c 100644 (file)
@@ -915,7 +915,7 @@ macro_rules! check( ($e:expr) => (
     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 @@ pub fn tmpdir() -> TempDir {
         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));
         }
index 3443a85b46819a41a7619ce9f74b64223f2010b5..7d293f363f0dd48331c655fcdfa4d551e0a214e9 100644 (file)
@@ -532,7 +532,7 @@ fn test_write_strings() {
         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 @@ fn test_write_char() {
         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(..) => {}
         }
index 1d339b03af6717d9eb68e4908f3e6e4e7333bbf8..fe9016453f78eb726f9cf03d3dd3cd84c75bfc30 100644 (file)
@@ -233,7 +233,7 @@ fn file_product(p: &Path) -> IoResult<u32> {
 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 @@ fn push(&mut self, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> {
     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 @@ fn read_to_end(&mut self) -> IoResult<Vec<u8>> {
     /// 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)),
             }
         )
index ca59849202b08677e03943747fb2617d6eb6a687..79caded6711a22219d7c97af256b9df07da58653 100644 (file)
@@ -443,10 +443,11 @@ fn test_from_str_socket_addr() {
     }
 
     #[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());
     }
 }
index baf53251fbe082e5e485ac2df70e64d7dc36c72d..49322098348ff830bd0fb09528de975bb3d20158 100644 (file)
@@ -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 @@ fn connect(i: int, addr: SocketAddr) {
 
     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 @@ fn connect(i: int, addr: SocketAddr) {
         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 @@ fn connect(i: int, addr: SocketAddr) {
     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 @@ fn connect(i: int, addr: SocketAddr) {
         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 @@ fn connect(i: int, addr: SocketAddr) {
     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 @@ fn connect(i: int, addr: SocketAddr) {
         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 @@ fn connect(i: int, addr: SocketAddr) {
     })
 
     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 @@ pub fn socket_name(addr: SocketAddr) {
     }
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
         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 @@ pub fn peer_name(addr: SocketAddr) {
         });
 
         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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
         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 @@ pub fn peer_name(addr: SocketAddr) {
         });
 
         {
-            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 @@ pub fn peer_name(addr: SocketAddr) {
             }
             // 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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
         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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
         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 @@ pub fn peer_name(addr: SocketAddr) {
         // 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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
 
     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 @@ pub fn peer_name(addr: SocketAddr) {
         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();
index 8e1747146e42eb31b9048b4d1daed112f13492f0..8f1046b62fd91040f188e07b661df518f2d44b6f 100644 (file)
@@ -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 {
index e5a64f785ce9640643911ef9c55fb8a76f44b77c..cdd083202e085217d3bf74583694dd3d245b11b3 100644 (file)
@@ -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"));
     })
 }
index 83a01feee9017865f0c13878ca2282b28f805be2..2acf12b76c00adea15f127673a8277222759d125 100644 (file)
@@ -379,21 +379,21 @@ fn limit_reader_buffer() {
         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()));
         }
     }
 
index 2b2ffb9f4e281706052a95a1797d3c10b984cf00..680620f5a752fdd0e455d7578d0b81c18006bf96 100644 (file)
@@ -245,7 +245,7 @@ fn atanh(self) -> 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
index e156d2ce553240b629b6594429b60ef3eb303725..3180ee28c6fee19442d8278894c852f3ff556dbb 100644 (file)
@@ -253,7 +253,7 @@ fn atanh(self) -> 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
index a4200b55a5906f575aa1bc6942f6a7a7f7cc4a47..3c01edf233925986005a4803c3dd1148191fd4e3 100644 (file)
@@ -55,7 +55,7 @@ fn from_str_radix(s: &str, radix: uint) -> Option<$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 @@ fn test_parse_bytes() {
     }
 
     #[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 @@ fn test_to_str() {
     #[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]
index 5028987f44fdd239e85d9421e6867e5482d68fb1..88fc6e1ffd85f743be2e01d6365887f3643ecbf7 100644 (file)
@@ -146,7 +146,7 @@ impl NumStrConv for $t {
 /**
  * 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 f64 {
         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()); })
         }
     }
 }
index 7f2efe034a24a77b8c4acb8ae83e1abef89eff64..cfcaf0fa8daa35d61ebaa203ecaf86446964fa0e 100644 (file)
@@ -56,7 +56,7 @@ fn from_str_radix(s: &str, radix: uint) -> Option<$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 @@ pub fn test_parse_bytes() {
     #[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]
index b3f25914c8f568768c22fd62c6523e837895e9c0..db56b387f8d023965888ad71043105c3a46e6248 100644 (file)
@@ -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 @@ fn env_convert(input: Vec<Vec<u8>>) -> 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)]
index d98cfb7d8eece0c35396db2b1a5dd2cb48614a6e..5c6e140bd29b30aa2827273f5882a9f95719bea6 100644 (file)
@@ -545,7 +545,7 @@ macro_rules! t(
             ($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);
                 }
             )
         )
index 113b0410875af7ad0d068d0b394554320715de96..206f75739e82d1e2f72f8ae7d8a9455964f92fd4 100644 (file)
@@ -1314,9 +1314,9 @@ fn test_not_utf8_fail() {
     #[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();
index 28cd7223b0ac6c1f3e3a78f80cbc8f816539cc6e..6d60fc19d5dc9b7e45951f37d3432c4b82367cc2 100644 (file)
@@ -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};
index c20cbea0ae7cced97332673d8e1eda74ea934486..72cc596085e075ff7fbd7dd6b7f1f3dcc6528c1a 100644 (file)
@@ -638,7 +638,7 @@ fn test_stdout() {
             });
         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());
     }
 
index e51e2c4d9ce5e5acbff2437c02d9e37d26bc2a2e..c19fd81b5705667185f8a8a9391fca11a9114dba 100644 (file)
@@ -10,7 +10,7 @@
 
 /*!
 
-The `ToStr` trait for converting to strings
+The `ToString` trait for converting to strings
 
 */
 
 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());
     }
 }
index ce1302c8db8749b31e813d3f8a132fb118d492f7..eeef77e41820981b5d8f0b3e7675a75c39d256b9 100644 (file)
@@ -681,7 +681,7 @@ pub enum IntTy {
 
 impl fmt::Show for IntTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", ast_util::int_ty_to_str(*self, None))
+        write!(f, "{}", ast_util::int_ty_to_string(*self, None))
     }
 }
 
@@ -696,7 +696,7 @@ pub enum UintTy {
 
 impl fmt::Show for UintTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", ast_util::uint_ty_to_str(*self, None))
+        write!(f, "{}", ast_util::uint_ty_to_string(*self, None))
     }
 }
 
@@ -708,7 +708,7 @@ pub enum FloatTy {
 
 impl fmt::Show for FloatTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", ast_util::float_ty_to_str(*self))
+        write!(f, "{}", ast_util::float_ty_to_string(*self))
     }
 }
 
index 1a9a910f38c07a9e64e8b5fa2f924e28436843f9..c95ea4a24aadb98256ae59c47fe60c79c7396817 100644 (file)
@@ -79,7 +79,7 @@ fn next(&mut self) -> Option<T> {
 /// The type of the iterator used by with_path.
 pub type PathElems<'a, 'b> = iter::Chain<Values<'a, PathElem>, LinkedPath<'b>>;
 
-pub fn path_to_str<PI: Iterator<PathElem>>(mut path: PI) -> String {
+pub fn path_to_string<PI: Iterator<PathElem>>(mut path: PI) -> String {
     let itr = token::get_ident_interner();
 
     path.fold(String::new(), |mut s, e| {
@@ -250,7 +250,7 @@ pub fn get_foreign_abi(&self, id: NodeId) -> abi::Abi {
         match abi {
             Some(abi) => abi,
             None => fail!("expected foreign mod or inlined parent, found {}",
-                          self.node_to_str(parent))
+                          self.node_to_string(parent))
         }
     }
 
@@ -265,7 +265,7 @@ pub fn get_foreign_vis(&self, id: NodeId) -> Visibility {
     pub fn expect_item(&self, id: NodeId) -> Gc<Item> {
         match self.find(id) {
             Some(NodeItem(item)) => item,
-            _ => fail!("expected item, found {}", self.node_to_str(id))
+            _ => fail!("expected item, found {}", self.node_to_string(id))
         }
     }
 
@@ -283,21 +283,21 @@ pub fn expect_struct(&self, id: NodeId) -> Gc<StructDef> {
                     _ => fail!("struct ID bound to enum variant that isn't struct-like"),
                 }
             }
-            _ => fail!(format!("expected struct, found {}", self.node_to_str(id))),
+            _ => fail!(format!("expected struct, found {}", self.node_to_string(id))),
         }
     }
 
     pub fn expect_variant(&self, id: NodeId) -> P<Variant> {
         match self.find(id) {
             Some(NodeVariant(variant)) => variant,
-            _ => fail!(format!("expected variant, found {}", self.node_to_str(id))),
+            _ => fail!(format!("expected variant, found {}", self.node_to_string(id))),
         }
     }
 
     pub fn expect_foreign_item(&self, id: NodeId) -> Gc<ForeignItem> {
         match self.find(id) {
             Some(NodeForeignItem(item)) => item,
-            _ => fail!("expected foreign item, found {}", self.node_to_str(id))
+            _ => fail!("expected foreign item, found {}", self.node_to_string(id))
         }
     }
 
@@ -326,13 +326,13 @@ pub fn with_path<T>(&self, id: NodeId, f: |PathElems| -> T) -> T {
         self.with_path_next(id, None, f)
     }
 
-    pub fn path_to_str(&self, id: NodeId) -> String {
-        self.with_path(id, |path| path_to_str(path))
+    pub fn path_to_string(&self, id: NodeId) -> String {
+        self.with_path(id, |path| path_to_string(path))
     }
 
     fn path_to_str_with_ident(&self, id: NodeId, i: Ident) -> String {
         self.with_path(id, |path| {
-            path_to_str(path.chain(Some(PathName(i.name)).move_iter()))
+            path_to_string(path.chain(Some(PathName(i.name)).move_iter()))
         })
     }
 
@@ -416,8 +416,8 @@ pub fn span(&self, id: NodeId) -> Span {
             .unwrap_or_else(|| fail!("AstMap.span: could not find span for id {}", id))
     }
 
-    pub fn node_to_str(&self, id: NodeId) -> String {
-        node_id_to_str(self, id)
+    pub fn node_to_string(&self, id: NodeId) -> String {
+        node_id_to_string(self, id)
     }
 }
 
@@ -664,7 +664,7 @@ pub fn map_decoded_item<F: FoldOps>(map: &Map,
     ii
 }
 
-fn node_id_to_str(map: &Map, id: NodeId) -> String {
+fn node_id_to_string(map: &Map, id: NodeId) -> String {
     match map.find(id) {
         Some(NodeItem(item)) => {
             let path_str = map.path_to_str_with_ident(id, item.ident);
@@ -689,43 +689,43 @@ fn node_id_to_str(map: &Map, id: NodeId) -> String {
         Some(NodeMethod(m)) => {
             format!("method {} in {} (id={})",
                     token::get_ident(m.ident),
-                    map.path_to_str(id), id)
+                    map.path_to_string(id), id)
         }
         Some(NodeTraitMethod(ref tm)) => {
             let m = ast_util::trait_method_to_ty_method(&**tm);
             format!("method {} in {} (id={})",
                     token::get_ident(m.ident),
-                    map.path_to_str(id), id)
+                    map.path_to_string(id), id)
         }
         Some(NodeVariant(ref variant)) => {
             format!("variant {} in {} (id={})",
                     token::get_ident(variant.node.name),
-                    map.path_to_str(id), id)
+                    map.path_to_string(id), id)
         }
         Some(NodeExpr(ref expr)) => {
-            format!("expr {} (id={})", pprust::expr_to_str(&**expr), id)
+            format!("expr {} (id={})", pprust::expr_to_string(&**expr), id)
         }
         Some(NodeStmt(ref stmt)) => {
-            format!("stmt {} (id={})", pprust::stmt_to_str(&**stmt), id)
+            format!("stmt {} (id={})", pprust::stmt_to_string(&**stmt), id)
         }
         Some(NodeArg(ref pat)) => {
-            format!("arg {} (id={})", pprust::pat_to_str(&**pat), id)
+            format!("arg {} (id={})", pprust::pat_to_string(&**pat), id)
         }
         Some(NodeLocal(ref pat)) => {
-            format!("local {} (id={})", pprust::pat_to_str(&**pat), id)
+            format!("local {} (id={})", pprust::pat_to_string(&**pat), id)
         }
         Some(NodePat(ref pat)) => {
-            format!("pat {} (id={})", pprust::pat_to_str(&**pat), id)
+            format!("pat {} (id={})", pprust::pat_to_string(&**pat), id)
         }
         Some(NodeBlock(ref block)) => {
-            format!("block {} (id={})", pprust::block_to_str(&**block), id)
+            format!("block {} (id={})", pprust::block_to_string(&**block), id)
         }
         Some(NodeStructCtor(_)) => {
-            format!("struct_ctor {} (id={})", map.path_to_str(id), id)
+            format!("struct_ctor {} (id={})", map.path_to_string(id), id)
         }
         Some(NodeLifetime(ref l)) => {
             format!("lifetime {} (id={})",
-                    pprust::lifetime_to_str(&**l), id)
+                    pprust::lifetime_to_string(&**l), id)
         }
         None => {
             format!("unknown node (id={})", id)
index 036d6b4b43adc62d537c8c0f9dfc745964d6bca3..57c60b4a9490351b611b6699dbb87e7294d262cc 100644 (file)
@@ -48,7 +48,7 @@ pub fn stmt_id(s: &Stmt) -> NodeId {
     }
 }
 
-pub fn binop_to_str(op: BinOp) -> &'static str {
+pub fn binop_to_string(op: BinOp) -> &'static str {
     match op {
         BiAdd => "+",
         BiSub => "-",
@@ -87,7 +87,7 @@ pub fn is_shift_binop(b: BinOp) -> bool {
     }
 }
 
-pub fn unop_to_str(op: UnOp) -> &'static str {
+pub fn unop_to_string(op: UnOp) -> &'static str {
     match op {
       UnBox => "box(GC) ",
       UnUniq => "box() ",
@@ -103,7 +103,7 @@ pub fn is_path(e: Gc<Expr>) -> bool {
 
 // Get a string representation of a signed int type, with its value.
 // We want to avoid "45int" and "-3int" in favor of "45" and "-3"
-pub fn int_ty_to_str(t: IntTy, val: Option<i64>) -> String {
+pub fn int_ty_to_string(t: IntTy, val: Option<i64>) -> String {
     let s = match t {
         TyI if val.is_some() => "i",
         TyI => "int",
@@ -133,7 +133,7 @@ pub fn int_ty_max(t: IntTy) -> u64 {
 
 // Get a string representation of an unsigned int type, with its value.
 // We want to avoid "42uint" in favor of "42u"
-pub fn uint_ty_to_str(t: UintTy, val: Option<u64>) -> String {
+pub fn uint_ty_to_string(t: UintTy, val: Option<u64>) -> String {
     let s = match t {
         TyU if val.is_some() => "u",
         TyU => "uint",
@@ -158,7 +158,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 {
     }
 }
 
-pub fn float_ty_to_str(t: FloatTy) -> String {
+pub fn float_ty_to_string(t: FloatTy) -> String {
     match t {
         TyF32 => "f32".to_string(),
         TyF64 => "f64".to_string(),
@@ -229,11 +229,11 @@ pub fn unguarded_pat(a: &Arm) -> Option<Vec<Gc<Pat>>> {
 /// listed as `__extensions__::method_name::hash`, with no indication
 /// of the type).
 pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: &Ty) -> Ident {
-    let mut pretty = pprust::ty_to_str(ty);
+    let mut pretty = pprust::ty_to_string(ty);
     match *trait_ref {
         Some(ref trait_ref) => {
             pretty.push_char('.');
-            pretty.push_str(pprust::path_to_str(&trait_ref.path).as_slice());
+            pretty.push_str(pprust::path_to_string(&trait_ref.path).as_slice());
         }
         None => {}
     }
index c917198e7d4714fa31ab8ac82bee0e3687f7daf8..b3adf1daf418ca84e72afc556c55e3be95255a00 100644 (file)
@@ -367,7 +367,7 @@ pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
         }
     }
 
-    pub fn span_to_str(&self, sp: Span) -> String {
+    pub fn span_to_string(&self, sp: Span) -> String {
         if self.files.borrow().len() == 0 && sp == DUMMY_SP {
             return "no-location".to_string();
         }
@@ -687,7 +687,7 @@ fn t9() {
         // Test span_to_str for a span ending at the end of filemap
         let cm = init_code_map();
         let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None};
-        let sstr =  cm.span_to_str(span);
+        let sstr =  cm.span_to_string(span);
 
         assert_eq!(sstr, "blork.rs:2:1: 2:12".to_string());
     }
index dfaa9fb5fcb09507f31144396946f7708b588c40..3805390776e8da9b4ec168743047c18fb78158c2 100644 (file)
@@ -269,7 +269,7 @@ fn print_diagnostic(dst: &mut EmitterWriter,
     }
 
     try!(print_maybe_styled(dst,
-                            format!("{}: ", lvl.to_str()).as_slice(),
+                            format!("{}: ", lvl.to_string()).as_slice(),
                             term::attr::ForegroundColor(lvl.color())));
     try!(print_maybe_styled(dst,
                             format!("{}\n", msg).as_slice(),
@@ -349,14 +349,14 @@ fn custom_emit(&mut self, cm: &codemap::CodeMap,
 fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
         msg: &str, lvl: Level, custom: bool) -> io::IoResult<()> {
     let sp = rsp.span();
-    let ss = cm.span_to_str(sp);
+    let ss = cm.span_to_string(sp);
     let lines = cm.span_to_lines(sp);
     if custom {
         // we want to tell compiletest/runtest to look at the last line of the
         // span (since `custom_highlight_lines` displays an arrow to the end of
         // the span)
         let span_end = Span { lo: sp.hi, hi: sp.hi, expn_info: sp.expn_info};
-        let ses = cm.span_to_str(span_end);
+        let ses = cm.span_to_string(span_end);
         try!(print_diagnostic(dst, ses.as_slice(), lvl, msg));
         if rsp.is_full_span() {
             try!(custom_highlight_lines(dst, cm, sp, lvl, lines));
@@ -493,7 +493,7 @@ fn print_macro_backtrace(w: &mut EmitterWriter,
         let ss = ei.callee
                    .span
                    .as_ref()
-                   .map_or("".to_string(), |span| cm.span_to_str(*span));
+                   .map_or("".to_string(), |span| cm.span_to_string(*span));
         let (pre, post) = match ei.callee.format {
             codemap::MacroAttribute => ("#[", "]"),
             codemap::MacroBang => ("", "!")
@@ -502,7 +502,7 @@ fn print_macro_backtrace(w: &mut EmitterWriter,
                               format!("in expansion of {}{}{}", pre,
                                       ei.callee.name,
                                       post).as_slice()));
-        let ss = cm.span_to_str(ei.call_site);
+        let ss = cm.span_to_string(ei.call_site);
         try!(print_diagnostic(w, ss.as_slice(), Note, "expansion site"));
         try!(print_macro_backtrace(w, cm, ei.call_site));
     }
index f0494e181201375096c9e0417a84bce1ba43fb07..13738e658e9f97fd7edd5563cab06ec71cf1e8b6 100644 (file)
@@ -64,7 +64,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     'statement: loop {
         match state {
             Asm => {
-                let (s, style) = match expr_to_str(cx, p.parse_expr(),
+                let (s, style) = match expr_to_string(cx, p.parse_expr(),
                                                    "inline assembly must be a string literal.") {
                     Some((s, st)) => (s, st),
                     // let compilation continue
@@ -205,7 +205,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     // Append an input operand, with the form of ("0", expr)
     // that links to an output operand.
     for &(i, out) in read_write_operands.iter() {
-        inputs.push((token::intern_and_get_ident(i.to_str().as_slice()),
+        inputs.push((token::intern_and_get_ident(i.to_string().as_slice()),
                                                  out));
     }
 
index 673ae31ef77899216e4e3f7d4a0f6357403f7569..a540b23551b534437a80684cc0d1df3e6762a758 100644 (file)
@@ -533,7 +533,7 @@ pub fn ident_of(&self, st: &str) -> ast::Ident {
 /// Extract a string literal from the macro expanded version of `expr`,
 /// emitting `err_msg` if `expr` is not a string literal. This does not stop
 /// compilation on error, merely emits a non-fatal error and returns None.
-pub fn expr_to_str(cx: &mut ExtCtxt, expr: Gc<ast::Expr>, err_msg: &str)
+pub fn expr_to_string(cx: &mut ExtCtxt, expr: Gc<ast::Expr>, err_msg: &str)
                    -> Option<(InternedString, ast::StrStyle)> {
     // we want to be able to handle e.g. concat("foo", "bar")
     let expr = cx.expand_expr(expr);
index 9ef7241ca24842ed38292aa1b3c27f7a563b1c85..b24cfb85794edcf2c5754f128f933243429e12d6 100644 (file)
@@ -70,7 +70,7 @@ pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         Some(exprs) => exprs
     };
 
-    let var = match expr_to_str(cx,
+    let var = match expr_to_string(cx,
                                 *exprs.get(0),
                                 "expected string literal") {
         None => return DummyResult::expr(sp),
@@ -83,7 +83,7 @@ pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                                                 var).as_slice())
         }
         2 => {
-            match expr_to_str(cx, *exprs.get(1), "expected string literal") {
+            match expr_to_string(cx, *exprs.get(1), "expected string literal") {
                 None => return DummyResult::expr(sp),
                 Some((s, _style)) => s
             }
index 752b3a09e652e9e9dc9270091c8192e8156ac245..74cede2a125add771ed548a336517dc45d83e104 100644 (file)
@@ -1183,7 +1183,7 @@ fn crate_idents(the_crate: &ast::Crate) -> Vec<ast::Ident> {
         // should fail:
         let cfg = ::syntax::ext::expand::ExpansionConfig {
             deriving_hash_type_parameter: false,
-            crate_name: "test".to_str(),
+            crate_name: "test".to_string(),
         };
         expand_crate(&sess,cfg,vec!(),vec!(),crate_ast);
     }
@@ -1200,7 +1200,7 @@ fn crate_idents(the_crate: &ast::Crate) -> Vec<ast::Ident> {
             Vec::new(), &sess);
         let cfg = ::syntax::ext::expand::ExpansionConfig {
             deriving_hash_type_parameter: false,
-            crate_name: "test".to_str(),
+            crate_name: "test".to_string(),
         };
         expand_crate(&sess,cfg,vec!(),vec!(),crate_ast);
     }
@@ -1216,7 +1216,7 @@ fn crate_idents(the_crate: &ast::Crate) -> Vec<ast::Ident> {
             Vec::new(), &sess);
         let cfg = ::syntax::ext::expand::ExpansionConfig {
             deriving_hash_type_parameter: false,
-            crate_name: "test".to_str(),
+            crate_name: "test".to_string(),
         };
         expand_crate(&sess, cfg, vec!(), vec!(), crate_ast);
     }
@@ -1253,7 +1253,7 @@ fn expand_crate_str(crate_str: String) -> ast::Crate {
         // the cfg argument actually does matter, here...
         let cfg = ::syntax::ext::expand::ExpansionConfig {
             deriving_hash_type_parameter: false,
-            crate_name: "test".to_str(),
+            crate_name: "test".to_string(),
         };
         expand_crate(&ps,cfg,vec!(),vec!(),crate_ast)
     }
@@ -1272,7 +1272,7 @@ fn crate_bindings(the_crate : &ast::Crate) -> Vec<ast::Ident> {
     //}
     //fn expand_and_resolve_and_pretty_print (crate_str: @str) -> String {
         //let resolved_ast = expand_and_resolve(crate_str);
-        //pprust::to_str(&resolved_ast,fake_print_crate,get_ident_interner())
+        //pprust::to_string(&resolved_ast,fake_print_crate,get_ident_interner())
     //}
 
     #[test] fn macro_tokens_should_match(){
@@ -1504,7 +1504,7 @@ fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
     }
 
     #[test] fn fmt_in_macro_used_inside_module_macro() {
-        let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_str()))
+        let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_string()))
 macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}}))
 foo_module!()
 ".to_string();
index f39e50ad1313f63501394e1a31da42b528c2a396..f486d2de3398bd564e6d787435d663d8d8422102 100644 (file)
@@ -126,7 +126,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool,
                 _ => {
                     ecx.span_err(p.span,
                                  format!("expected ident for named argument, but found `{}`",
-                                         p.this_token_to_str()).as_slice());
+                                         p.this_token_to_string()).as_slice());
                     return (invocation, None);
                 }
             };
@@ -690,7 +690,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
         fmtsp: sp,
     };
     cx.fmtsp = efmt.span;
-    let fmt = match expr_to_str(cx.ecx,
+    let fmt = match expr_to_string(cx.ecx,
                                 efmt,
                                 "format argument must be a string literal.") {
         Some((fmt, _)) => fmt,
index 486d060da77bedbefc596b6f70529a6cead6c517..1f4d087abd0fe1669513151ea3f88b3e1688ec5b 100644 (file)
@@ -21,7 +21,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
                          -> Box<base::MacResult> {
 
     cx.print_backtrace();
-    println!("{}", print::pprust::tt_to_str(&ast::TTDelim(
+    println!("{}", print::pprust::tt_to_string(&ast::TTDelim(
                 Rc::new(tt.iter().map(|x| (*x).clone()).collect()))));
 
     // any so that `log_syntax` can be invoked as an expression and item.
index 7b24b97d5da4dd6be7557657bb8019f0ba816103..a3c901904a9484d940b856e4a086b2b59141b3f9 100644 (file)
@@ -128,13 +128,13 @@ fn to_source(&self) -> String {
         }
     }
 
-    impl_to_source!(ast::Ty, ty_to_str)
-    impl_to_source!(ast::Block, block_to_str)
-    impl_to_source!(ast::Arg, arg_to_str)
-    impl_to_source!(Generics, generics_to_str)
-    impl_to_source!(Gc<ast::Item>, item_to_str)
-    impl_to_source!(Gc<ast::Expr>, expr_to_str)
-    impl_to_source!(Gc<ast::Pat>, pat_to_str)
+    impl_to_source!(ast::Ty, ty_to_string)
+    impl_to_source!(ast::Block, block_to_string)
+    impl_to_source!(ast::Arg, arg_to_string)
+    impl_to_source!(Generics, generics_to_string)
+    impl_to_source!(Gc<ast::Item>, item_to_string)
+    impl_to_source!(Gc<ast::Expr>, expr_to_string)
+    impl_to_source!(Gc<ast::Pat>, pat_to_string)
     impl_to_source_slice!(ast::Ty, ", ")
     impl_to_source_slice!(Gc<ast::Item>, "\n\n")
 
@@ -142,7 +142,7 @@ impl<'a> ToSource for &'a str {
         fn to_source(&self) -> String {
             let lit = dummy_spanned(ast::LitStr(
                     token::intern_and_get_ident(*self), ast::CookedStr));
-            pprust::lit_to_str(&lit)
+            pprust::lit_to_string(&lit)
         }
     }
 
@@ -155,14 +155,14 @@ fn to_source(&self) -> String {
     impl ToSource for bool {
         fn to_source(&self) -> String {
             let lit = dummy_spanned(ast::LitBool(*self));
-            pprust::lit_to_str(&lit)
+            pprust::lit_to_string(&lit)
         }
     }
 
     impl ToSource for char {
         fn to_source(&self) -> String {
             let lit = dummy_spanned(ast::LitChar(*self));
-            pprust::lit_to_str(&lit)
+            pprust::lit_to_string(&lit)
         }
     }
 
@@ -171,7 +171,7 @@ macro_rules! impl_to_source_int(
             impl ToSource for $t {
                 fn to_source(&self) -> String {
                     let lit = dummy_spanned(ast::LitInt(*self as i64, ast::$tag));
-                    pprust::lit_to_str(&lit)
+                    pprust::lit_to_string(&lit)
                 }
             }
         );
@@ -179,7 +179,7 @@ fn to_source(&self) -> String {
             impl ToSource for $t {
                 fn to_source(&self) -> String {
                     let lit = dummy_spanned(ast::LitUint(*self as u64, ast::$tag));
-                    pprust::lit_to_str(&lit)
+                    pprust::lit_to_string(&lit)
                 }
             }
         );
index 915fc16c15660a05368690c7e770dc05a0bcb81c..8922f423aad31e493fae828cdee470fbcaf0d2d9 100644 (file)
@@ -64,7 +64,7 @@ pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
 
 pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                         -> Box<base::MacResult> {
-    let s = pprust::tts_to_str(tts);
+    let s = pprust::tts_to_string(tts);
     base::MacExpr::new(cx.expr_str(sp,
                                    token::intern_and_get_ident(s.as_slice())))
 }
@@ -126,7 +126,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         Some(src) => {
             // Add this input file to the code map to make it available as
             // dependency information
-            let filename = file.display().to_str();
+            let filename = file.display().to_string();
             let interned = token::intern_and_get_ident(src);
             cx.codemap().new_filemap(filename, src.to_string());
 
index 86fbc8cec2a347f9f4108196fab5a4b3a5201d40..913e0427bda221ee3e25bc3540eb0f1f9ea47515 100644 (file)
@@ -395,7 +395,7 @@ pub fn parse(sess: &ParseSess,
                     nts, next_eis.len()).to_string());
             } else if bb_eis.len() == 0u && next_eis.len() == 0u {
                 return Failure(sp, format!("no rules expected the token `{}`",
-                            token::to_str(&tok)).to_string());
+                            token::to_string(&tok)).to_string());
             } else if next_eis.len() > 0u {
                 /* Now process the next token */
                 while next_eis.len() > 0u {
@@ -442,7 +442,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
       "ident" => match p.token {
         token::IDENT(sn,b) => { p.bump(); token::NtIdent(box sn,b) }
         _ => {
-            let token_str = token::to_str(&p.token);
+            let token_str = token::to_string(&p.token);
             p.fatal((format!("expected ident, found {}",
                              token_str.as_slice())).as_slice())
         }
index 72c578b87699c5b0f335ee3bad3395cc6e4fd818..2b481cb0596e7590e011aa0174007b5918df4ecb 100644 (file)
@@ -48,7 +48,7 @@ fn ensure_complete_parse(&self, allow_semi: bool) {
             parser.bump()
         }
         if parser.token != EOF {
-            let token_str = parser.this_token_to_str();
+            let token_str = parser.this_token_to_string();
             let msg = format!("macro expansion ignores token `{}` and any \
                                following",
                               token_str);
@@ -131,7 +131,7 @@ fn generic_extension(cx: &ExtCtxt,
         println!("{}! {} {} {}",
                  token::get_ident(name),
                  "{",
-                 print::pprust::tt_to_str(&TTDelim(Rc::new(arg.iter()
+                 print::pprust::tt_to_string(&TTDelim(Rc::new(arg.iter()
                                                               .map(|x| (*x).clone())
                                                               .collect()))),
                  "}");
@@ -254,7 +254,7 @@ fn ms(m: Matcher_) -> Matcher {
 
     box MacroRulesDefiner {
         def: RefCell::new(Some(MacroDef {
-            name: token::get_ident(name).to_str(),
+            name: token::get_ident(name).to_string(),
             ext: NormalTT(exp, Some(sp))
         }))
     } as Box<MacResult>
index 04e6612daf1f008a7dcf3a7f4526fb23875dd2f9..5b2be78849e274abd8f08aca991ea6d564a1807e 100644 (file)
@@ -1026,7 +1026,7 @@ macro_rules! assert_pred (
         assert_pred!(
             matches_codepattern,
             "matches_codepattern",
-            pprust::to_str(|s| fake_print_crate(s, &folded_crate)),
+            pprust::to_string(|s| fake_print_crate(s, &folded_crate)),
             "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_string());
     }
 
@@ -1040,7 +1040,7 @@ macro_rules! assert_pred (
         assert_pred!(
             matches_codepattern,
             "matches_codepattern",
-            pprust::to_str(|s| fake_print_crate(s, &folded_crate)),
+            pprust::to_string(|s| fake_print_crate(s, &folded_crate)),
             "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))".to_string());
     }
 }
index e47080dadfd72361dd5eb1cfc94b62e5b5b13736..53489e32837668c2231c936b2f81f3669dd0f396 100644 (file)
@@ -91,7 +91,7 @@ fn parse_attribute(&mut self, permit_inner: bool) -> ast::Attribute {
                 (mk_sp(lo, hi), meta_item, style)
             }
             _ => {
-                let token_str = self.this_token_to_str();
+                let token_str = self.this_token_to_string();
                 self.fatal(format!("expected `#` but found `{}`",
                                    token_str).as_slice());
             }
index f00c1ab44551f63010491a027efe80d06ba6e840..73e5bb97f51d0a2b375bc25eccb03b68cacbcdfb 100644 (file)
@@ -369,7 +369,7 @@ pub fn gather_comments_and_literals(span_diagnostic: &diagnostic::SpanHandler,
                 literals.push(Literal {lit: s.to_string(), pos: sp.lo});
             })
         } else {
-            debug!("tok: {}", token::to_str(&tok));
+            debug!("tok: {}", token::to_string(&tok));
         }
         first_read = false;
     }
index 6b6387b0127861828ea5382d75ee58b75c23f4e2..52cf2ff3741c9715ba9ff4ca883e77c597c1c558 100644 (file)
@@ -363,24 +363,24 @@ pub fn new(sess: &'a ParseSess, cfg: ast::CrateConfig,
         }
     }
     // convert a token to a string using self's reader
-    pub fn token_to_str(token: &token::Token) -> String {
-        token::to_str(token)
+    pub fn token_to_string(token: &token::Token) -> String {
+        token::to_string(token)
     }
 
     // convert the current token to a string using self's reader
-    pub fn this_token_to_str(&mut self) -> String {
-        Parser::token_to_str(&self.token)
+    pub fn this_token_to_string(&mut self) -> String {
+        Parser::token_to_string(&self.token)
     }
 
     pub fn unexpected_last(&mut self, t: &token::Token) -> ! {
-        let token_str = Parser::token_to_str(t);
+        let token_str = Parser::token_to_string(t);
         let last_span = self.last_span;
         self.span_fatal(last_span, format!("unexpected token: `{}`",
                                                 token_str).as_slice());
     }
 
     pub fn unexpected(&mut self) -> ! {
-        let this_token = self.this_token_to_str();
+        let this_token = self.this_token_to_string();
         self.fatal(format!("unexpected token: `{}`", this_token).as_slice());
     }
 
@@ -390,8 +390,8 @@ pub fn expect(&mut self, t: &token::Token) {
         if self.token == *t {
             self.bump();
         } else {
-            let token_str = Parser::token_to_str(t);
-            let this_token_str = self.this_token_to_str();
+            let token_str = Parser::token_to_string(t);
+            let this_token_str = self.this_token_to_string();
             self.fatal(format!("expected `{}` but found `{}`",
                                token_str,
                                this_token_str).as_slice())
@@ -404,15 +404,15 @@ pub fn expect(&mut self, t: &token::Token) {
     pub fn expect_one_of(&mut self,
                          edible: &[token::Token],
                          inedible: &[token::Token]) {
-        fn tokens_to_str(tokens: &[token::Token]) -> String {
+        fn tokens_to_string(tokens: &[token::Token]) -> String {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on Iterator.
             let b = i.next()
-                     .map_or("".to_string(), |t| Parser::token_to_str(t));
+                     .map_or("".to_string(), |t| Parser::token_to_string(t));
             i.fold(b, |b,a| {
                 let mut b = b;
                 b.push_str("`, `");
-                b.push_str(Parser::token_to_str(a).as_slice());
+                b.push_str(Parser::token_to_string(a).as_slice());
                 b
             })
         }
@@ -422,8 +422,8 @@ fn tokens_to_str(tokens: &[token::Token]) -> String {
             // leave it in the input
         } else {
             let expected = edible.iter().map(|x| (*x).clone()).collect::<Vec<_>>().append(inedible);
-            let expect = tokens_to_str(expected.as_slice());
-            let actual = self.this_token_to_str();
+            let expect = tokens_to_string(expected.as_slice());
+            let actual = self.this_token_to_string();
             self.fatal(
                 (if expected.len() != 1 {
                     (format!("expected one of `{}` but found `{}`",
@@ -512,7 +512,7 @@ pub fn parse_ident(&mut self) -> ast::Ident {
                 self.bug("ident interpolation not converted to real token");
             }
             _ => {
-                let token_str = self.this_token_to_str();
+                let token_str = self.this_token_to_string();
                 self.fatal((format!("expected ident, found `{}`",
                                     token_str)).as_slice())
             }
@@ -556,7 +556,7 @@ pub fn eat_keyword(&mut self, kw: keywords::Keyword) -> bool {
     pub fn expect_keyword(&mut self, kw: keywords::Keyword) {
         if !self.eat_keyword(kw) {
             let id_interned_str = token::get_ident(kw.to_ident());
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             self.fatal(format!("expected `{}`, found `{}`",
                                id_interned_str, token_str).as_slice())
         }
@@ -565,7 +565,7 @@ pub fn expect_keyword(&mut self, kw: keywords::Keyword) {
     // signal an error if the given string is a strict keyword
     pub fn check_strict_keywords(&mut self) {
         if token::is_strict_keyword(&self.token) {
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             let span = self.span;
             self.span_err(span,
                           format!("found `{}` in ident position",
@@ -576,7 +576,7 @@ pub fn check_strict_keywords(&mut self) {
     // signal an error if the current token is a reserved keyword
     pub fn check_reserved_keywords(&mut self) {
         if token::is_reserved_keyword(&self.token) {
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             self.fatal(format!("`{}` is a reserved keyword",
                                token_str).as_slice())
         }
@@ -593,9 +593,9 @@ fn expect_and(&mut self) {
                 self.replace_token(token::BINOP(token::AND), lo, span.hi)
             }
             _ => {
-                let token_str = self.this_token_to_str();
+                let token_str = self.this_token_to_string();
                 let found_token =
-                    Parser::token_to_str(&token::BINOP(token::AND));
+                    Parser::token_to_string(&token::BINOP(token::AND));
                 self.fatal(format!("expected `{}`, found `{}`",
                                    found_token,
                                    token_str).as_slice())
@@ -614,9 +614,9 @@ fn expect_or(&mut self) {
                 self.replace_token(token::BINOP(token::OR), lo, span.hi)
             }
             _ => {
-                let found_token = self.this_token_to_str();
+                let found_token = self.this_token_to_string();
                 let token_str =
-                    Parser::token_to_str(&token::BINOP(token::OR));
+                    Parser::token_to_string(&token::BINOP(token::OR));
                 self.fatal(format!("expected `{}`, found `{}`",
                                    token_str,
                                    found_token).as_slice())
@@ -667,8 +667,8 @@ fn eat_lt(&mut self, force: bool) -> bool {
 
     fn expect_lt(&mut self) {
         if !self.eat_lt(true) {
-            let found_token = self.this_token_to_str();
-            let token_str = Parser::token_to_str(&token::LT);
+            let found_token = self.this_token_to_string();
+            let token_str = Parser::token_to_string(&token::LT);
             self.fatal(format!("expected `{}`, found `{}`",
                                token_str,
                                found_token).as_slice())
@@ -718,8 +718,8 @@ pub fn expect_gt(&mut self) {
                 self.replace_token(token::EQ, lo, span.hi)
             }
             _ => {
-                let gt_str = Parser::token_to_str(&token::GT);
-                let this_token_str = self.this_token_to_str();
+                let gt_str = Parser::token_to_string(&token::GT);
+                let this_token_str = self.this_token_to_string();
                 self.fatal(format!("expected `{}`, found `{}`",
                                    gt_str,
                                    this_token_str).as_slice())
@@ -1247,7 +1247,7 @@ pub fn parse_trait_methods(&mut self) -> Vec<TraitMethod> {
               }
 
               _ => {
-                  let token_str = p.this_token_to_str();
+                  let token_str = p.this_token_to_string();
                   p.fatal((format!("expected `;` or `{{` but found `{}`",
                                    token_str)).as_slice())
               }
@@ -2231,7 +2231,7 @@ fn parse_non_delim_tt_tok(p: &mut Parser) -> TokenTree {
                       None => {}
                       Some(&sp) => p.span_note(sp, "unclosed delimiter"),
                   };
-                  let token_str = p.this_token_to_str();
+                  let token_str = p.this_token_to_string();
                   p.fatal(format!("incorrect close delimiter: `{}`",
                                   token_str).as_slice())
               },
@@ -2822,7 +2822,7 @@ fn parse_pat_fields(&mut self) -> (Vec<ast::FieldPat> , bool) {
             if self.token == token::DOTDOT {
                 self.bump();
                 if self.token != token::RBRACE {
-                    let token_str = self.this_token_to_str();
+                    let token_str = self.this_token_to_string();
                     self.fatal(format!("expected `{}`, found `{}`", "}",
                                        token_str).as_slice())
                 }
@@ -2843,7 +2843,7 @@ fn parse_pat_fields(&mut self) -> (Vec<ast::FieldPat> , bool) {
             let subpat = if self.token == token::COLON {
                 match bind_type {
                     BindByRef(..) | BindByValue(MutMutable) => {
-                        let token_str = self.this_token_to_str();
+                        let token_str = self.this_token_to_string();
                         self.fatal(format!("unexpected `{}`",
                                            token_str).as_slice())
                     }
@@ -3253,7 +3253,7 @@ fn check_expected_item(p: &mut Parser, found_attrs: bool) {
                     } else {
                         ""
                     };
-                    let tok_str = self.this_token_to_str();
+                    let tok_str = self.this_token_to_string();
                     self.fatal(format!("expected {}`(` or `{{`, but found `{}`",
                                        ident_str,
                                        tok_str).as_slice())
@@ -3714,7 +3714,7 @@ fn is_self_ident(&mut self) -> bool {
 
     fn expect_self_ident(&mut self) {
         if !self.is_self_ident() {
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             self.fatal(format!("expected `self` but found `{}`",
                                token_str).as_slice())
         }
@@ -3847,7 +3847,7 @@ fn maybe_parse_borrowed_explicit_self(this: &mut Parser)
                     vec!(Arg::new_self(explicit_self_sp, mutbl_self))
                 }
                 _ => {
-                    let token_str = self.this_token_to_str();
+                    let token_str = self.this_token_to_string();
                     self.fatal(format!("expected `,` or `)`, found `{}`",
                                        token_str).as_slice())
                 }
@@ -4016,7 +4016,7 @@ fn parse_item_trait(&mut self) -> ItemInfo {
 
     // Parses two variants (with the region/type params always optional):
     //    impl<T> Foo { ... }
-    //    impl<T> ToStr for ~[T] { ... }
+    //    impl<T> ToString for ~[T] { ... }
     fn parse_item_impl(&mut self) -> ItemInfo {
         // First, parse type parameters if necessary.
         let generics = self.parse_generics();
@@ -4151,7 +4151,7 @@ fn parse_item_struct(&mut self, is_virtual: bool) -> ItemInfo {
             is_tuple_like = true;
             fields = Vec::new();
         } else {
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             self.fatal(format!("expected `{}`, `(`, or `;` after struct \
                                 name but found `{}`", "{",
                                token_str).as_slice())
@@ -4182,7 +4182,7 @@ pub fn parse_single_struct_field(&mut self,
             token::RBRACE => {}
             _ => {
                 let span = self.span;
-                let token_str = self.this_token_to_str();
+                let token_str = self.this_token_to_string();
                 self.span_fatal(span,
                                 format!("expected `,`, or `}}` but found `{}`",
                                         token_str).as_slice())
@@ -4265,7 +4265,7 @@ fn parse_mod_items(&mut self,
                                  the module");
               }
               _ => {
-                  let token_str = self.this_token_to_str();
+                  let token_str = self.this_token_to_string();
                   self.fatal(format!("expected item but found `{}`",
                                      token_str).as_slice())
               }
@@ -4545,7 +4545,7 @@ fn parse_item_extern_crate(&mut self,
             }
             _ => {
                 let span = self.span;
-                let token_str = self.this_token_to_str();
+                let token_str = self.this_token_to_string();
                 self.span_fatal(span,
                                 format!("expected extern crate name but \
                                          found `{}`",
@@ -4803,7 +4803,7 @@ fn parse_item_or_view_item(&mut self,
             }
 
             let span = self.span;
-            let token_str = self.this_token_to_str();
+            let token_str = self.this_token_to_string();
             self.span_fatal(span,
                             format!("expected `{}` or `fn` but found `{}`", "{",
                                     token_str).as_slice());
index dcf37e37ff0a786f0bc40882052ec6efac5bf7d9..df33f9dccc63174a5fe61055717b54fe00a74b46 100644 (file)
@@ -140,7 +140,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-pub fn binop_to_str(o: BinOp) -> &'static str {
+pub fn binop_to_string(o: BinOp) -> &'static str {
     match o {
       PLUS => "+",
       MINUS => "-",
@@ -155,7 +155,7 @@ pub fn binop_to_str(o: BinOp) -> &'static str {
     }
 }
 
-pub fn to_str(t: &Token) -> String {
+pub fn to_string(t: &Token) -> String {
     match *t {
       EQ => "=".to_string(),
       LT => "<".to_string(),
@@ -168,9 +168,9 @@ pub fn to_str(t: &Token) -> String {
       TILDE => "~".to_string(),
       OROR => "||".to_string(),
       ANDAND => "&&".to_string(),
-      BINOP(op) => binop_to_str(op).to_string(),
+      BINOP(op) => binop_to_string(op).to_string(),
       BINOPEQ(op) => {
-          let mut s = binop_to_str(op).to_string();
+          let mut s = binop_to_string(op).to_string();
           s.push_str("=");
           s
       }
@@ -213,15 +213,15 @@ pub fn to_str(t: &Token) -> String {
           res.push_char('\'');
           res
       }
-      LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i)),
-      LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u)),
-      LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str() }
+      LIT_INT(i, t) => ast_util::int_ty_to_string(t, Some(i)),
+      LIT_UINT(u, t) => ast_util::uint_ty_to_string(t, Some(u)),
+      LIT_INT_UNSUFFIXED(i) => { (i as u64).to_string() }
       LIT_FLOAT(s, t) => {
         let mut body = String::from_str(get_ident(s).get());
         if body.as_slice().ends_with(".") {
             body.push_char('0');  // `10.f` is not a float literal
         }
-        body.push_str(ast_util::float_ty_to_str(t).as_slice());
+        body.push_str(ast_util::float_ty_to_string(t).as_slice());
         body
       }
       LIT_FLOAT_UNSUFFIXED(s) => {
@@ -260,8 +260,8 @@ pub fn to_str(t: &Token) -> String {
       EOF => "<eof>".to_string(),
       INTERPOLATED(ref nt) => {
         match nt {
-            &NtExpr(ref e) => ::print::pprust::expr_to_str(&**e),
-            &NtMeta(ref e) => ::print::pprust::meta_item_to_str(&**e),
+            &NtExpr(ref e) => ::print::pprust::expr_to_string(&**e),
+            &NtMeta(ref e) => ::print::pprust::meta_item_to_string(&**e),
             _ => {
                 let mut s = "an interpolated ".to_string();
                 match *nt {
@@ -691,7 +691,7 @@ pub fn gensym_ident(s: &str) -> ast::Ident {
 }
 
 // create a fresh name that maps to the same string as the old one.
-// note that this guarantees that str_ptr_eq(ident_to_str(src),interner_get(fresh_name(src)));
+// note that this guarantees that str_ptr_eq(ident_to_string(src),interner_get(fresh_name(src)));
 // that is, that the new name and the old one are connected to ptr_eq strings.
 pub fn fresh_name(src: &ast::Ident) -> Name {
     let interner = get_ident_interner();
@@ -700,7 +700,7 @@ pub fn fresh_name(src: &ast::Ident) -> Name {
     // good error messages and uses of struct names in ambiguous could-be-binding
     // locations. Also definitely destroys the guarantee given above about ptr_eq.
     /*let num = rand::task_rng().gen_uint_range(0,0xffff);
-    gensym(format!("{}_{}",ident_to_str(src),num))*/
+    gensym(format!("{}_{}",ident_to_string(src),num))*/
 }
 
 // create a fresh mark.
index bf2101108293960cb25ea4c74b997f21ca33a4d9..f4be7465159175e826ad61a1b12f262c925017e5 100644 (file)
@@ -128,6 +128,126 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
     eof(&mut s.s)
 }
 
+pub fn to_string(f: |&mut State| -> IoResult<()>) -> String {
+    let mut s = rust_printer(box MemWriter::new());
+    f(&mut s).unwrap();
+    eof(&mut s.s).unwrap();
+    unsafe {
+        // FIXME(pcwalton): A nasty function to extract the string from an `io::Writer`
+        // that we "know" to be a `MemWriter` that works around the lack of checked
+        // downcasts.
+        let (_, wr): (uint, Box<MemWriter>) = mem::transmute_copy(&s.s.out);
+        let result =
+            str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap();
+        mem::forget(wr);
+        result.to_string()
+    }
+}
+
+pub fn ty_to_string(ty: &ast::Ty) -> String {
+    to_string(|s| s.print_type(ty))
+}
+
+pub fn pat_to_string(pat: &ast::Pat) -> String {
+    to_string(|s| s.print_pat(pat))
+}
+
+pub fn expr_to_string(e: &ast::Expr) -> String {
+    to_string(|s| s.print_expr(e))
+}
+
+pub fn lifetime_to_string(e: &ast::Lifetime) -> String {
+    to_string(|s| s.print_lifetime(e))
+}
+
+pub fn tt_to_string(tt: &ast::TokenTree) -> String {
+    to_string(|s| s.print_tt(tt))
+}
+
+pub fn tts_to_string(tts: &[ast::TokenTree]) -> String {
+    to_string(|s| s.print_tts(tts))
+}
+
+pub fn stmt_to_string(stmt: &ast::Stmt) -> String {
+    to_string(|s| s.print_stmt(stmt))
+}
+
+pub fn item_to_string(i: &ast::Item) -> String {
+    to_string(|s| s.print_item(i))
+}
+
+pub fn generics_to_string(generics: &ast::Generics) -> String {
+    to_string(|s| s.print_generics(generics))
+}
+
+pub fn ty_method_to_string(p: &ast::TypeMethod) -> String {
+    to_string(|s| s.print_ty_method(p))
+}
+
+pub fn method_to_string(p: &ast::Method) -> String {
+    to_string(|s| s.print_method(p))
+}
+
+pub fn fn_block_to_string(p: &ast::FnDecl) -> String {
+    to_string(|s| s.print_fn_block_args(p))
+}
+
+pub fn path_to_string(p: &ast::Path) -> String {
+    to_string(|s| s.print_path(p, false))
+}
+
+pub fn ident_to_string(id: &ast::Ident) -> String {
+    to_string(|s| s.print_ident(*id))
+}
+
+pub fn fun_to_string(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident,
+                  opt_explicit_self: Option<ast::ExplicitSelf_>,
+                  generics: &ast::Generics) -> String {
+    to_string(|s| {
+        try!(s.print_fn(decl, Some(fn_style), abi::Rust,
+                        name, generics, opt_explicit_self, ast::Inherited));
+        try!(s.end()); // Close the head box
+        s.end() // Close the outer box
+    })
+}
+
+pub fn block_to_string(blk: &ast::Block) -> String {
+    to_string(|s| {
+        // containing cbox, will be closed by print-block at }
+        try!(s.cbox(indent_unit));
+        // head-ibox, will be closed by print-block after {
+        try!(s.ibox(0u));
+        s.print_block(blk)
+    })
+}
+
+pub fn meta_item_to_string(mi: &ast::MetaItem) -> String {
+    to_string(|s| s.print_meta_item(mi))
+}
+
+pub fn attribute_to_string(attr: &ast::Attribute) -> String {
+    to_string(|s| s.print_attribute(attr))
+}
+
+pub fn lit_to_string(l: &ast::Lit) -> String {
+    to_string(|s| s.print_literal(l))
+}
+
+pub fn explicit_self_to_string(explicit_self: ast::ExplicitSelf_) -> String {
+    to_string(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {}))
+}
+
+pub fn variant_to_string(var: &ast::Variant) -> String {
+    to_string(|s| s.print_variant(var))
+}
+
+pub fn arg_to_string(arg: &ast::Arg) -> String {
+    to_string(|s| s.print_arg(arg))
+}
+
+
+
+#[cfg(stage0)]
 pub fn to_str(f: |&mut State| -> IoResult<()>) -> String {
     let mut s = rust_printer(box MemWriter::new());
     f(&mut s).unwrap();
@@ -144,62 +264,72 @@ pub fn to_str(f: |&mut State| -> IoResult<()>) -> String {
     }
 }
 
+#[cfg(stage0)]
 pub fn ty_to_str(ty: &ast::Ty) -> String {
     to_str(|s| s.print_type(ty))
 }
 
+#[cfg(stage0)]
 pub fn pat_to_str(pat: &ast::Pat) -> String {
     to_str(|s| s.print_pat(pat))
 }
 
+#[cfg(stage0)]
 pub fn expr_to_str(e: &ast::Expr) -> String {
     to_str(|s| s.print_expr(e))
 }
 
+#[cfg(stage0)]
 pub fn lifetime_to_str(e: &ast::Lifetime) -> String {
     to_str(|s| s.print_lifetime(e))
 }
 
+#[cfg(stage0)]
 pub fn tt_to_str(tt: &ast::TokenTree) -> String {
     to_str(|s| s.print_tt(tt))
 }
 
+#[cfg(stage0)]
 pub fn tts_to_str(tts: &[ast::TokenTree]) -> String {
     to_str(|s| s.print_tts(tts))
 }
 
+#[cfg(stage0)]
 pub fn stmt_to_str(stmt: &ast::Stmt) -> String {
     to_str(|s| s.print_stmt(stmt))
 }
 
+#[cfg(stage0)]
 pub fn item_to_str(i: &ast::Item) -> String {
     to_str(|s| s.print_item(i))
 }
 
+#[cfg(stage0)]
 pub fn generics_to_str(generics: &ast::Generics) -> String {
     to_str(|s| s.print_generics(generics))
 }
 
+#[cfg(stage0)]
 pub fn ty_method_to_str(p: &ast::TypeMethod) -> String {
     to_str(|s| s.print_ty_method(p))
 }
 
+#[cfg(stage0)]
 pub fn method_to_str(p: &ast::Method) -> String {
     to_str(|s| s.print_method(p))
 }
 
+#[cfg(stage0)]
 pub fn fn_block_to_str(p: &ast::FnDecl) -> String {
     to_str(|s| s.print_fn_block_args(p))
 }
 
+#[cfg(stage0)]
 pub fn path_to_str(p: &ast::Path) -> String {
     to_str(|s| s.print_path(p, false))
 }
 
-pub fn ident_to_str(id: &ast::Ident) -> String {
-    to_str(|s| s.print_ident(*id))
-}
-
+#[cfg(stage0)]
 pub fn fun_to_str(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident,
                   opt_explicit_self: Option<ast::ExplicitSelf_>,
                   generics: &ast::Generics) -> String {
@@ -211,6 +341,7 @@ pub fn fun_to_str(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident,
     })
 }
 
+#[cfg(stage0)]
 pub fn block_to_str(blk: &ast::Block) -> String {
     to_str(|s| {
         // containing cbox, will be closed by print-block at }
@@ -221,30 +352,39 @@ pub fn block_to_str(blk: &ast::Block) -> String {
     })
 }
 
+#[cfg(stage0)]
 pub fn meta_item_to_str(mi: &ast::MetaItem) -> String {
     to_str(|s| s.print_meta_item(mi))
 }
 
+#[cfg(stage0)]
 pub fn attribute_to_str(attr: &ast::Attribute) -> String {
     to_str(|s| s.print_attribute(attr))
 }
 
+#[cfg(stage0)]
 pub fn lit_to_str(l: &ast::Lit) -> String {
     to_str(|s| s.print_literal(l))
 }
 
+#[cfg(stage0)]
 pub fn explicit_self_to_str(explicit_self: ast::ExplicitSelf_) -> String {
     to_str(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {}))
 }
 
+#[cfg(stage0)]
 pub fn variant_to_str(var: &ast::Variant) -> String {
     to_str(|s| s.print_variant(var))
 }
 
+#[cfg(stage0)]
 pub fn arg_to_str(arg: &ast::Arg) -> String {
     to_str(|s| s.print_arg(arg))
 }
 
+
+
+
 pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String {
     match vis {
         ast::Public => format!("pub {}", s),
@@ -674,7 +814,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
             }
             ast::ItemForeignMod(ref nmod) => {
                 try!(self.head("extern"));
-                try!(self.word_nbsp(nmod.abi.to_str().as_slice()));
+                try!(self.word_nbsp(nmod.abi.to_string().as_slice()));
                 try!(self.bopen());
                 try!(self.print_foreign_mod(nmod, item.attrs.as_slice()));
                 try!(self.bclose(item.span));
@@ -893,7 +1033,7 @@ pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
         match *tt {
             ast::TTDelim(ref tts) => self.print_tts(tts.as_slice()),
             ast::TTTok(_, ref tk) => {
-                try!(word(&mut self.s, parse::token::to_str(tk).as_slice()));
+                try!(word(&mut self.s, parse::token::to_string(tk).as_slice()));
                 match *tk {
                     parse::token::DOC_COMMENT(..) => {
                         hardbreak(&mut self.s)
@@ -910,7 +1050,7 @@ pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> {
                 match *sep {
                     Some(ref tk) => {
                         try!(word(&mut self.s,
-                                  parse::token::to_str(tk).as_slice()));
+                                  parse::token::to_string(tk).as_slice()));
                     }
                     None => ()
                 }
@@ -1308,11 +1448,11 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
             ast::ExprBinary(op, ref lhs, ref rhs) => {
                 try!(self.print_expr(&**lhs));
                 try!(space(&mut self.s));
-                try!(self.word_space(ast_util::binop_to_str(op)));
+                try!(self.word_space(ast_util::binop_to_string(op)));
                 try!(self.print_expr(&**rhs));
             }
             ast::ExprUnary(op, ref expr) => {
-                try!(word(&mut self.s, ast_util::unop_to_str(op)));
+                try!(word(&mut self.s, ast_util::unop_to_string(op)));
                 try!(self.print_expr_maybe_paren(&**expr));
             }
             ast::ExprAddrOf(m, ref expr) => {
@@ -1488,7 +1628,7 @@ pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> {
             ast::ExprAssignOp(op, ref lhs, ref rhs) => {
                 try!(self.print_expr(&**lhs));
                 try!(space(&mut self.s));
-                try!(word(&mut self.s, ast_util::binop_to_str(op)));
+                try!(word(&mut self.s, ast_util::binop_to_string(op)));
                 try!(self.word_space("="));
                 try!(self.print_expr(&**rhs));
             }
@@ -2328,11 +2468,11 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
             }
             ast::LitInt(i, t) => {
                 word(&mut self.s,
-                     ast_util::int_ty_to_str(t, Some(i)).as_slice())
+                     ast_util::int_ty_to_string(t, Some(i)).as_slice())
             }
             ast::LitUint(u, t) => {
                 word(&mut self.s,
-                     ast_util::uint_ty_to_str(t, Some(u)).as_slice())
+                     ast_util::uint_ty_to_string(t, Some(u)).as_slice())
             }
             ast::LitIntUnsuffixed(i) => {
                 word(&mut self.s, format!("{}", i).as_slice())
@@ -2342,7 +2482,7 @@ pub fn print_literal(&mut self, lit: &ast::Lit) -> IoResult<()> {
                      format!(
                          "{}{}",
                          f.get(),
-                         ast_util::float_ty_to_str(t).as_slice()).as_slice())
+                         ast_util::float_ty_to_string(t).as_slice()).as_slice())
             }
             ast::LitFloatUnsuffixed(ref f) => word(&mut self.s, f.get()),
             ast::LitNil => word(&mut self.s, "()"),
@@ -2480,7 +2620,7 @@ pub fn print_opt_abi_and_extern_if_nondefault(&mut self,
             Some(abi::Rust) => Ok(()),
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abi.to_str().as_slice())
+                self.word_nbsp(abi.to_string().as_slice())
             }
             None => Ok(())
         }
@@ -2491,7 +2631,7 @@ pub fn print_extern_opt_abi(&mut self,
         match opt_abi {
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abi.to_str().as_slice())
+                self.word_nbsp(abi.to_string().as_slice())
             }
             None => Ok(())
         }
@@ -2507,7 +2647,7 @@ pub fn print_fn_header_info(&mut self,
 
         if abi != abi::Rust {
             try!(self.word_nbsp("extern"));
-            try!(self.word_nbsp(abi.to_str().as_slice()));
+            try!(self.word_nbsp(abi.to_string().as_slice()));
         }
 
         word(&mut self.s, "fn")
@@ -2538,7 +2678,7 @@ mod test {
     use parse::token;
 
     #[test]
-    fn test_fun_to_str() {
+    fn test_fun_to_string() {
         let abba_ident = token::str_to_ident("abba");
 
         let decl = ast::FnDecl {
@@ -2550,13 +2690,13 @@ fn test_fun_to_str() {
             variadic: false
         };
         let generics = ast_util::empty_generics();
-        assert_eq!(&fun_to_str(&decl, ast::NormalFn, abba_ident,
+        assert_eq!(&fun_to_string(&decl, ast::NormalFn, abba_ident,
                                None, &generics),
                    &"fn abba()".to_string());
     }
 
     #[test]
-    fn test_variant_to_str() {
+    fn test_variant_to_string() {
         let ident = token::str_to_ident("principal_skinner");
 
         let var = codemap::respan(codemap::DUMMY_SP, ast::Variant_ {
@@ -2569,7 +2709,7 @@ fn test_variant_to_str() {
             vis: ast::Public,
         });
 
-        let varstr = variant_to_str(&var);
+        let varstr = variant_to_string(&var);
         assert_eq!(&varstr,&"pub principal_skinner".to_string());
     }
 }
index 1eb13fd660e319af1221bcc402836643314c087d..b80f47e6c934ee49914a8641244d26c404a56912 100644 (file)
@@ -370,7 +370,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
     let matches =
         match getopts::getopts(args_.as_slice(), optgroups().as_slice()) {
           Ok(m) => m,
-          Err(f) => return Some(Err(f.to_str()))
+          Err(f) => return Some(Err(f.to_string()))
         };
 
     if matches.opt_present("h") { usage(args[0].as_slice()); return None; }
@@ -634,7 +634,7 @@ pub fn write_failures(&mut self) -> io::IoResult<()> {
         let mut failures = Vec::new();
         let mut fail_out = String::new();
         for &(ref f, ref stdout) in self.failures.iter() {
-            failures.push(f.name.to_str());
+            failures.push(f.name.to_string());
             if stdout.len() > 0 {
                 fail_out.push_str(format!("---- {} stdout ----\n\t",
                                           f.name.as_slice()).as_slice());
@@ -1522,7 +1522,7 @@ pub fn filter_for_ignored_option() {
         let filtered = filter_tests(&opts, tests);
 
         assert_eq!(filtered.len(), 1);
-        assert_eq!(filtered.get(0).desc.name.to_str(),
+        assert_eq!(filtered.get(0).desc.name.to_string(),
                    "1".to_string());
         assert!(filtered.get(0).desc.ignore == false);
     }
@@ -1573,7 +1573,7 @@ fn testfn() { }
                  "test::sort_tests".to_string());
 
         for (a, b) in expected.iter().zip(filtered.iter()) {
-            assert!(*a == b.desc.name.to_str());
+            assert!(*a == b.desc.name.to_string());
         }
     }
 
index 8db9a4f53aa9bc8a8dab871729aa6839c46d2c20..325582ff99c98a6370effc3bf2ede983b6579e10 100644 (file)
@@ -385,8 +385,8 @@ pub fn write_boxplot<T: Float + Show + FromPrimitive>(
 
     let range = hi - lo;
 
-    let lostr = lo.to_str();
-    let histr = hi.to_str();
+    let lostr = lo.to_string();
+    let histr = hi.to_string();
 
     let overhead_width = lostr.len() + histr.len() + 4;
     let range_width = width_hint - overhead_width;
index 873cc7af7b64761dc8b84999325d1fb91aeb14a1..9ed46d7a49b7e12ab4f9caeac3cdb1ab31e61ae9 100644 (file)
@@ -1039,7 +1039,7 @@ fn parse_type(ch: char, tm: &Tm) -> String {
           'U' => format!("{:02d}", (tm.tm_yday - tm.tm_wday + 7) / 7),
           'u' => {
             let i = tm.tm_wday as int;
-            (if i == 0 { 7 } else { i }).to_str()
+            (if i == 0 { 7 } else { i }).to_string()
           }
           'V' => iso_week('V', tm),
           'v' => {
@@ -1052,8 +1052,8 @@ fn parse_type(ch: char, tm: &Tm) -> String {
               format!("{:02d}",
                              (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7)
           }
-          'w' => (tm.tm_wday as int).to_str(),
-          'Y' => (tm.tm_year as int + 1900).to_str(),
+          'w' => (tm.tm_wday as int).to_string(),
+          'Y' => (tm.tm_year as int + 1900).to_string(),
           'y' => format!("{:02d}", (tm.tm_year as int + 1900) % 100),
           'Z' => "".to_string(),    // FIXME(pcwalton): Implement this.
           'z' => {
index e835e5b26cfd7be51a336884e03467698a8d611e..129e3d0bf0ae821137e0582d3930eafc78563d63 100644 (file)
@@ -765,13 +765,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 impl<S: hash::Writer> hash::Hash<S> for Url {
     fn hash(&self, state: &mut S) {
-        self.to_str().hash(state)
+        self.to_string().hash(state)
     }
 }
 
 impl<S: hash::Writer> hash::Hash<S> for Path {
     fn hash(&self, state: &mut S) {
-        self.to_str().hash(state)
+        self.to_string().hash(state)
     }
 }
 
index 426b350cab949c3972b128ebac4f04f2a3251db0..7d93f1f52cf05b82e2b141e605560bb76534624a 100644 (file)
@@ -33,7 +33,7 @@
 
 fn main() {
     let uuid1 = Uuid::new_v4();
-    println!("{}", uuid1.to_str());
+    println!("{}", uuid1.to_string());
 }
 ```
 
@@ -622,7 +622,7 @@ fn test_parse_uuid_v4() {
 
         // Round-trip
         let uuid_orig = Uuid::new_v4();
-        let orig_str = uuid_orig.to_str();
+        let orig_str = uuid_orig.to_string();
         let uuid_out = Uuid::parse_string(orig_str.as_slice()).unwrap();
         assert!(uuid_orig == uuid_out);
 
@@ -650,9 +650,9 @@ fn test_to_simple_str() {
     }
 
     #[test]
-    fn test_to_str() {
+    fn test_to_string() {
         let uuid1 = Uuid::new_v4();
-        let s = uuid1.to_str();
+        let s = uuid1.to_string();
 
         assert!(s.len() == 32);
         assert!(s.as_slice().chars().all(|c| c.is_digit_radix(16)));
@@ -685,7 +685,7 @@ fn test_to_str_matching() {
         let uuid1 = Uuid::new_v4();
 
         let hs = uuid1.to_hyphenated_str();
-        let ss = uuid1.to_str();
+        let ss = uuid1.to_string();
 
         let hsn = str::from_chars(hs.as_slice()
                                     .chars()
@@ -704,7 +704,7 @@ fn test_string_roundtrip() {
         let uuid_hs = Uuid::parse_string(hs.as_slice()).unwrap();
         assert!(uuid_hs == uuid);
 
-        let ss = uuid.to_str();
+        let ss = uuid.to_string();
         let uuid_ss = Uuid::parse_string(ss.as_slice()).unwrap();
         assert!(uuid_ss == uuid);
     }
@@ -833,10 +833,10 @@ pub fn create_uuids(b: &mut Bencher) {
     }
 
     #[bench]
-    pub fn uuid_to_str(b: &mut Bencher) {
+    pub fn uuid_to_string(b: &mut Bencher) {
         let u = Uuid::new_v4();
         b.iter(|| {
-            u.to_str();
+            u.to_string();
         })
     }
 
index c3e877f80817658efea54fe3618ee6687b80d9e3..1d2d02d7d592689de2661c6d4b79b0e877d887a4 100644 (file)
@@ -90,11 +90,11 @@ pub fn bench_str<T:MutableSet<String>,
             let mut set = f();
             timed(&mut self.sequential_strings, || {
                 for i in range(0u, num_keys) {
-                    set.insert(i.to_str());
+                    set.insert(i.to_string());
                 }
 
                 for i in range(0u, num_keys) {
-                    assert!(set.contains(&i.to_str()));
+                    assert!(set.contains(&i.to_string()));
                 }
             })
         }
@@ -103,7 +103,7 @@ pub fn bench_str<T:MutableSet<String>,
             let mut set = f();
             timed(&mut self.random_strings, || {
                 for _ in range(0, num_keys) {
-                    let s = rng.gen::<uint>().to_str();
+                    let s = rng.gen::<uint>().to_string();
                     set.insert(s);
                 }
             })
@@ -112,11 +112,11 @@ pub fn bench_str<T:MutableSet<String>,
         {
             let mut set = f();
             for i in range(0u, num_keys) {
-                set.insert(i.to_str());
+                set.insert(i.to_string());
             }
             timed(&mut self.delete_strings, || {
                 for i in range(0u, num_keys) {
-                    assert!(set.remove(&i.to_str()));
+                    assert!(set.remove(&i.to_string()));
                 }
             })
         }
index 1c51ea055d04e3ab30a09831eee315dd7511fcac..f38517515660970d7b33dbc525567c6449cefae0 100644 (file)
@@ -24,7 +24,7 @@ fn main() {
     let n = from_str::<uint>(args.get(1).as_slice()).unwrap();
 
     for i in range(0u, n) {
-        let x = i.to_str();
+        let x = i.to_string();
         println!("{}", x);
     }
 }
index 8095037662bccf4e95edfe1eac7ecff0ed1a4112..0c76d14852e08695cf9ebc83272b1c2979741080 100644 (file)
@@ -48,7 +48,7 @@ fn show_color_list(set: Vec<Color>) -> String {
     let mut out = String::new();
     for col in set.iter() {
         out.push_char(' ');
-        out.push_str(col.to_str().as_slice());
+        out.push_str(col.to_string().as_slice());
     }
     out
 }
index 195c146c12fe719f26927bef8016837b91852345..b3deb88543ed46bdec52e56732c69bc2d20886fe 100644 (file)
@@ -64,7 +64,7 @@ fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
                                k.as_slice()
                                .to_ascii()
                                .to_upper()
-                               .into_str(), v).as_slice());
+                               .into_string(), v).as_slice());
    }
 
    return buffer
@@ -72,7 +72,7 @@ fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
 
 // given a map, search for the frequency of a pattern
 fn find(mm: &HashMap<Vec<u8> , uint>, key: String) -> uint {
-   let key = key.to_owned().into_ascii().as_slice().to_lower().into_str();
+   let key = key.to_owned().into_ascii().as_slice().to_lower().into_string();
    match mm.find_equiv(&key.as_bytes()) {
       option::None      => { return 0u; }
       option::Some(&num) => { return num; }
index 85f035b60cbbe23567357b0207ba71badecc6349..0e0b0b518d587efc815ddadf375e76588cc3a349 100644 (file)
@@ -115,7 +115,7 @@ fn main() {
 
                 let elapsed = stop - start;
 
-                println!("{}\t{}\t{}", n, fibn, elapsed.to_str());
+                println!("{}\t{}\t{}", n, fibn, elapsed.to_string());
             }
         }
     }
index 19b9d5638d0d8f3f034586958591b6322ebacd26..bdf6862d0b133ffa1150b60874e13ba0f14e0952 100644 (file)
@@ -67,7 +67,7 @@ fn main() {
     } else {
         box io::stdin() as Box<io::Reader>
     };
-    let mut seq = rdr.read_to_str().unwrap();
+    let mut seq = rdr.read_to_string().unwrap();
     let ilen = seq.len();
 
     seq = regex!(">[^\n]*\n|\n").replace_all(seq.as_slice(), NoExpand(""));
@@ -109,7 +109,7 @@ fn main() {
     let (mut variant_strs, mut counts) = (vec!(), vec!());
     for variant in variants.move_iter() {
         let seq_arc_copy = seq_arc.clone();
-        variant_strs.push(variant.to_str().to_owned());
+        variant_strs.push(variant.to_string().to_owned());
         counts.push(Future::spawn(proc() {
             count_matches(seq_arc_copy.as_slice(), &variant)
         }));
index 2c3dda015471fd265aa9ef2d19dc8797bbf3fbd4..00607f850347cc54c5b1c201d5c098e375470506 100644 (file)
 struct t(Box<t>); //~ ERROR this type cannot be instantiated
 
 trait to_str_2 {
-    fn my_to_str() -> String;
+    fn my_to_string() -> String;
 }
 
 // I use an impl here because it will cause
 // the compiler to attempt autoderef and then
 // try to resolve the method.
 impl to_str_2 for t {
-    fn my_to_str() -> String { "t".to_string() }
+    fn my_to_string() -> String { "t".to_string() }
 }
 
 fn new_t(x: t) {
-    x.my_to_str(); //~ ERROR does not implement
+    x.my_to_string(); //~ ERROR does not implement
 }
 
 fn main() {
index 9b77d62a065292f74c68a264fa58da80565db02c..57bc11379125f440caa1fda9f6d262ffffe15a50 100644 (file)
@@ -13,17 +13,17 @@ struct Point {
     y: f64,
 }
 
-trait NewTrait {
-    fn a(&self) -> String;
+trait ToString_ {
+    fn to_string(&self) -> String;
 }
 
-impl NewTrait for Point {
+impl ToString_ for Point {
     fn new(x: f64, y: f64) -> Point {
-    //~^ ERROR method `new` is not a member of trait `NewTrait`
+    //~^ ERROR method `new` is not a member of trait `ToString_`
         Point { x: x, y: y }
     }
 
-    fn a(&self) -> String {
+    fn to_string(&self) -> String {
         format!("({}, {})", self.x, self.y)
     }
 }
@@ -32,5 +32,5 @@ fn main() {
     let p = Point::new(0.0, 0.0);
     //~^ ERROR unresolved name `Point::new`
     //~^^ ERROR failed to resolve. Use of undeclared module `Point`
-    println!("{}", p.a());
+    println!("{}", p.to_string());
 }
index f1b36d719e9591603450e80b089e4a3d031aa4ea..279cf6d94cbf13626c615f6e6a5237d33e62bc82 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-tidy-linelength
+
 #![allow(dead_code)]
 #![deny(uppercase_variables)]
 
@@ -30,7 +32,7 @@ fn main() {
     let mut buff = [0u8, ..16];
     match f.read(buff) {
         Ok(cnt) => println!("read this many bytes: {}", cnt),
-        Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_str()),
+        Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()),
                         //~^ ERROR variable names should start with a lowercase character
     }
 
index 73323def28d78d09e3f1117869c4276a0362b23b..1a2fb33eaabfed231cfcd2a4187c3b1f6d825fc3 100644 (file)
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-tidy-linelength
 
 struct S {
     x: Box<E>
@@ -29,7 +30,7 @@ fn main() {
         f(&s, |hellothere| {
             match hellothere.x { //~ ERROR cannot move out
                 box Foo(_) => {}
-                box Bar(x) => println!("{}", x.to_str()), //~ NOTE attempting to move value to here
+                box Bar(x) => println!("{}", x.to_string()), //~ NOTE attempting to move value to here
                 box Baz => {}
             }
         })
index f772b96c697b7b9cc996e9f23584debc18892d31..c7b0bc8822be1dfda61e88f2fb02eed62226f10e 100644 (file)
@@ -12,7 +12,7 @@ struct S {
  y: int
 }
 
-impl Cmp, ToStr for S { //~ ERROR: expected `{` but found `,`
+impl Cmp, ToString for S { //~ ERROR: expected `{` but found `,`
   fn eq(&&other: S) { false }
-  fn to_str(&self) -> String { "hi".to_string() }
+  fn to_string(&self) -> String { "hi".to_string() }
 }
index 779a1ec7a5bf022d5f11d7168f3f9135c8d5242f..2fb097f111db47f98727566112fc8e35047c49f0 100644 (file)
@@ -21,7 +21,7 @@ mod baz {
         impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
-        impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait
+        impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
 
         fn foo() {
@@ -33,7 +33,7 @@ fn foo() {
     impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
     impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
     impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
-    impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait
+    impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
     impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
 
     fn foo() {
@@ -48,7 +48,7 @@ mod qux_inner {
         impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
-        impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait
+        impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
         impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
 
         fn foo() {
index fecc597b8fd2fff6ec0fd2acbdb3e647ee1bd1be..c0f7bea25b57ad88fddc5f218e6c75bd06fa1cdb 100644 (file)
@@ -20,7 +20,7 @@
 impl Add for Test {} //~ ERROR: attempt to implement a nonexistent trait
 impl Clone for Test {} //~ ERROR: attempt to implement a nonexistent trait
 impl Iterator for Test {} //~ ERROR: attempt to implement a nonexistent trait
-impl ToStr for Test {} //~ ERROR: attempt to implement a nonexistent trait
+impl ToString for Test {} //~ ERROR: attempt to implement a nonexistent trait
 impl Writer for Test {} //~ ERROR: attempt to implement a nonexistent trait
 
 fn main() {
index fad20a7e37374a07f0f15f23a435b35198e77098..9f91337db9f21a6b106e7b93925ede0f0790b4eb 100644 (file)
@@ -11,7 +11,7 @@
 enum E {}
 
 fn f(e: E) {
-    println!("{}", (e as int).to_str());   //~ ERROR non-scalar cast
+    println!("{}", (e as int).to_string());   //~ ERROR non-scalar cast
 }
 
 fn main() {}
index 753c91d1dc9580ffde569ad6e219f1294ca0ea94..043f3a233a6253705718e010b41c340379f7af01 100644 (file)
@@ -23,10 +23,10 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 struct List {
-    list: Vec<Box<ToStr>> }
+    list: Vec<Box<ToString>> }
 
 impl List {
-    fn push(&mut self, n: Box<ToStr>) {
+    fn push(&mut self, n: Box<ToString>) {
         self.list.push(n);
     }
 }
@@ -35,6 +35,6 @@ fn main() {
     let n = box Number { n: 42 };
     let mut l = box List { list: Vec::new() };
     l.push(n);
-    let x = n.to_str();
+    let x = n.to_string();
     //~^ ERROR: use of moved value: `n`
 }
index 47de06c48569643acd172b9eeb9b000d4b558685..8f718add2a312afee49d955138cdd9ad2356d524 100644 (file)
@@ -21,4 +21,4 @@ pub fn p() -> C {
     C
 }
 
-fn main() { }
\ No newline at end of file
+fn main() { }
index cb364d23387cfed7cfb5a9f47893c4d355d4b8f8..91075633ab8d844c5ac9ea84725018ac779d362b 100644 (file)
@@ -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);
index 19186f4b46bcef9fb0fd50168477d58c822715f3..33ee2ffd3592ce2f6c708892221f2d79d3724c84 100644 (file)
@@ -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"));
 }
index f3d12d21684e4f9324d9746bf96df4cd7bd712c3..e3dbaa62d353264ed5eb1b40e6bf0e49581a1f1f 100644 (file)
 // 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());
 }
index 3d486144c3eed8005743ab72f61ce5f117b73210..7143888298072da85d34254ace13f980bf6ceddd 100644 (file)
@@ -57,13 +57,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-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());
 }
index a5e86dee18e8cadd5d35dc95dc5c5c0229f782bc..fa82e42d793f03ddc52bcaf00588cdff44ef7418 100644 (file)
@@ -41,15 +41,15 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 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());
 }
index bb236638905ba9d47c21d65fa67122ff3176c215..7e71be4114836c30a441552d24dd19f13e717c35 100644 (file)
 #![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")
 }
index 62cfd10dbfb468c6a1a298e23f2cc07e24e8dd13..3b7c5083bb48ef1a42e820d111b6db91882f2288 100644 (file)
@@ -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());
 }
index d48a944c2f0d8aa060d9d2a4b371fd56cde7923d..4a89d277e9f5634568952f9ca7b0ee1d538d6418 100644 (file)
@@ -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() == "\\")
     }
 }
 
index 1d442198aec706084a35842deb24b6d19586259d..1555098f2911be5d5df7100abba6f28eb8ce0fbb 100644 (file)
@@ -10,7 +10,7 @@
 
 enum what { }
 
-fn what_to_str(x: what) -> String
+fn what_to_string(x: what) -> String
 {
     match x {
     }
index 53f92246e54c9966ac9c2de41ada6b4f0b73dd9a..2568d94fcbf9e4f14d62ae0b00bdcb228e0040e2 100644 (file)
@@ -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}"));
 }
index ac022d5c212388956b446e4ad3992138f25250c9..e38969c25263caada3a4b7fd44ce00e7c3397ef4 100644 (file)
@@ -94,7 +94,7 @@ fn add_pt(&mut self, x: int, y: int) {
     }
 }
 
-// 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() {
index c9cedc3b7de47ae982a4c5800a26400fcdf16117..3f219da0a879a2e64ea3d5d1e7fafa8db444813f 100644 (file)
 
 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());
   }
 
 }
index b27720b8579a4b4a51c511d8b366944cbffc0dfd..3ebc3e645737626a839859effb12ba98a3d4a16c 100644 (file)
@@ -96,19 +96,19 @@ enum 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);
index 16fd45a5615f224987bb8d3d316959f4688bd3a1..977cd08ba377082dea01b860d9d12e89ce7e0ff6 100644 (file)
 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();
 }
index 2b67ef09c59db5152d610b4ee9741dcba2488888..783dc32426a651f6139d0fa615167766861b684d 100644 (file)
@@ -38,7 +38,7 @@ fn bind<B>(&self, f: |&A| -> Option<B>) -> Option<B> {
 }
 
 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() {
index e7d679c41e8538e2a724ea53032430091a95600c..92c5e025b9b2149692aa23bb41c73406015de143 100644 (file)
@@ -20,7 +20,7 @@ pub fn append(&mut self, v: &str) {
     }
 }
 
-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!");
 }
index 9fd6e9616757edbcc5a17b68fc5ae25c53a072f4..8532b5f51dc5e68ebe94cb66623b9b532647e52c 100644 (file)
@@ -32,6 +32,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 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());
 }
index 49edf1bad57f0a9525ed357ea0778e6680b9248f..283c76adf0dafcc2a90d17ba8114c6c16af9270e 100644 (file)
@@ -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.
index 68eca8f21a7f5d37c9b4a94e55a96034593bd648..f3a730aa2b39589b823994ebd3c6ab321ff183f7 100644 (file)
@@ -12,7 +12,7 @@
 
 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;
 
index 9267fcac0115aad81645646ef56e5dacf9bcf62c..d0dacc2ff7a9d225a4cec29e68091ac35937b21e 100644 (file)
@@ -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;
index 6a71f9df6e45ee70eff9b0cbb27d98739774fc29..ceffd1e363667d313ce04f3cf3a4e226a14361a9 100644 (file)
@@ -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!"));
 }
index ebc720aa0c888d60f2bc5c675709c38d863f564a..d2408509fc5820c0105e083a149060d1ea67333d 100644 (file)
@@ -54,7 +54,7 @@ fn f() $b
 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 @@ fn f() $b
 
 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();
 
index de3366708c5a0a0e3ebcef92c1279577bfdf3a4a..f52a3455e4157684c16b98c5b29828db88b4f125 100644 (file)
@@ -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) => {
index c3387a963a701d44c8e4d1f84f80394ac8160327..b36fbca2da048a68f9b82af3c19712e00677ec47 100644 (file)
@@ -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));
 }
index daab40f5d90d1de7e41c94a1c61fb10bbb7fa98e..43d3b591ffa1b9225e3073ed6e8d7f1877d7b9be 100644 (file)
@@ -39,7 +39,7 @@ fn to_str_(&self) -> String {
 
 impl to_str for int {
     fn to_str_(&self) -> String {
-        self.to_str()
+        self.to_string()
     }
 }
 
index f3f4c556b77292f6208922a1c1fedc6cc86357ff..eeda6e2c88b454e084d07d29811915224e6bd59d 100644 (file)
 
 
 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() {
index 54a21caafa0b187f9d2f1c97f9d6f6627c95f855..fbe40e837de5f04a1d350b134526c2ceede596f2 100644 (file)
 
 
 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());
 
index 4d9f80cec6ace370c9957740008af0eca8b8922a..deb08a4608cc0358c533531e7b2d1fff79289caa 100644 (file)
@@ -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());
 }