about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Cantu <me@kevincantu.org>2012-02-23 01:44:04 -0800
committerMarijn Haverbeke <marijnh@gmail.com>2012-02-23 17:00:19 +0100
commit7782f5d6926be7970ec474b74302f2298ceccd13 (patch)
treec05d8ace8e1398de239c130643d18c1bc5e77d81
parent1b957c0942007e60ec9ea6773c964ea7bdc199af (diff)
downloadrust-7782f5d6926be7970ec474b74302f2298ceccd13.tar.gz
rust-7782f5d6926be7970ec474b74302f2298ceccd13.zip
(core::str) remove len_bytes alias
-rw-r--r--src/cargo/cargo.rs8
-rw-r--r--src/comp/back/link.rs7
-rw-r--r--src/comp/driver/diagnostic.rs4
-rw-r--r--src/comp/driver/rustc.rs2
-rw-r--r--src/comp/middle/trans/common.rs4
-rw-r--r--src/comp/middle/trans/debuginfo.rs5
-rw-r--r--src/comp/middle/trans/tvec.rs2
-rw-r--r--src/comp/syntax/codemap.rs5
-rw-r--r--src/comp/syntax/parse/lexer.rs14
-rw-r--r--src/comp/syntax/print/pp.rs2
-rw-r--r--src/comp/syntax/print/pprust.rs6
-rw-r--r--src/comp/util/ppaux.rs4
-rw-r--r--src/compiletest/errors.rs4
-rw-r--r--src/compiletest/header.rs6
-rw-r--r--src/fuzzer/fuzzer.rs4
-rw-r--r--src/libcore/extfmt.rs8
-rw-r--r--src/libcore/float.rs2
-rw-r--r--src/libcore/str.rs99
-rw-r--r--src/libcore/u64.rs4
-rw-r--r--src/libcore/uint.rs2
-rw-r--r--src/libstd/fs.rs12
-rw-r--r--src/libstd/getopts.rs6
-rw-r--r--src/libstd/json.rs24
-rw-r--r--src/libstd/rand.rs6
-rw-r--r--src/libstd/rope.rs10
-rw-r--r--src/libstd/sha1.rs2
-rw-r--r--src/rustdoc/desc_to_brief_pass.rs2
-rw-r--r--src/rustdoc/unindent_pass.rs4
-rw-r--r--src/test/bench/99bob-iter.rs2
-rw-r--r--src/test/bench/99bob-simple.rs2
-rw-r--r--src/test/bench/shootout-fasta.rs10
-rw-r--r--src/test/run-pass/bind-native-fn.rs2
-rw-r--r--src/test/run-pass/string-self-append.rs4
-rw-r--r--src/test/run-pass/utf8_chars.rs2
34 files changed, 135 insertions, 145 deletions
diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs
index caaedab97c9..4d67877afd8 100644
--- a/src/cargo/cargo.rs
+++ b/src/cargo/cargo.rs
@@ -174,10 +174,10 @@ fn print(s: str) {
 }
 
 fn rest(s: str, start: uint) -> str {
-    if (start >= str::len_bytes(s)) {
+    if (start >= str::len(s)) {
         ""
     } else {
-        str::slice(s, start, str::len_bytes(s))
+        str::slice(s, start, str::len(s))
     }
 }
 
@@ -689,7 +689,7 @@ fn cmd_install(c: cargo) unsafe {
         alt str::index(uuid, '/') {
             option::some(idx) {
                let source = str::slice(uuid, 0u, idx);
-               uuid = str::slice(uuid, idx + 1u, str::len_bytes(uuid));
+               uuid = str::slice(uuid, idx + 1u, str::len(uuid));
                install_uuid_specific(c, wd, source, uuid);
             }
             option::none {
@@ -701,7 +701,7 @@ fn cmd_install(c: cargo) unsafe {
         alt str::index(name, '/') {
             option::some(idx) {
                let source = str::slice(name, 0u, idx);
-               name = str::slice(name, idx + 1u, str::len_bytes(name));
+               name = str::slice(name, idx + 1u, str::len(name));
                install_named_specific(c, wd, source, name);
             }
             option::none {
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs
index 572fde7bd3f..23ddb56c8f0 100644
--- a/src/comp/back/link.rs
+++ b/src/comp/back/link.rs
@@ -395,7 +395,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str,
                               metas: provided_metas,
                               dep_hashes: [str]) -> str {
         fn len_and_str(s: str) -> str {
-            ret #fmt["%u_%s", str::len_bytes(s), s];
+            ret #fmt["%u_%s", str::len(s), s];
         }
 
         fn len_and_str_lit(l: ast::lit) -> str {
@@ -520,7 +520,7 @@ fn mangle(ss: path) -> str {
 
     for s in ss {
         alt s { path_name(s) | path_mod(s) {
-          n += #fmt["%u%s", str::len_bytes(s), s];
+          n += #fmt["%u%s", str::len(s), s];
         } }
     }
     n += "E"; // End name-sequence.
@@ -572,8 +572,7 @@ fn link_binary(sess: session,
                 (config.os == session::os_linux ||
                  config.os == session::os_freebsd) &&
                 option::is_some(found) && option::get(found) == 0u {
-                ret str::slice(filename, 3u,
-                               str::len_bytes(filename));
+                ret str::slice(filename, 3u, str::len(filename));
             } else { ret filename; }
         };
         fn rmext(filename: str) -> str {
diff --git a/src/comp/driver/diagnostic.rs b/src/comp/driver/diagnostic.rs
index f0c97588f59..8f0570a4349 100644
--- a/src/comp/driver/diagnostic.rs
+++ b/src/comp/driver/diagnostic.rs
@@ -210,7 +210,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
     if elided {
         let last_line = display_lines[vec::len(display_lines) - 1u];
         let s = #fmt["%s:%u ", fm.name, last_line + 1u];
-        let indent = str::len_bytes(s);
+        let indent = str::len(s);
         let out = "";
         while indent > 0u { out += " "; indent -= 1u; }
         out += "...\n";
@@ -228,7 +228,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
         while num > 0u { num /= 10u; digits += 1u; }
 
         // indent past |name:## | and the 0-offset column location
-        let left = str::len_bytes(fm.name) + digits + lo.col + 3u;
+        let left = str::len(fm.name) + digits + lo.col + 3u;
         let s = "";
         while left > 0u { str::push_char(s, ' '); left -= 1u; }
 
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index 5186290e4a4..8d0b8549062 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -13,7 +13,7 @@ import rustc::driver::diagnostic;
 fn version(argv0: str) {
     let vers = "unknown version";
     let env_vers = #env["CFG_VERSION"];
-    if str::len_bytes(env_vers) != 0u { vers = env_vers; }
+    if str::len(env_vers) != 0u { vers = env_vers; }
     io::stdout().write_str(#fmt["%s %s\n", argv0, vers]);
     io::stdout().write_str(#fmt["host: %s\n", host_triple()]);
 }
diff --git a/src/comp/middle/trans/common.rs b/src/comp/middle/trans/common.rs
index 24af4e33b9a..1c04bc8c4c6 100644
--- a/src/comp/middle/trans/common.rs
+++ b/src/comp/middle/trans/common.rs
@@ -777,7 +777,7 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i as u64, False); }
 // our boxed-and-length-annotated strings.
 fn C_cstr(cx: crate_ctxt, s: str) -> ValueRef {
     let sc = str::as_buf(s) {|buf|
-        llvm::LLVMConstString(buf, str::len_bytes(s) as unsigned, False)
+        llvm::LLVMConstString(buf, str::len(s) as unsigned, False)
     };
     let g =
         str::as_buf(cx.names("str"),
@@ -791,7 +791,7 @@ fn C_cstr(cx: crate_ctxt, s: str) -> ValueRef {
 // Returns a Plain Old LLVM String:
 fn C_postr(s: str) -> ValueRef {
     ret str::as_buf(s) {|buf|
-        llvm::LLVMConstString(buf, str::len_bytes(s) as unsigned, False)
+        llvm::LLVMConstString(buf, str::len(s) as unsigned, False)
     };
 }
 
diff --git a/src/comp/middle/trans/debuginfo.rs b/src/comp/middle/trans/debuginfo.rs
index dff4f26ae99..47024432b4e 100644
--- a/src/comp/middle/trans/debuginfo.rs
+++ b/src/comp/middle/trans/debuginfo.rs
@@ -48,7 +48,7 @@ const DW_ATE_unsigned_char: int = 0x08;
 
 fn llstr(s: str) -> ValueRef {
     str::as_buf(s, {|sbuf|
-        llvm::LLVMMDString(sbuf, str::len_bytes(s) as ctypes::c_uint)
+        llvm::LLVMMDString(sbuf, str::len(s) as ctypes::c_uint)
     })
 }
 fn lltag(lltag: int) -> ValueRef {
@@ -167,8 +167,7 @@ fn create_compile_unit(cx: crate_ctxt, full_path: str)
 
     let work_dir = cx.sess.working_dir;
     let file_path = if str::starts_with(full_path, work_dir) {
-        str::slice(full_path, str::len_bytes(work_dir),
-                   str::len_bytes(full_path))
+        str::slice(full_path, str::len(work_dir), str::len(full_path))
     } else {
         full_path
     };
diff --git a/src/comp/middle/trans/tvec.rs b/src/comp/middle/trans/tvec.rs
index ab9412263d2..aeaf65db7f4 100644
--- a/src/comp/middle/trans/tvec.rs
+++ b/src/comp/middle/trans/tvec.rs
@@ -126,7 +126,7 @@ fn trans_vec(bcx: block, args: [@ast::expr], id: ast::node_id,
 }
 
 fn trans_str(bcx: block, s: str, dest: dest) -> block {
-    let veclen = str::len_bytes(s) + 1u; // +1 for \0
+    let veclen = str::len(s) + 1u; // +1 for \0
     let {bcx: bcx, val: sptr, _} =
         alloc(bcx, ty::mk_str(bcx.tcx()), veclen);
 
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
index e9b4569df6c..c8b33687abe 100644
--- a/src/comp/syntax/codemap.rs
+++ b/src/comp/syntax/codemap.rs
@@ -157,10 +157,9 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
 
 fn get_line(fm: filemap, line: int) -> str unsafe {
     let begin: uint = fm.lines[line].byte - fm.start_pos.byte;
-    let end = alt str::index_from(*fm.src, '\n', begin,
-                                  str::len_bytes(*fm.src)) {
+    let end = alt str::index_from(*fm.src, '\n', begin, str::len(*fm.src)) {
       some(e) { e }
-      none { str::len_bytes(*fm.src) }
+      none { str::len(*fm.src) }
     };
     str::slice(*fm.src, begin, end)
 }
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index 0328afc9f20..86d925e87e6 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -64,7 +64,7 @@ fn new_reader(cm: codemap::codemap,
               itr: @interner::interner<str>) -> reader {
     let r = @{cm: cm,
               span_diagnostic: span_diagnostic,
-              src: filemap.src, len: str::len_bytes(*filemap.src),
+              src: filemap.src, len: str::len(*filemap.src),
               mutable col: 0u, mutable pos: 0u, mutable curr: -1 as char,
               mutable chpos: filemap.start_pos.ch, mutable strs: [],
               filemap: filemap, interner: itr};
@@ -163,7 +163,7 @@ fn scan_exponent(rdr: reader) -> option<str> {
             rdr.bump();
         }
         let exponent = scan_digits(rdr, 10u);
-        if str::len_bytes(exponent) > 0u {
+        if str::len(exponent) > 0u {
             ret some(rslt + exponent);
         } else { rdr.fatal("scan_exponent: bad fp literal"); }
     } else { ret none::<str>; }
@@ -226,7 +226,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
             tp = if signed { either::left(ast::ty_i64) }
                       else { either::right(ast::ty_u64) };
         }
-        if str::len_bytes(num_str) == 0u {
+        if str::len(num_str) == 0u {
             rdr.fatal("no valid digits found for number");
         }
         let parsed = option::get(u64::from_str(num_str, base as u64));
@@ -273,7 +273,7 @@ fn scan_number(c: char, rdr: reader) -> token::token {
         ret token::LIT_FLOAT(interner::intern(*rdr.interner, num_str),
                              ast::ty_f);
     } else {
-        if str::len_bytes(num_str) == 0u {
+        if str::len(num_str) == 0u {
             rdr.fatal("no valid digits found for number");
         }
         let parsed = option::get(u64::from_str(num_str, base as u64));
@@ -610,8 +610,8 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str],
                                         s: str, col: uint) unsafe {
     let s1;
     if all_whitespace(s, 0u, col) {
-        if col < str::len_bytes(s) {
-            s1 = str::slice(s, col, str::len_bytes(s));
+        if col < str::len(s) {
+            s1 = str::slice(s, col, str::len(s));
         } else { s1 = ""; }
     } else { s1 = s; }
     log(debug, "pushing line: " + s1);
@@ -651,7 +651,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt {
             }
         }
     }
-    if str::len_bytes(curr_line) != 0u {
+    if str::len(curr_line) != 0u {
         trim_whitespace_prefix_and_push_line(lines, curr_line, col);
     }
     let style = if code_to_the_left { trailing } else { isolated };
diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs
index 9114caea2d4..3ee31314299 100644
--- a/src/comp/syntax/print/pp.rs
+++ b/src/comp/syntax/print/pp.rs
@@ -491,7 +491,7 @@ fn end(p: printer) { p.pretty_print(END); }
 fn eof(p: printer) { p.pretty_print(EOF); }
 
 fn word(p: printer, wrd: str) {
-    p.pretty_print(STRING(wrd, str::len_bytes(wrd) as int));
+    p.pretty_print(STRING(wrd, str::len(wrd) as int));
 }
 
 fn huge_word(p: printer, wrd: str) {
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 288d8a38dda..76ab2b4ecb5 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -204,7 +204,7 @@ fn head(s: ps, w: str) {
     // outer-box is consistent
     cbox(s, indent_unit);
     // head-box is inconsistent
-    ibox(s, str::len_bytes(w) + 1u);
+    ibox(s, str::len(w) + 1u);
     // keyword that starts the head
     word_nbsp(s, w);
 }
@@ -1465,7 +1465,7 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
     popen(s);
     fn print_arg(s: ps, input: ast::arg) {
         print_arg_mode(s, input.mode);
-        if str::len_bytes(input.ident) > 0u {
+        if str::len(input.ident) > 0u {
             word_space(s, input.ident + ":");
         }
         print_type(s, input.ty);
@@ -1647,7 +1647,7 @@ fn print_string(s: ps, st: str) {
 
 fn escape_str(st: str, to_escape: char) -> str {
     let out: str = "";
-    let len = str::len_bytes(st);
+    let len = str::len(st);
     let i = 0u;
     while i < len {
         alt st[i] as char {
diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs
index 18bd05f2b8d..0ed630629b7 100644
--- a/src/comp/util/ppaux.rs
+++ b/src/comp/util/ppaux.rs
@@ -129,9 +129,9 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
     }
 }
 
-fn ty_to_short_str(cx: ctxt, typ: t) -> str unsafe {
+fn ty_to_short_str(cx: ctxt, typ: t) -> str {
     let s = encoder::encoded_ty(cx, typ);
-    if str::len_bytes(s) >= 32u { s = str::slice(s, 0u, 32u); }
+    if str::len(s) >= 32u { s = str::slice(s, 0u, 32u); }
     ret s;
 }
 
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 1184fc5f0f2..90b0c7d34e5 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -27,13 +27,13 @@ fn parse_expected(line_num: uint, line: str) -> [expected_error] unsafe {
     let idx;
     alt str::find(line, error_tag) {
          option::none { ret []; }
-         option::some(nn) { idx = (nn as uint) + str::len_bytes(error_tag); }
+         option::some(nn) { idx = (nn as uint) + str::len(error_tag); }
     }
 
     // "//!^^^ kind msg" denotes a message expected
     // three lines above current line:
     let adjust_line = 0u;
-    let len = str::len_bytes(line);
+    let len = str::len(line);
     while idx < len && line[idx] == ('^' as u8) {
         adjust_line += 1u;
         idx += 1u;
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index 8071edad2fe..099598d7fdb 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -108,10 +108,8 @@ fn parse_name_value_directive(line: str,
     let keycolon = directive + ":";
     alt str::find(line, keycolon) {
         option::some(colon) {
-            let value =
-                str::slice(line,
-                                         colon + str::len_bytes(keycolon),
-                                         str::len_bytes(line));
+            let value = str::slice(line, colon + str::len(keycolon),
+                                   str::len(line));
             #debug("%s: %s", directive,  value);
             option::some(value)
         }
diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs
index d6b2cf8b0ec..4b614d1f08b 100644
--- a/src/fuzzer/fuzzer.rs
+++ b/src/fuzzer/fuzzer.rs
@@ -287,7 +287,7 @@ fn check_variants_T<T: copy>(
 
 fn last_part(filename: str) -> str {
   let ix = option::get(str::rindex(filename, '/'));
-  str::slice(filename, ix + 1u, str::len_bytes(filename) - 3u)
+  str::slice(filename, ix + 1u, str::len(filename) - 3u)
 }
 
 enum happiness { passed, cleanly_rejected(str), known_bug(str), failed(str), }
@@ -335,7 +335,7 @@ fn removeDirIfExists(filename: str) {
 fn check_running(exe_filename: str) -> happiness {
     let p = std::run::program_output("/Users/jruderman/scripts/timed_run_rust_program.py", [exe_filename]);
     let comb = p.out + "\n" + p.err;
-    if str::len_bytes(comb) > 1u {
+    if str::len(comb) > 1u {
         log(error, "comb comb comb: " + comb);
     }
 
diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs
index 079451498f1..b5e2eade244 100644
--- a/src/libcore/extfmt.rs
+++ b/src/libcore/extfmt.rs
@@ -82,10 +82,10 @@ mod ct {
 
     fn parse_fmt_string(s: str, error: error_fn) -> [piece] unsafe {
         let pieces: [piece] = [];
-        let lim = str::len_bytes(s);
+        let lim = str::len(s);
         let buf = "";
         fn flush_buf(buf: str, &pieces: [piece]) -> str {
-            if str::len_bytes(buf) > 0u {
+            if str::len(buf) > 0u {
                 let piece = piece_string(buf);
                 pieces += [piece];
             }
@@ -433,12 +433,12 @@ mod rt {
         // zeros. It may make sense to convert zero padding to a precision
         // instead.
 
-        if signed && zero_padding && str::len_bytes(s) > 0u {
+        if signed && zero_padding && str::len(s) > 0u {
             let head = s[0];
             if head == '+' as u8 || head == '-' as u8 || head == ' ' as u8 {
                 let headstr = str::from_bytes([head]);
                 // FIXME: not UTF-8 safe
-                let bytelen = str::len_bytes(s);
+                let bytelen = str::len(s);
                 let numpart = str::slice(s, 1u, bytelen);
                 ret headstr + padstr + numpart;
             }
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index b21d154097f..cea46dedf44 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -133,7 +133,7 @@ number represented by [num].
 fn from_str(num: str) -> option<float> {
    let pos = 0u;                  //Current byte position in the string.
                                   //Used to walk the string in O(n).
-   let len = str::len_bytes(num);  //Length of the string, in bytes.
+   let len = str::len(num);  //Length of the string, in bytes.
 
    if len == 0u { ret none; }
    let total = 0f;                //Accumulated result
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index fb7ec4eec2e..c199ead460f 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -87,7 +87,7 @@ export
    is_empty,
    is_not_empty,
    is_whitespace,
-   len, len_bytes,
+   len,
    len_chars,
 
    // Misc
@@ -277,7 +277,7 @@ Failure:
 If the string does not contain any characters.
 */
 fn pop_char(&s: str) -> char unsafe {
-    let end = len_bytes(s);
+    let end = len(s);
     let {ch:ch, prev:end} = char_range_at_reverse(s, end);
     s = unsafe::slice_bytes(s, 0u, end);
     ret ch;
@@ -294,7 +294,7 @@ If the string does not contain any characters.
 */
 fn shift_char(&s: str) -> char unsafe {
     let r = char_range_at(s, 0u);
-    s = unsafe::slice_bytes(s, r.next, len_bytes(s));
+    s = unsafe::slice_bytes(s, r.next, len(s));
     ret r.ch;
 }
 
@@ -373,7 +373,7 @@ Convert a string to a vector of characters
 fn chars(s: str) -> [char] {
     let buf: [char] = [];
     let i = 0u;
-    let len = len_bytes(s);
+    let len = len(s);
     while i < len {
         let cur = char_range_at(s, i);
         buf += [cur.ch];
@@ -474,7 +474,7 @@ fn splitn_byte(ss: str, sep: u8, count: uint) -> [str] unsafe {
     assert u8::is_ascii(sep);
 
     let vv = [];
-    let start = 0u, current = 0u, len = len_bytes(ss);
+    let start = 0u, current = 0u, len = len(ss);
     let splits_done = 0u;
 
     while splits_done < count && current < len {
@@ -504,7 +504,7 @@ fn split_str(ss: str, sep: str) -> [str] unsafe {
     // unsafe is justified: we are splitting
     // UTF-8 with UTF-8, so the results will be OK
 
-    let sep_len = len_bytes(sep);
+    let sep_len = len(sep);
     assert sep_len > 0u;
     let vv = [];
     let start = 0u, start_match = 0u, current = 0u, matching = 0u;
@@ -581,7 +581,7 @@ up to `count` times
 fn splitn_char(ss: str, sep: char, count: uint) -> [str] unsafe {
 
    let vv = [];
-   let start = 0u, current = 0u, len = len_bytes(ss);
+   let start = 0u, current = 0u, len = len(ss);
    let splits_done = 0u;
 
    while splits_done < count && current < len {
@@ -688,11 +688,11 @@ The original string with all occurances of `from` replaced with `to`
 */
 fn replace(s: str, from: str, to: str) -> str unsafe {
     assert is_not_empty(from);
-    if len_bytes(s) == 0u {
+    if len(s) == 0u {
         ret "";
     } else if starts_with(s, from) {
         ret to + replace(
-                     unsafe::slice_bytes(s, len_bytes(from), len_bytes(s)),
+                     unsafe::slice_bytes(s, len(from), len(s)),
                                        from, to);
     } else {
         let idx;
@@ -701,8 +701,8 @@ fn replace(s: str, from: str, to: str) -> str unsafe {
             none { ret s; }
         }
         let before = unsafe::slice_bytes(s, 0u, idx as uint);
-        let after  = unsafe::slice_bytes(s, idx as uint + len_bytes(from),
-                                         len_bytes(s));
+        let after  = unsafe::slice_bytes(s, idx as uint + len(from),
+                                         len(s));
         ret before + to + replace(after, from, to);
     }
 }
@@ -761,7 +761,7 @@ Return true if a predicate matches all characters or
 if the string contains no characters
 */
 fn all(s: str, it: fn(char) -> bool) -> bool{
-    ret substr_all(s, 0u, len_bytes(s), it);
+    ret substr_all(s, 0u, len(s), it);
 }
 
 /*
@@ -781,7 +781,7 @@ Apply a function to each character
 */
 fn map(ss: str, ff: fn(char) -> char) -> str {
     let result = "";
-    reserve(result, len_bytes(ss));
+    reserve(result, len(ss));
 
     chars_iter(ss, {|cc|
         str::push_char(result, ff(cc));
@@ -797,7 +797,7 @@ Iterate over the bytes in a string
 */
 fn bytes_iter(ss: str, it: fn(u8)) {
     let pos = 0u;
-    let len = len_bytes(ss);
+    let len = len(ss);
 
     while (pos < len) {
         it(ss[pos]);
@@ -811,7 +811,7 @@ Function: chars_iter
 Iterate over the characters in a string
 */
 fn chars_iter(s: str, it: fn(char)) {
-    let pos = 0u, len = len_bytes(s);
+    let pos = 0u, len = len(s);
     while (pos < len) {
         let {ch, next} = char_range_at(s, pos);
         pos = next;
@@ -866,7 +866,7 @@ Section: Searching
 // Returns the byte index of the first matching char
 // (as option some/none)
 fn index(ss: str, cc: char) -> option<uint> {
-    index_from(ss, cc, 0u, len_bytes(ss))
+    index_from(ss, cc, 0u, len(ss))
 }
 
 // Function: index_from
@@ -897,7 +897,7 @@ fn index_from(ss: str, cc: char, start: uint, end: uint) -> option<uint> {
 fn index_chars(ss: str, cc: char) -> option<uint> {
     let bii = 0u;
     let cii = 0u;
-    let len = len_bytes(ss);
+    let len = len(ss);
     while bii < len {
         let {ch, next} = char_range_at(ss, bii);
 
@@ -920,7 +920,7 @@ fn index_chars(ss: str, cc: char) -> option<uint> {
 // (as option some/none)
 // FIXME: delete
 fn byte_index(s: str, b: u8) -> option<uint> {
-    byte_index_from(s, b, 0u, len_bytes(s))
+    byte_index_from(s, b, 0u, len(s))
 }
 
 // Function: byte_index_from
@@ -930,7 +930,7 @@ fn byte_index(s: str, b: u8) -> option<uint> {
 // (as option some/none)
 // FIXME: delete
 fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option<uint> {
-    assert end <= len_bytes(s);
+    assert end <= len(s);
 
     str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } }
 }
@@ -940,7 +940,7 @@ fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option<uint> {
 // Returns the byte index of the first matching char
 // (as option some/none)
 fn rindex(ss: str, cc: char) -> option<uint> {
-    let bii = len_bytes(ss);
+    let bii = len(ss);
     while bii > 0u {
         let {ch, prev} = char_range_at_reverse(ss, bii);
         bii = prev;
@@ -960,7 +960,7 @@ fn rindex(ss: str, cc: char) -> option<uint> {
 // Returns the char index of the first matching char
 // (as option some/none)
 fn rindex_chars(ss: str, cc: char) -> option<uint> {
-    let bii = len_bytes(ss);
+    let bii = len(ss);
     let cii = len_chars(ss);
     while bii > 0u {
         let {ch, prev} = char_range_at_reverse(ss, bii);
@@ -982,7 +982,7 @@ fn rindex_chars(ss: str, cc: char) -> option<uint> {
 // Find the byte position of the first instance of one string
 // within another, or return option::none
 fn find(haystack: str, needle: str) -> option<uint> {
-    find_from(haystack, needle, 0u, len_bytes(haystack))
+    find_from(haystack, needle, 0u, len(haystack))
 }
 
 //Function: find_from
@@ -993,9 +993,9 @@ fn find(haystack: str, needle: str) -> option<uint> {
 // FIXME: Boyer-Moore should be significantly faster
 fn find_from(haystack: str, needle: str, start: uint, end:uint)
   -> option<uint> {
-    assert end <= len_bytes(haystack);
+    assert end <= len(haystack);
 
-    let needle_len = len_bytes(needle);
+    let needle_len = len(needle);
 
     if needle_len == 0u { ret some(start); }
     if needle_len > end { ret none; }
@@ -1031,7 +1031,7 @@ fn find_chars(haystack: str, needle: str) -> option<uint> {
 // Convert a byte position into a char position
 // within a given string
 fn b2c_pos(ss: str, bpos: uint) -> uint {
-   assert bpos == 0u || bpos < len_bytes(ss);
+   assert bpos == 0u || bpos < len(ss);
 
    let ii = 0u;
    let cpos = 0u;
@@ -1070,8 +1070,8 @@ haystack - The string to look in
 needle - The string to look for
 */
 fn starts_with(haystack: str, needle: str) -> bool unsafe {
-    let haystack_len: uint = len_bytes(haystack);
-    let needle_len: uint = len_bytes(needle);
+    let haystack_len: uint = len(haystack);
+    let needle_len: uint = len(needle);
     if needle_len == 0u { ret true; }
     if needle_len > haystack_len { ret false; }
     ret eq(unsafe::slice_bytes(haystack, 0u, needle_len), needle);
@@ -1108,7 +1108,7 @@ Function: is_ascii
 Determines if a string contains only ASCII characters
 */
 fn is_ascii(s: str) -> bool {
-    let i: uint = len_bytes(s);
+    let i: uint = len(s);
     while i > 0u { i -= 1u; if !u8::is_ascii(s[i]) { ret false; } }
     ret true;
 }
@@ -1137,10 +1137,11 @@ fn is_whitespace(s: str) -> bool {
 }
 
 
-// Function: len_bytes
+// Function: len
 //
-// Returns the string length in bytes
-pure fn len_bytes(s: str) -> uint unsafe {
+// Returns the string length/size in bytes
+// not counting the null terminator
+pure fn len(s: str) -> uint unsafe {
     as_bytes(s) { |v|
         let vlen = vec::len(v);
         // There should always be a null terminator
@@ -1149,14 +1150,8 @@ pure fn len_bytes(s: str) -> uint unsafe {
     }
 }
 
-// Function: len
-//
-// String length or size in characters.
-// (Synonym: len_bytes)
-fn len(s: str) -> uint { len_bytes(s) }
-
 fn len_chars(s: str) -> uint {
-    substr_len_chars(s, 0u, len_bytes(s))
+    substr_len_chars(s, 0u, len(s))
 }
 
 /*
@@ -1277,7 +1272,7 @@ This function can be used to iterate over the unicode characters of a string.
 Example:
 > let s = "中华Việt Nam";
 > let i = 0u;
-> while i < str::len_bytes(s) {
+> while i < str::len(s) {
 >    let {ch, next} = str::char_range_at(s, i);
 >    std::io::println(#fmt("%u: %c",i,ch));
 >    i = next;
@@ -1517,7 +1512,7 @@ mod unsafe {
    unsafe fn slice_bytes(s: str, begin: uint, end: uint) -> str unsafe {
        // FIXME: Typestate precondition
        assert (begin <= end);
-       assert (end <= len_bytes(s));
+       assert (end <= len(s));
 
        let v = as_bytes(s) { |v| vec::slice(v, begin, end) };
        v += [0u8];
@@ -1534,7 +1529,7 @@ mod unsafe {
    unsafe fn slice_bytes_safe_range(s: str, begin: uint, end: uint)
        : uint::le(begin, end) -> str {
        // would need some magic to make this a precondition
-       assert (end <= len_bytes(s));
+       assert (end <= len(s));
        ret slice_bytes(s, begin, end);
    }
 
@@ -1556,7 +1551,7 @@ mod unsafe {
    //
    // Removes the last byte from a string and returns it.  (Not UTF-8 safe).
    unsafe fn pop_byte(&s: str) -> u8 unsafe {
-       let len = len_bytes(s);
+       let len = len(s);
        assert (len > 0u);
        let b = s[len - 1u];
        s = unsafe::slice_bytes(s, 0u, len - 1u);
@@ -1567,7 +1562,7 @@ mod unsafe {
    //
    // Removes the first byte from a string and returns it. (Not UTF-8 safe).
    unsafe fn shift_byte(&s: str) -> u8 unsafe {
-       let len = len_bytes(s);
+       let len = len(s);
        assert (len > 0u);
        let b = s[0];
        s = unsafe::slice_bytes(s, 1u, len);
@@ -1597,13 +1592,13 @@ mod tests {
 
     #[test]
     fn test_len() {
-        assert (len_bytes("") == 0u);
-        assert (len_bytes("hello world") == 11u);
-        assert (len_bytes("\x63") == 1u);
-        assert (len_bytes("\xa2") == 2u);
-        assert (len_bytes("\u03c0") == 2u);
-        assert (len_bytes("\u2620") == 3u);
-        assert (len_bytes("\U0001d11e") == 4u);
+        assert (len("") == 0u);
+        assert (len("hello world") == 11u);
+        assert (len("\x63") == 1u);
+        assert (len("\xa2") == 2u);
+        assert (len("\u03c0") == 2u);
+        assert (len("\u2620") == 3u);
+        assert (len("\U0001d11e") == 4u);
 
         assert (len_chars("") == 0u);
         assert (len_chars("hello world") == 11u);
@@ -1906,7 +1901,7 @@ mod tests {
     #[test]
     fn test_substr() {
         fn t(a: str, b: str, start: int) {
-            assert (eq(substr(a, start as uint, len_bytes(b)), b));
+            assert (eq(substr(a, start as uint, len(b)), b));
         }
         t("hello", "llo", 2);
         t("hello", "el", 1);
@@ -2285,7 +2280,7 @@ mod tests {
         let v: [u8] = bytes(s1);
         let s2: str = from_bytes(v);
         let i: uint = 0u;
-        let n1: uint = len_bytes(s1);
+        let n1: uint = len(s1);
         let n2: uint = vec::len::<u8>(v);
         assert (n1 == n2);
         while i < n1 {
diff --git a/src/libcore/u64.rs b/src/libcore/u64.rs
index ac5f83cc415..77b658f0662 100644
--- a/src/libcore/u64.rs
+++ b/src/libcore/u64.rs
@@ -118,8 +118,8 @@ Function: from_str
 Parse a string as an unsigned integer.
 */
 fn from_str(buf: str, radix: u64) -> option<u64> {
-    if str::len_bytes(buf) == 0u { ret none; }
-    let i = str::len_bytes(buf) - 1u;
+    if str::len(buf) == 0u { ret none; }
+    let i = str::len(buf) - 1u;
     let power = 1u64, n = 0u64;
     while true {
         alt char::to_digit(buf[i] as char, radix as uint) {
diff --git a/src/libcore/uint.rs b/src/libcore/uint.rs
index b5e425d2b1d..230c6a2e90c 100644
--- a/src/libcore/uint.rs
+++ b/src/libcore/uint.rs
@@ -248,7 +248,7 @@ fn to_str(num: uint, radix: uint) -> str {
         n /= radix;
     }
     let s1: str = "";
-    let len: uint = str::len_bytes(s);
+    let len: uint = str::len(s);
     while len != 0u { len -= 1u; s1 += str::from_byte(s[len]); }
     ret s1;
 }
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index 167e0f125d6..3ba2f8b105a 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -45,7 +45,7 @@ fn splitDirnameBasename (pp: path) -> {dirname: str, basename: str} {
     }
 
     ret {dirname: str::slice(pp, 0u, ii),
-         basename: str::slice(pp, ii + 1u, str::len_bytes(pp))};
+         basename: str::slice(pp, ii + 1u, str::len(pp))};
 }
 
 /*
@@ -93,8 +93,8 @@ fn connect(pre: path, post: path) -> path unsafe {
     let pre_ = pre;
     let post_ = post;
     let sep = os_fs::path_sep as u8;
-    let pre_len = str::len_bytes(pre);
-    let post_len = str::len_bytes(post);
+    let pre_len  = str::len(pre);
+    let post_len = str::len(post);
     if pre_len > 1u && pre[pre_len-1u] == sep { str::unsafe::pop_byte(pre_); }
     if post_len > 1u && post[0] == sep { str::unsafe::shift_byte(post_); }
     ret pre_ + path_sep() + post_;
@@ -170,7 +170,7 @@ Lists the contents of a directory.
 */
 fn list_dir(p: path) -> [str] {
     let p = p;
-    let pl = str::len_bytes(p);
+    let pl = str::len(p);
     if pl == 0u || p[pl - 1u] as char != os_fs::path_sep { p += path_sep(); }
     let full_paths: [str] = [];
     for filename: str in os_fs::list_dir(p) {
@@ -336,7 +336,7 @@ fn normalize(p: path) -> path {
     let s = reabsolute(p, s);
     let s = reterminate(p, s);
 
-    let s = if str::len_bytes(s) == 0u {
+    let s = if str::len(s) == 0u {
         "."
     } else {
         s
@@ -403,7 +403,7 @@ fn normalize(p: path) -> path {
     }
 
     fn reterminate(orig: path, new: path) -> path {
-        let last = orig[str::len_bytes(orig) - 1u];
+        let last = orig[str::len(orig) - 1u];
         if last == os_fs::path_sep as u8
             || last == os_fs::path_sep as u8 {
             ret new + path_sep();
diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs
index 25681185f9b..7b409053cb0 100644
--- a/src/libstd/getopts.rs
+++ b/src/libstd/getopts.rs
@@ -79,7 +79,7 @@ A description of a possible option
 type opt = {name: name, hasarg: hasarg, occur: occur};
 
 fn mkname(nm: str) -> name {
-    ret if str::len_bytes(nm) == 1u {
+    ret if str::len(nm) == 1u {
             short(str::char_at(nm, 0u))
         } else { long(nm) };
 }
@@ -141,7 +141,7 @@ of matches and a vector of free strings.
 type match = {opts: [opt], vals: [mutable [optval]], free: [str]};
 
 fn is_arg(arg: str) -> bool {
-    ret str::len_bytes(arg) > 1u && arg[0] == '-' as u8;
+    ret str::len(arg) > 1u && arg[0] == '-' as u8;
 }
 
 fn name_str(nm: name) -> str {
@@ -218,7 +218,7 @@ fn getopts(args: [str], opts: [opt]) -> result unsafe {
     let i = 0u;
     while i < l {
         let cur = args[i];
-        let curlen = str::len_bytes(cur);
+        let curlen = str::len(cur);
         if !is_arg(cur) {
             free += [cur];
         } else if str::eq(cur, "--") {
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index 32294f38fb9..7a888f250ed 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -70,13 +70,13 @@ fn to_str(j: json) -> str {
 }
 
 fn rest(s: str) -> str {
-    assert(str::len_bytes(s) >= 1u);
-    str::slice(s, 1u, str::len_bytes(s))
+    assert(str::len(s) >= 1u);
+    str::slice(s, 1u, str::len(s))
 }
 
 fn from_str_str(s: str) -> (option<json>, str) {
     let pos = 0u;
-    let len = str::len_bytes(s);
+    let len = str::len(s);
     let escape = false;
     let res = "";
 
@@ -99,7 +99,7 @@ fn from_str_str(s: str) -> (option<json>, str) {
             cont;
         } else if (c == '"') {
             ret (some(string(res)),
-                 str::slice(s, pos, str::len_bytes(s)));
+                 str::slice(s, pos, str::len(s)));
         }
         res = res + str::from_char(c);
     }
@@ -172,7 +172,7 @@ fn from_str_dict(s: str) -> (option<json>, str) {
 
 fn from_str_float(s: str) -> (option<json>, str) {
     let pos = 0u;
-    let len = str::len_bytes(s);
+    let len = str::len(s);
     let res = 0f;
     let neg = 1f;
 
@@ -200,13 +200,13 @@ fn from_str_float(s: str) -> (option<json>, str) {
             }
             '.' { break; }
             _ { ret (some(num(neg * res)),
-                     str::slice(s, opos, str::len_bytes(s))); }
+                     str::slice(s, opos, str::len(s))); }
         }
     }
 
     if pos == len {
         ret (some(num(neg * res)),
-             str::slice(s, pos, str::len_bytes(s)));
+             str::slice(s, pos, str::len(s)));
     }
 
     let dec = 1f;
@@ -221,17 +221,17 @@ fn from_str_float(s: str) -> (option<json>, str) {
                 res += (((c as int) - ('0' as int)) as float) * dec;
             }
             _ { ret (some(num(neg * res)),
-                     str::slice(s, opos, str::len_bytes(s))); }
+                     str::slice(s, opos, str::len(s))); }
         }
     }
-    ret (some(num(neg * res)), str::slice(s, pos, str::len_bytes(s)));
+    ret (some(num(neg * res)), str::slice(s, pos, str::len(s)));
 }
 
 fn from_str_bool(s: str) -> (option<json>, str) {
     if (str::starts_with(s, "true")) {
-        (some(boolean(true)), str::slice(s, 4u, str::len_bytes(s)))
+        (some(boolean(true)), str::slice(s, 4u, str::len(s)))
     } else if (str::starts_with(s, "false")) {
-        (some(boolean(false)), str::slice(s, 5u, str::len_bytes(s)))
+        (some(boolean(false)), str::slice(s, 5u, str::len(s)))
     } else {
         (none, s)
     }
@@ -239,7 +239,7 @@ fn from_str_bool(s: str) -> (option<json>, str) {
 
 fn from_str_null(s: str) -> (option<json>, str) {
     if (str::starts_with(s, "null")) {
-        (some(null), str::slice(s, 4u, str::len_bytes(s)))
+        (some(null), str::slice(s, 4u, str::len(s)))
     } else {
         (none, s)
     }
diff --git a/src/libstd/rand.rs b/src/libstd/rand.rs
index 33fac40fccc..35525b70710 100644
--- a/src/libstd/rand.rs
+++ b/src/libstd/rand.rs
@@ -77,7 +77,7 @@ fn mk_rng() -> rng {
             let i = 0u;
             while (i < len) {
                 let n = rustrt::rand_next(**self) as uint %
-                    str::len_bytes(charset);
+                    str::len(charset);
                 s = s + str::from_char(str::char_at(charset, n));
                 i += 1u;
             }
@@ -130,8 +130,8 @@ mod tests {
         log(debug, r.gen_str(10u));
         log(debug, r.gen_str(10u));
         log(debug, r.gen_str(10u));
-        assert(str::len_bytes(r.gen_str(10u)) == 10u);
-        assert(str::len_bytes(r.gen_str(16u)) == 16u);
+        assert(str::len(r.gen_str(10u)) == 10u);
+        assert(str::len(r.gen_str(16u)) == 16u);
     }
 }
 
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index 4351ceb2d5a..81800afffa5 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -65,7 +65,7 @@ Performance notes:
 - the function runs in linear time.
  */
 fn of_str(str: @str) -> rope {
-    ret of_substr(str, 0u, str::len_bytes(*str));
+    ret of_substr(str, 0u, str::len(*str));
 }
 
 /*
@@ -93,7 +93,7 @@ Safety notes:
  */
 fn of_substr(str: @str, byte_offset: uint, byte_len: uint) -> rope {
     if byte_len == 0u { ret node::empty; }
-    if byte_offset + byte_len  > str::len_bytes(*str) { fail; }
+    if byte_offset + byte_len  > str::len(*str) { fail; }
     ret node::content(node::of_substr(str, byte_offset, byte_len));
 }
 
@@ -721,7 +721,7 @@ mod node {
     the length of `str`.
      */
     fn of_str(str: @str) -> @node {
-        ret of_substr(str, 0u, str::len_bytes(*str));
+        ret of_substr(str, 0u, str::len(*str));
     }
 
     /*
@@ -768,7 +768,7 @@ mod node {
     */
     fn of_substr_unsafer(str: @str, byte_start: uint, byte_len: uint,
                           char_len: uint) -> @node {
-        assert(byte_start + byte_len <= str::len_bytes(*str));
+        assert(byte_start + byte_len <= str::len(*str));
         let candidate = @leaf({
                 byte_offset: byte_start,
                 byte_len:    byte_len,
@@ -1388,7 +1388,7 @@ mod tests {
         assert rope_to_string(r) == *sample;
 
         let string_iter = 0u;
-        let string_len  = str::len_bytes(*sample);
+        let string_len  = str::len(*sample);
         let rope_iter   = iterator::char::start(r);
         let equal       = true;
         let pos         = 0u;
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs
index 1b63f87f7c6..9360a84fb97 100644
--- a/src/libstd/sha1.rs
+++ b/src/libstd/sha1.rs
@@ -368,7 +368,7 @@ mod tests {
 
         // Test that it works when accepting the message in pieces
         for t: test in tests {
-            let len = str::len_bytes(t.input);
+            let len = str::len(t.input);
             let left = len;
             while left > 0u {
                 let take = (left + 1u) / 2u;
diff --git a/src/rustdoc/desc_to_brief_pass.rs b/src/rustdoc/desc_to_brief_pass.rs
index 82ae2ff8fed..b506f502933 100644
--- a/src/rustdoc/desc_to_brief_pass.rs
+++ b/src/rustdoc/desc_to_brief_pass.rs
@@ -175,7 +175,7 @@ fn parse_desc(desc: str) -> (option<str>, option<str>) {
 
     if check vec::is_not_empty(paras) {
         let maybe_brief = vec::head(paras);
-        if str::len_bytes(maybe_brief) <= max_brief_len {
+        if str::len(maybe_brief) <= max_brief_len {
             let desc_paras = vec::tail(paras);
             let desc = if vec::is_not_empty(desc_paras) {
                 some(str::connect(desc_paras, "\n\n"))
diff --git a/src/rustdoc/unindent_pass.rs b/src/rustdoc/unindent_pass.rs
index 42a3f3fa57a..59005d8266b 100644
--- a/src/rustdoc/unindent_pass.rs
+++ b/src/rustdoc/unindent_pass.rs
@@ -67,8 +67,8 @@ fn unindent(s: str) -> str {
             if str::is_whitespace(line) {
                 line
             } else {
-                assert str::len_bytes(line) >= min_indent;
-                str::slice_chars(line, min_indent, str::len_chars(line))
+                assert str::len(line) >= min_indent;
+                str::slice(line, min_indent, str::len(line))
             }
         };
         str::connect(unindented, "\n")
diff --git a/src/test/bench/99bob-iter.rs b/src/test/bench/99bob-iter.rs
index 0e338ae5c52..6abeb63471f 100644
--- a/src/test/bench/99bob-iter.rs
+++ b/src/test/bench/99bob-iter.rs
@@ -31,7 +31,7 @@ fn sub(t: str, n: int) -> str unsafe {
       1 { ns = "1 bottle"; }
       _ { ns = int::to_str(n, 10u) + " bottles"; }
     }
-    while i < str::len_bytes(t) {
+    while i < str::len(t) {
         if t[i] == '#' as u8 { b += ns; }
         else { str::unsafe::push_byte(b, t[i]); }
         i += 1u;
diff --git a/src/test/bench/99bob-simple.rs b/src/test/bench/99bob-simple.rs
index 351f5463d52..3fcf6abebb1 100644
--- a/src/test/bench/99bob-simple.rs
+++ b/src/test/bench/99bob-simple.rs
@@ -31,7 +31,7 @@ fn sub(t: str, n: int) -> str unsafe {
       1 { ns = "1 bottle"; }
       _ { ns = int::to_str(n, 10u) + " bottles"; }
     }
-    while i < str::len_bytes(t) {
+    while i < str::len(t) {
         if t[i] == '#' as u8 { b += ns; }
         else { str::unsafe::push_byte(b, t[i]); }
         i += 1u;
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index ef82f0742de..28431d3353f 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -49,26 +49,26 @@ fn make_random_fasta(id: str, desc: str, genelist: [aminoacids], n: int) {
     uint::range(0u, n as uint) {|_i|
         str::push_char(op, select_random(myrandom_next(rng, 100u32),
                                          genelist));
-        if str::len_bytes(op) >= LINE_LENGTH() {
+        if str::len(op) >= LINE_LENGTH() {
             log(debug, op);
             op = "";
         }
     }
-    if str::len_bytes(op) > 0u { log(debug, op); }
+    if str::len(op) > 0u { log(debug, op); }
 }
 
 fn make_repeat_fasta(id: str, desc: str, s: str, n: int) unsafe {
     log(debug, ">" + id + " " + desc);
     let op: str = "";
-    let sl: uint = str::len_bytes(s);
+    let sl: uint = str::len(s);
     uint::range(0u, n as uint) {|i|
         str::unsafe::push_byte(op, s[i % sl]);
-        if str::len_bytes(op) >= LINE_LENGTH() {
+        if str::len(op) >= LINE_LENGTH() {
             log(debug, op);
             op = "";
         }
     }
-    if str::len_bytes(op) > 0u { log(debug, op); }
+    if str::len(op) > 0u { log(debug, op); }
 }
 
 fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; }
diff --git a/src/test/run-pass/bind-native-fn.rs b/src/test/run-pass/bind-native-fn.rs
index 88b0fbf4b35..0d839d02200 100644
--- a/src/test/run-pass/bind-native-fn.rs
+++ b/src/test/run-pass/bind-native-fn.rs
@@ -13,7 +13,7 @@ native mod libc {
 fn main() {
     let s = "hello world\n";
     let b = str::bytes(s);
-    let l = str::len_bytes(s);
+    let l = str::len(s);
     let b8 = unsafe { vec::unsafe::to_ptr(b) };
     libc::write(0i32, b8, l);
     let a = bind libc::write(0i32, _, _);
diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs
index 260b0194a0c..c09d6c7cb56 100644
--- a/src/test/run-pass/string-self-append.rs
+++ b/src/test/run-pass/string-self-append.rs
@@ -7,8 +7,8 @@ fn main() {
     let i = 20;
     let expected_len = 1u;
     while i > 0 {
-        log(error, str::len_bytes(a));
-        assert (str::len_bytes(a) == expected_len);
+        log(error, str::len(a));
+        assert (str::len(a) == expected_len);
         a += a;
         i -= 1;
         expected_len *= 2u;
diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs
index fbb66b5a1ca..2d38b9dd245 100644
--- a/src/test/run-pass/utf8_chars.rs
+++ b/src/test/run-pass/utf8_chars.rs
@@ -7,7 +7,7 @@ fn main() {
     let chs: [char] = ['e', 'é', '€', 0x10000 as char];
     let s: str = str::from_chars(chs);
 
-    assert (str::len_bytes(s) == 10u);
+    assert (str::len(s) == 10u);
     assert (str::len_chars(s) == 4u);
     assert (vec::len::<char>(str::chars(s)) == 4u);
     assert (str::eq(str::from_chars(str::chars(s)), s));