about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-03-26 04:39:10 +0100
committerMarvin Löbel <loebel.marvin@gmail.com>2013-03-26 14:59:17 +0100
commit06c371605b3e2ad8068e359f28d4c77dccad0237 (patch)
treec278469b73160ec34c7d79a35b646aeb28e11c66
parentc99488b3a4045171e36bcd2a89e742ac06d3ba72 (diff)
downloadrust-06c371605b3e2ad8068e359f28d4c77dccad0237.tar.gz
rust-06c371605b3e2ad8068e359f28d4c77dccad0237.zip
Fixed all use sites and tests
-rw-r--r--src/compiletest/header.rs3
-rw-r--r--src/compiletest/runtest.rs14
-rw-r--r--src/libcore/str.rs278
-rw-r--r--src/librust/rust.rc20
-rw-r--r--src/librustdoc/desc_to_brief_pass.rs3
-rw-r--r--src/librustdoc/markdown_pass.rs8
-rw-r--r--src/librustdoc/sectionalize_pass.rs4
-rw-r--r--src/librustdoc/unindent_pass.rs3
-rw-r--r--src/librusti/rusti.rc3
-rw-r--r--src/librustpkg/rustpkg.rc27
-rw-r--r--src/librustpkg/util.rs10
-rw-r--r--src/test/bench/sudoku.rs3
-rw-r--r--src/test/run-pass/utf8_chars.rs4
13 files changed, 204 insertions, 176 deletions
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index a039aaf5683..5a35c56c075 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -142,7 +142,8 @@ fn parse_check_line(line: ~str) -> Option<~str> {
 fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
     do parse_name_value_directive(line, ~"exec-env").map |nv| {
         // nv is either FOO or FOO=BAR
-        let strs = str::splitn_char(*nv, '=', 1u);
+        let mut strs = ~[];
+        for str::each_splitn_char(*nv, '=', 1u) |s| { strs.push(s.to_owned()); }
         match strs.len() {
           1u => (strs[0], ~""),
           2u => (strs[0], strs[1]),
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index f17e9ffe548..ed66aea4f0c 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -267,7 +267,7 @@ fn run_debuginfo_test(config: config, props: TestProps, testfile: &Path) {
         // check if each line in props.check_lines appears in the
         // output (in order)
         let mut i = 0u;
-        for str::lines_each(ProcRes.stdout) |line| {
+        for str::each_line(ProcRes.stdout) |line| {
             if props.check_lines[i].trim() == line.trim() {
                 i += 1u;
             }
@@ -297,7 +297,7 @@ fn check_error_patterns(props: TestProps,
     let mut next_err_idx = 0u;
     let mut next_err_pat = props.error_patterns[next_err_idx];
     let mut done = false;
-    for str::lines_each(ProcRes.stderr) |line| {
+    for str::each_line(ProcRes.stderr) |line| {
         if str::contains(line, next_err_pat) {
             debug!("found error pattern %s", next_err_pat);
             next_err_idx += 1u;
@@ -347,7 +347,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
     //    filename:line1:col1: line2:col2: *warning:* msg
     // where line1:col1: is the starting point, line2:col2:
     // is the ending point, and * represents ANSI color codes.
-    for str::lines_each(ProcRes.stderr) |line| {
+    for str::each_line(ProcRes.stderr) |line| {
         let mut was_expected = false;
         for vec::eachi(expected_errors) |i, ee| {
             if !found_flags[i] {
@@ -596,8 +596,12 @@ fn split_maybe_args(argstr: Option<~str>) -> ~[~str] {
     }
 
     match argstr {
-      Some(s) => rm_whitespace(str::split_char(s, ' ')),
-      None => ~[]
+        Some(s) => {
+            let mut ss = ~[];
+            for str::each_split_char(s, ' ') |s| { ss.push(s.to_owned()) }
+            rm_whitespace(ss)
+        }
+        None => ~[]
     }
 }
 
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 96cadadfe89..1b3761a0db8 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -2586,7 +2586,8 @@ mod tests {
     fn test_split_char() {
         fn t(s: &str, c: char, u: &[~str]) {
             debug!(~"split_byte: " + s);
-            let v = split_char(s, c);
+            let mut v = ~[];
+            for each_split_char(s, c) |s| { v.push(s.to_owned()) }
             debug!("split_byte to: %?", v);
             fail_unless!(vec::all2(v, u, |a,b| a == b));
         }
@@ -2594,28 +2595,31 @@ mod tests {
         t(~".hello.there", '.', ~[~"", ~"hello", ~"there"]);
         t(~"...hello.there.", '.', ~[~"", ~"", ~"", ~"hello", ~"there", ~""]);
 
-        fail_unless!(~[~"", ~"", ~"", ~"hello", ~"there", ~""]
-                     == split_char(~"...hello.there.", '.'));
-
-        fail_unless!(~[~""] == split_char(~"", 'z'));
-        fail_unless!(~[~"",~""] == split_char(~"z", 'z'));
-        fail_unless!(~[~"ok"] == split_char(~"ok", 'z'));
+        t(~"", 'z', ~[~""]);
+        t(~"z", 'z', ~[~"",~""]);
+        t(~"ok", 'z', ~[~"ok"]);
     }
 
     #[test]
     fn test_split_char_2() {
+        fn t(s: &str, c: char, u: &[~str]) {
+            debug!(~"split_byte: " + s);
+            let mut v = ~[];
+            for each_split_char(s, c) |s| { v.push(s.to_owned()) }
+            debug!("split_byte to: %?", v);
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
         let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中华", ~"iệt Nam"]
-                     == split_char(data, 'V'));
-        fail_unless!(~[~"ประเ", ~"ศไ", ~"ย中华Việt Nam"]
-                     == split_char(data, 'ท'));
+        t(data, 'V', ~[~"ประเทศไทย中华", ~"iệt Nam"]);
+        t(data, 'ท', ~[~"ประเ", ~"ศไ", ~"ย中华Việt Nam"]);
     }
 
     #[test]
     fn test_splitn_char() {
         fn t(s: &str, c: char, n: uint, u: &[~str]) {
             debug!(~"splitn_byte: " + s);
-            let v = splitn_char(s, c, n);
+            let mut v = ~[];
+            for each_splitn_char(s, c, n) |s| { v.push(s.to_owned()) }
             debug!("split_byte to: %?", v);
             debug!("comparing vs. %?", u);
             fail_unless!(vec::all2(v, u, |a,b| a == b));
@@ -2627,46 +2631,56 @@ mod tests {
         t(~".hello.there", '.', 0u, ~[~".hello.there"]);
         t(~".hello.there", '.', 1u, ~[~"", ~"hello.there"]);
         t(~"...hello.there.", '.', 3u, ~[~"", ~"", ~"", ~"hello.there."]);
-        t(~"...hello.there.", '.', 5u,
-          ~[~"", ~"", ~"", ~"hello", ~"there", ~""]);
+        t(~"...hello.there.", '.', 5u, ~[~"", ~"", ~"", ~"hello", ~"there", ~""]);
 
-        fail_unless!(~[~""] == splitn_char(~"", 'z', 5u));
-        fail_unless!(~[~"",~""] == splitn_char(~"z", 'z', 5u));
-        fail_unless!(~[~"ok"] == splitn_char(~"ok", 'z', 5u));
-        fail_unless!(~[~"z"] == splitn_char(~"z", 'z', 0u));
-        fail_unless!(~[~"w.x.y"] == splitn_char(~"w.x.y", '.', 0u));
-        fail_unless!(~[~"w",~"x.y"] == splitn_char(~"w.x.y", '.', 1u));
+        t(~"", 'z', 5u, ~[~""]);
+        t(~"z", 'z', 5u, ~[~"",~""]);
+        t(~"ok", 'z', 5u, ~[~"ok"]);
+        t(~"z", 'z', 0u, ~[~"z"]);
+        t(~"w.x.y", '.', 0u, ~[~"w.x.y"]);
+        t(~"w.x.y", '.', 1u, ~[~"w",~"x.y"]);
     }
 
     #[test]
     fn test_splitn_char_2 () {
-        let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中", ~"Việt Nam"]
-                     == splitn_char(data, '华', 1u));
+        fn t(s: &str, c: char, n: uint, u: &[~str]) {
+            debug!(~"splitn_byte: " + s);
+            let mut v = ~[];
+            for each_splitn_char(s, c, n) |s| { v.push(s.to_owned()) }
+            debug!("split_byte to: %?", v);
+            debug!("comparing vs. %?", u);
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
 
-        fail_unless!(~[~"", ~"", ~"XXX", ~"YYYzWWWz"]
-                     == splitn_char(~"zzXXXzYYYzWWWz", 'z', 3u));
-        fail_unless!(~[~"",~""] == splitn_char(~"z", 'z', 5u));
-        fail_unless!(~[~""] == splitn_char(~"", 'z', 5u));
-        fail_unless!(~[~"ok"] == splitn_char(~"ok", 'z', 5u));
+        t(~"ประเทศไทย中华Việt Nam", '华', 1u, ~[~"ประเทศไทย中", ~"Việt Nam"]);
+        t(~"zzXXXzYYYzWWWz", 'z', 3u, ~[~"", ~"", ~"XXX", ~"YYYzWWWz"]);
+        t(~"z", 'z', 5u, ~[~"",~""]);
+        t(~"", 'z', 5u, ~[~""]);
+        t(~"ok", 'z', 5u, ~[~"ok"]);
     }
 
 
     #[test]
     fn test_splitn_char_3() {
+        fn t(s: &str, c: char, n: uint, u: &[~str]) {
+            debug!(~"splitn_byte: " + s);
+            let mut v = ~[];
+            for each_splitn_char(s, c, n) |s| { v.push(s.to_owned()) }
+            debug!("split_byte to: %?", v);
+            debug!("comparing vs. %?", u);
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
         let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中华", ~"iệt Nam"]
-                     == splitn_char(data, 'V', 1u));
-        fail_unless!(~[~"ประเ", ~"ศไทย中华Việt Nam"]
-                     == splitn_char(data, 'ท', 1u));
-
+        t(data, 'V', 1u, ~[~"ประเทศไทย中华", ~"iệt Nam"]);
+        t(data, 'ท', 1u, ~[~"ประเ", ~"ศไทย中华Việt Nam"]);
     }
 
     #[test]
     fn test_split_char_no_trailing() {
-     fn t(s: &str, c: char, u: &[~str]) {
+        fn t(s: &str, c: char, u: &[~str]) {
             debug!(~"split_byte: " + s);
-            let v = split_char_no_trailing(s, c);
+            let mut v = ~[];
+            for each_split_char_no_trailing(s, c) |s| { v.push(s.to_owned()) }
             debug!("split_byte to: %?", v);
             fail_unless!(vec::all2(v, u, |a,b| a == b));
         }
@@ -2674,91 +2688,80 @@ mod tests {
         t(~".hello.there", '.', ~[~"", ~"hello", ~"there"]);
         t(~"...hello.there.", '.', ~[~"", ~"", ~"", ~"hello", ~"there"]);
 
-        fail_unless!(~[~"", ~"", ~"", ~"hello", ~"there"]
-                     == split_char_no_trailing(~"...hello.there.", '.'));
-
-        fail_unless!(~[] == split_char_no_trailing(~"", 'z'));
-        fail_unless!(~[~""] == split_char_no_trailing(~"z", 'z'));
-        fail_unless!(~[~"ok"] == split_char_no_trailing(~"ok", 'z'));
+        t(~"...hello.there.", '.', ~[~"", ~"", ~"", ~"hello", ~"there"]);
+        t(~"", 'z', ~[]);
+        t(~"z", 'z', ~[~""]);
+        t(~"ok", 'z', ~[~"ok"]);
     }
 
     #[test]
     fn test_split_char_no_trailing_2() {
+        fn t(s: &str, c: char, u: &[~str]) {
+            debug!(~"split_byte: " + s);
+            let mut v = ~[];
+            for each_split_char_no_trailing(s, c) |s| { v.push(s.to_owned()) }
+            debug!("split_byte to: %?", v);
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
         let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中华", ~"iệt Nam"]
-                     == split_char_no_trailing(data, 'V'));
-        fail_unless!(~[~"ประเ", ~"ศไ", ~"ย中华Việt Nam"]
-                     == split_char_no_trailing(data, 'ท'));
+        t(data, 'V', ~[~"ประเทศไทย中华", ~"iệt Nam"]);
+        t(data, 'ท', ~[~"ประเ", ~"ศไ", ~"ย中华Việt Nam"]);
     }
 
     #[test]
     fn test_split_str() {
-        fn t(s: &str, sep: &'a str, i: int, k: &str) {
-            fn borrow(x: &'a str) -> &'a str { x }
-            let v = split_str(s, sep);
-            fail_unless!(borrow(v[i]) == k);
+        fn t(s: &str, sep: &'a str, u: &[~str]) {
+            let mut v = ~[];
+            for each_split_str(s, sep) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
         }
-
-        t(~"--1233345--", ~"12345", 0, ~"--1233345--");
-        t(~"abc::hello::there", ~"::", 0, ~"abc");
-        t(~"abc::hello::there", ~"::", 1, ~"hello");
-        t(~"abc::hello::there", ~"::", 2, ~"there");
-        t(~"::hello::there", ~"::", 0, ~"");
-        t(~"hello::there::", ~"::", 2, ~"");
-        t(~"::hello::there::", ~"::", 3, ~"");
-
-        let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย", ~"Việt Nam"]
-                     == split_str (data, ~"中华"));
-
-        fail_unless!(~[~"", ~"XXX", ~"YYY", ~""]
-                     == split_str(~"zzXXXzzYYYzz", ~"zz"));
-
-        fail_unless!(~[~"zz", ~"zYYYz"] == split_str(~"zzXXXzYYYz", ~"XXX"));
-
-
-        fail_unless!(~[~"", ~"XXX", ~"YYY", ~""] ==
-                     split_str(~".XXX.YYY.", ~"."));
-        fail_unless!(~[~""] == split_str(~"", ~"."));
-        fail_unless!(~[~"",~""] == split_str(~"zz", ~"zz"));
-        fail_unless!(~[~"ok"] == split_str(~"ok", ~"z"));
-        fail_unless!(~[~"",~"z"] == split_str(~"zzz", ~"zz"));
-        fail_unless!(~[~"",~"",~"z"] == split_str(~"zzzzz", ~"zz"));
+        t(~"--1233345--", ~"12345", ~[~"--1233345--"]);
+        t(~"abc::hello::there", ~"::", ~[~"abc", ~"hello", ~"there"]);
+        t(~"::hello::there", ~"::", ~[~"", ~"hello", ~"there"]);
+        t(~"hello::there::", ~"::", ~[~"hello", ~"there", ~""]);
+        t(~"::hello::there::", ~"::", ~[~"", ~"hello", ~"there", ~""]);
+        t(~"ประเทศไทย中华Việt Nam", ~"中华", ~[~"ประเทศไทย", ~"Việt Nam"]);
+        t(~"zzXXXzzYYYzz", ~"zz", ~[~"", ~"XXX", ~"YYY", ~""]);
+        t(~"zzXXXzYYYz", ~"XXX", ~[~"zz", ~"zYYYz"]);
+        t(~".XXX.YYY.", ~".", ~[~"", ~"XXX", ~"YYY", ~""]);
+        t(~"", ~".", ~[~""]);
+        t(~"zz", ~"zz", ~[~"",~""]);
+        t(~"ok", ~"z", ~[~"ok"]);
+        t(~"zzz", ~"zz", ~[~"",~"z"]);
+        t(~"zzzzz", ~"zz", ~[~"",~"",~"z"]);
     }
 
 
     #[test]
     fn test_split() {
-        let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中", ~"Việt Nam"]
-                     == split (data, |cc| cc == '华'));
-
-        fail_unless!(~[~"", ~"", ~"XXX", ~"YYY", ~""]
-                     == split(~"zzXXXzYYYz", char::is_lowercase));
-
-        fail_unless!(~[~"zz", ~"", ~"", ~"z", ~"", ~"", ~"z"]
-                     == split(~"zzXXXzYYYz", char::is_uppercase));
+        fn t(s: &str, sepf: &fn(char) -> bool, u: &[~str]) {
+            let mut v = ~[];
+            for each_split(s, sepf) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
 
-        fail_unless!(~[~"",~""] == split(~"z", |cc| cc == 'z'));
-        fail_unless!(~[~""] == split(~"", |cc| cc == 'z'));
-        fail_unless!(~[~"ok"] == split(~"ok", |cc| cc == 'z'));
+        t(~"ประเทศไทย中华Việt Nam", |cc| cc == '华', ~[~"ประเทศไทย中", ~"Việt Nam"]);
+        t(~"zzXXXzYYYz", char::is_lowercase, ~[~"", ~"", ~"XXX", ~"YYY", ~""]);
+        t(~"zzXXXzYYYz", char::is_uppercase, ~[~"zz", ~"", ~"", ~"z", ~"", ~"", ~"z"]);
+        t(~"z", |cc| cc == 'z', ~[~"",~""]);
+        t(~"", |cc| cc == 'z', ~[~""]);
+        t(~"ok", |cc| cc == 'z', ~[~"ok"]);
     }
 
     #[test]
     fn test_split_no_trailing() {
-        let data = ~"ประเทศไทย中华Việt Nam";
-        fail_unless!(~[~"ประเทศไทย中", ~"Việt Nam"]
-                     == split_no_trailing (data, |cc| cc == '华'));
-
-        fail_unless!(~[~"", ~"", ~"XXX", ~"YYY"]
-                     == split_no_trailing(~"zzXXXzYYYz", char::is_lowercase));
-
-        fail_unless!(~[~"zz", ~"", ~"", ~"z", ~"", ~"", ~"z"]
-                     == split_no_trailing(~"zzXXXzYYYz", char::is_uppercase));
+        fn t(s: &str, sepf: &fn(char) -> bool, u: &[~str]) {
+            let mut v = ~[];
+            for each_split_no_trailing(s, sepf) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
 
-        fail_unless!(~[~""] == split_no_trailing(~"z", |cc| cc == 'z'));
-        fail_unless!(~[] == split_no_trailing(~"", |cc| cc == 'z'));
-        fail_unless!(~[~"ok"] == split_no_trailing(~"ok", |cc| cc == 'z'));
+        t(~"ประเทศไทย中华Việt Nam", |cc| cc == '华', ~[~"ประเทศไทย中", ~"Việt Nam"]);
+        t(~"zzXXXzYYYz", char::is_lowercase, ~[~"", ~"", ~"XXX", ~"YYY"]);
+        t(~"zzXXXzYYYz", char::is_uppercase, ~[~"zz", ~"", ~"", ~"z", ~"", ~"", ~"z"]);
+        t(~"z", |cc| cc == 'z', ~[~""]);
+        t(~"", |cc| cc == 'z', ~[]);
+        t(~"ok", |cc| cc == 'z', ~[~"ok"]);
     }
 
     #[test]
@@ -2766,49 +2769,50 @@ mod tests {
         let lf = ~"\nMary had a little lamb\nLittle lamb\n";
         let crlf = ~"\r\nMary had a little lamb\r\nLittle lamb\r\n";
 
-        fail_unless!(~[~"", ~"Mary had a little lamb", ~"Little lamb"]
-                     == lines(lf));
-
-        fail_unless!(~[~"", ~"Mary had a little lamb", ~"Little lamb"]
-                     == lines_any(lf));
-
-        fail_unless!(~[~"\r", ~"Mary had a little lamb\r",
-                       ~"Little lamb\r"]
-            == lines(crlf));
-
-        fail_unless!(~[~"", ~"Mary had a little lamb", ~"Little lamb"]
-            == lines_any(crlf));
+        fn t(s: &str, f: &fn(&str, &fn(&str) -> bool), u: &[~str]) {
+            let mut v = ~[];
+            for f(s) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
 
-        fail_unless!(~[] == lines    (~""));
-        fail_unless!(~[] == lines_any(~""));
-        fail_unless!(~[~""] == lines    (~"\n"));
-        fail_unless!(~[~""] == lines_any(~"\n"));
-        fail_unless!(~[~"banana"] == lines    (~"banana"));
-        fail_unless!(~[~"banana"] == lines_any(~"banana"));
+        t(lf, each_line ,~[~"", ~"Mary had a little lamb", ~"Little lamb"]);
+        t(lf, each_line_any, ~[~"", ~"Mary had a little lamb", ~"Little lamb"]);
+        t(crlf, each_line, ~[~"\r", ~"Mary had a little lamb\r", ~"Little lamb\r"]);
+        t(crlf, each_line_any, ~[~"", ~"Mary had a little lamb", ~"Little lamb"]);
+        t(~"", each_line, ~[]);
+        t(~"", each_line_any, ~[]);
+        t(~"\n", each_line, ~[~""]);
+        t(~"\n", each_line_any, ~[~""]);
+        t(~"banana", each_line, ~[~"banana"]);
+        t(~"banana", each_line_any, ~[~"banana"]);
     }
 
     #[test]
     fn test_words () {
+        fn t(s: &str, f: &fn(&str, &fn(&str) -> bool), u: &[~str]) {
+            let mut v = ~[];
+            for f(s) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
         let data = ~"\nMary had a little lamb\nLittle lamb\n";
-        fail_unless!(~[
-            ~"Mary",~"had",~"a",~"little",~"lamb",~"Little",~"lamb"]
-            == words(data));
 
-        fail_unless!(~[~"ok"] == words(~"ok"));
-        fail_unless!(~[] == words(~""));
+        t(data, each_word, ~[~"Mary",~"had",~"a",~"little",~"lamb",~"Little",~"lamb"]);
+        t(~"ok", each_word, ~[~"ok"]);
+        t(~"", each_word, ~[]);
     }
 
     #[test]
     fn test_split_within() {
-        fail_unless!(split_within(~"", 0) == ~[]);
-        fail_unless!(split_within(~"", 15) == ~[]);
-        fail_unless!(split_within(~"hello", 15) == ~[~"hello"]);
-
-        let data = ~"\nMary had a little lamb\nLittle lamb\n";
-        error!("~~~~ %?", split_within(data, 15));
-        fail_unless!(split_within(data, 15) == ~[~"Mary had a",
-                                                 ~"little lamb",
-                                                 ~"Little lamb"]);
+        fn t(s: &str, i: uint, u: &[~str]) {
+            let mut v = ~[];
+            for each_split_within(s, i) |s| { v.push(s.to_owned()) }
+            fail_unless!(vec::all2(v, u, |a,b| a == b));
+        }
+        t(~"", 0, ~[]);
+        t(~"", 15, ~[]);
+        t(~"hello", 15, ~[~"hello"]);
+        t(~"\nMary had a little lamb\nLittle lamb\n", 15,
+            ~[~"Mary had a", ~"little lamb", ~"Little lamb"]);
     }
 
     #[test]
@@ -3338,7 +3342,7 @@ mod tests {
 
         let mut ii = 0;
 
-        for split_char_each(data, ' ') |xx| {
+        for each_split_char(data, ' ') |xx| {
             match ii {
               0 => fail_unless!("\nMary" == xx),
               1 => fail_unless!("had"    == xx),
@@ -3356,7 +3360,7 @@ mod tests {
 
         let mut ii = 0;
 
-        for splitn_char_each(data, ' ', 2u) |xx| {
+        for each_splitn_char(data, ' ', 2u) |xx| {
             match ii {
               0 => fail_unless!("\nMary" == xx),
               1 => fail_unless!("had"    == xx),
@@ -3373,7 +3377,7 @@ mod tests {
 
         let mut ii = 0;
 
-        for words_each(data) |ww| {
+        for each_word(data) |ww| {
             match ii {
               0 => fail_unless!("Mary"   == ww),
               1 => fail_unless!("had"    == ww),
@@ -3384,7 +3388,7 @@ mod tests {
             ii += 1;
         }
 
-        words_each(~"", |_x| fail!()); // should not fail
+        each_word(~"", |_x| fail!()); // should not fail
     }
 
     #[test]
@@ -3393,7 +3397,7 @@ mod tests {
 
         let mut ii = 0;
 
-        for lines_each(lf) |x| {
+        for each_line(lf) |x| {
             match ii {
                 0 => fail_unless!("" == x),
                 1 => fail_unless!("Mary had a little lamb" == x),
@@ -3437,7 +3441,7 @@ mod tests {
         let ss = ~"ศไทย中华Việt Nam";
         fail_unless!(~['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a',
                        'm']
-            == chars(ss));
+            == to_chars(ss));
     }
 
     #[test]
diff --git a/src/librust/rust.rc b/src/librust/rust.rc
index e590586abbb..ffd7669c2d2 100644
--- a/src/librust/rust.rc
+++ b/src/librust/rust.rc
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // rust - central access to other rust tools
-// FIXME #2238 Make commands run and test emit proper file endings on winds
+// FIXME #2238 Make commands run and test emit proper file endings on windows
 // FIXME #2238 Make run only accept source that emits an executable
 
 #[link(name = "rust",
@@ -29,10 +29,12 @@ enum ValidUsage {
 }
 
 impl ValidUsage {
-    fn is_valid(&self) -> bool { match *self {
-        Valid   => true,
-        Invalid => false
-    }}
+    fn is_valid(&self) -> bool {
+        match *self {
+            Valid   => true,
+            Invalid => false
+        }
+    }
 }
 
 enum Action {
@@ -128,7 +130,9 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
                 match command.usage_full {
                     UsgStr(msg)          => io::println(fmt!("%s\n", msg)),
                     UsgExec(commandline) => {
-                        let words = str::words(commandline);
+                        let mut words = ~[];
+                        for str::each_word(commandline) |word| { words.push(word.to_owned()) }
+                        let words = words;
                         let (prog, args) = (words.head(), words.tail());
                         run::run_program(*prog, args);
                     }
@@ -184,7 +188,9 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
     match command.action {
         Call(f) => f(args),
         Exec(commandline) => {
-            let words = str::words(commandline);
+            let mut words = ~[];
+            for str::each_word(commandline) |word| { words.push(word.to_owned()) }
+            let words = words;
             let (prog, prog_args) = (words.head(), words.tail());
             let exitstatus = run::run_program(
                 *prog,
diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs
index 957b94d18f5..012a56c5b72 100644
--- a/src/librustdoc/desc_to_brief_pass.rs
+++ b/src/librustdoc/desc_to_brief_pass.rs
@@ -183,7 +183,8 @@ fn first_sentence_(s: &str) -> ~str {
 }
 
 fn paragraphs(s: &str) -> ~[~str] {
-    let lines = str::lines_any(s);
+    let mut lines = ~[];
+    for str::each_line_any(s) |line| { lines.push(line.to_owned()); }
     let mut whitespace_lines = 0;
     let mut accum = ~"";
     let paras = do vec::foldl(~[], lines) |paras, line| {
diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs
index 73f3aa53c25..1e39373d9a5 100644
--- a/src/librustdoc/markdown_pass.rs
+++ b/src/librustdoc/markdown_pass.rs
@@ -534,9 +534,11 @@ fn write_sig(ctxt: &Ctxt, sig: Option<~str>) {
 }
 
 fn code_block_indent(s: ~str) -> ~str {
-    let lines = str::lines_any(s);
-    let indented = vec::map(lines, |line| fmt!("    %s", *line) );
-    str::connect(indented, ~"\n")
+    let mut indented = ~[];
+    for str::each_line_any(s) |line| {
+        indented.push(fmt!("    %s", line));
+    }
+    str::connect(indented, "\n")
 }
 
 #[test]
diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs
index 8b058048ff4..33003a59611 100644
--- a/src/librustdoc/sectionalize_pass.rs
+++ b/src/librustdoc/sectionalize_pass.rs
@@ -104,8 +104,8 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
     if desc.is_none() {
         return (None, ~[]);
     }
-
-    let lines = str::lines((copy desc).get());
+    let mut lines = ~[];
+    for str::each_line_any(*desc.get_ref()) |line| { lines.push(line.to_owned()); }
 
     let mut new_desc = None::<~str>;
     let mut current_section = None;
diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs
index ecd72950468..6207e2252e4 100644
--- a/src/librustdoc/unindent_pass.rs
+++ b/src/librustdoc/unindent_pass.rs
@@ -33,7 +33,8 @@ pub fn mk_pass() -> Pass {
 }
 
 fn unindent(s: &str) -> ~str {
-    let lines = str::lines_any(s);
+    let mut lines = ~[];
+    for str::each_line_any(s) |line| { lines.push(line.to_owned()); }
     let mut saw_first_line = false;
     let mut saw_second_line = false;
     let min_indent = do vec::foldl(uint::max_value, lines)
diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc
index e04cc9e3898..ddde66157bb 100644
--- a/src/librusti/rusti.rc
+++ b/src/librusti/rusti.rc
@@ -337,7 +337,8 @@ fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str)
     -> Option<Repl> {
     if line.starts_with(~":") {
         let full = line.substr(1, line.len() - 1);
-        let split = str::words(full);
+        let mut split = ~[];
+        for str::each_word(full) |word| { split.push(word.to_owned()) }
         let len = split.len();
 
         if len > 0 {
diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rc
index 2032969fbca..35698bb235a 100644
--- a/src/librustpkg/rustpkg.rc
+++ b/src/librustpkg/rustpkg.rc
@@ -270,14 +270,11 @@ impl Ctx {
         fn sep_name_vers(in: ~str) -> (Option<~str>, Option<~str>) {
             let mut name = None;
             let mut vers = None;
-            let parts = str::split_char(in, '@');
 
-            if parts.len() >= 1 {
-                name = Some(parts[0]);
-
-                if parts.len() >= 2 {
-                    vers = Some(parts[1]);
-                }
+            for str::each_split_char(in, '@') |s| {
+                if      name.is_none() { name = Some(s.to_owned()); }
+                else if vers.is_none() { vers = Some(s.to_owned()); }
+                else                   { break;               }
             }
 
             (name, vers)
@@ -733,8 +730,12 @@ impl Ctx {
 
         for package.bins.each |&bin| {
             let path = Path(bin);
-            let name = str::split_char(path.file_path().to_str(), '-')[0];
-            let out = bin_dir.push(name);
+            let mut name = None;
+            for str::each_split_char(path.file_path().to_str(), '-') |s| {
+                name = Some(s.to_owned());
+                break;
+            }
+            let out = bin_dir.push(name.unwrap());
 
             util::link_exe(&path, &out);
             util::note(fmt!("linked %s", out.to_str()));
@@ -847,8 +848,12 @@ impl Ctx {
 
         for package.bins.each |&bin| {
             let path = Path(bin);
-            let name = str::split_char(path.file_path().to_str(), '-')[0];
-            let out = bin_dir.push(name);
+            let mut name = None;
+            for str::each_split_char(path.file_path().to_str(), '-') |s| {
+                name = Some(s.to_owned());
+                break;
+            }
+            let out = bin_dir.push(name.unwrap());
 
             if os::path_exists(&out) {
                 if os::remove_file(&out) {
diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs
index 8e5d7e95ae1..58a286a1854 100644
--- a/src/librustpkg/util.rs
+++ b/src/librustpkg/util.rs
@@ -44,10 +44,10 @@ pub fn is_cmd(cmd: ~str) -> bool {
 }
 
 pub fn parse_name(id: ~str) -> result::Result<~str, ~str> {
-    let parts = str::split_char(id, '.');
+    let mut last_part = None;
 
-    for parts.each |&part| {
-        for str::chars(part).each |&char| {
+    for str::each_split_char(id, '.') |part| {
+        for str::each_char(part) |char| {
             if char::is_whitespace(char) {
                 return result::Err(
                     ~"could not parse id: contains whitespace");
@@ -56,9 +56,11 @@ pub fn parse_name(id: ~str) -> result::Result<~str, ~str> {
                     ~"could not parse id: should be all lowercase");
             }
         }
+        last_part = Some(part.to_owned());
     }
+    if last_part.is_none() { return result::Err(~"could not parse id: is empty"); }
 
-    result::Ok(copy *parts.last())
+    result::Ok(last_part.unwrap())
 }
 
 struct ListenerFn {
diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs
index 4964cea28ad..dcc5fe58755 100644
--- a/src/test/bench/sudoku.rs
+++ b/src/test/bench/sudoku.rs
@@ -68,7 +68,8 @@ pub impl Sudoku {
         let mut g = vec::from_fn(10u, { |_i| ~[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8] });
         while !reader.eof() {
             let line = reader.read_line();
-            let comps = str::split_char(line.trim(), ',');
+            let mut comps = ~[];
+            for str::each_split_char(line.trim(), ',') |s| { comps.push(s.to_owned()) }
             if vec::len(comps) == 3u {
                 let row     = uint::from_str(comps[0]).get() as u8;
                 let col     = uint::from_str(comps[1]).get() as u8;
diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs
index cfbb7398159..247fd2d712a 100644
--- a/src/test/run-pass/utf8_chars.rs
+++ b/src/test/run-pass/utf8_chars.rs
@@ -17,8 +17,8 @@ pub fn main() {
 
     fail_unless!((str::len(s) == 10u));
     fail_unless!((str::char_len(s) == 4u));
-    fail_unless!((vec::len(str::chars(s)) == 4u));
-    fail_unless!((str::from_chars(str::chars(s)) == s));
+    fail_unless!((vec::len(str::to_chars(s)) == 4u));
+    fail_unless!((str::from_chars(str::to_chars(s)) == s));
     fail_unless!((str::char_at(s, 0u) == 'e'));
     fail_unless!((str::char_at(s, 1u) == 'é'));