about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/rust.md6
-rw-r--r--src/compiletest/errors.rs8
-rw-r--r--src/compiletest/header.rs4
-rw-r--r--src/libextra/getopts.rs2
-rw-r--r--src/libextra/net_tcp.rs2
-rw-r--r--src/libextra/net_url.rs50
-rw-r--r--src/libextra/rope.rs14
-rw-r--r--src/libextra/sha1.rs3
-rw-r--r--src/libextra/time.rs6
-rw-r--r--src/libfuzzer/fuzzer.rc5
-rw-r--r--src/librustc/back/link.rs2
-rw-r--r--src/librustc/metadata/filesearch.rs2
-rw-r--r--src/librustc/middle/lint.rs4
-rw-r--r--src/librustc/middle/resolve.rs4
-rw-r--r--src/librustc/middle/trans/common.rs2
-rw-r--r--src/librustc/middle/trans/debuginfo.rs4
-rw-r--r--src/librustc/util/ppaux.rs2
-rw-r--r--src/librustdoc/desc_to_brief_pass.rs6
-rw-r--r--src/librustdoc/sectionalize_pass.rs2
-rw-r--r--src/librustdoc/unindent_pass.rs4
-rw-r--r--src/libstd/io.rs2
-rw-r--r--src/libstd/os.rs13
-rw-r--r--src/libstd/str.rs196
-rw-r--r--src/libstd/unstable/extfmt.rs2
-rw-r--r--src/libsyntax/codemap.rs6
-rw-r--r--src/libsyntax/diagnostic.rs7
-rw-r--r--src/libsyntax/parse/comments.rs4
-rw-r--r--src/libsyntax/parse/lexer.rs6
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/test/bench/shootout-fasta.rs10
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs2
-rw-r--r--src/test/compile-fail/die-not-static.rs2
-rw-r--r--src/test/run-fail/task-spawn-barefn.rs2
-rw-r--r--src/test/run-pass/string-self-append.rs4
-rw-r--r--src/test/run-pass/utf8_chars.rs2
35 files changed, 185 insertions, 207 deletions
diff --git a/doc/rust.md b/doc/rust.md
index 592bdcf3a3d..6d586c9b201 100644
--- a/doc/rust.md
+++ b/doc/rust.md
@@ -803,7 +803,7 @@ An example of `use` declarations:
 
 ~~~~
 use std::float::sin;
-use std::str::{slice, contains};
+use std::str::{from_chars, contains};
 use std::option::Some;
 
 fn main() {
@@ -814,8 +814,8 @@ fn main() {
     info!(Some(1.0));
 
     // Equivalent to
-    // 'info!(std::str::contains(std::str::slice("foo", 0, 1), "oo"));'
-    info!(contains(slice("foo", 0, 1), "oo"));
+    // 'info!(std::str::contains(std::str::from_chars(&['f','o','o']), "oo"));'
+    info!(contains(from_chars(&['f','o','o']), "oo"));
 }
 ~~~~
 
diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs
index 728548caf77..575df0268d6 100644
--- a/src/compiletest/errors.rs
+++ b/src/compiletest/errors.rs
@@ -33,13 +33,13 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
     let mut idx;
     match str::find_str(line, error_tag) {
       None => return ~[],
-      Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
+      Some(nn) => { idx = (nn as uint) + error_tag.len(); }
     }
 
     // "//~^^^ kind msg" denotes a message expected
     // three lines above current line:
     let mut adjust_line = 0u;
-    let len = str::len(line);
+    let len = line.len();
     while idx < len && line[idx] == ('^' as u8) {
         adjust_line += 1u;
         idx += 1u;
@@ -52,12 +52,12 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
 
     // FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
     // to_ascii_consume and to_str_consume to not do a unnecessary copy.
-    let kind = str::slice(line, start_kind, idx);
+    let kind = line.slice(start_kind, idx);
     let kind = kind.to_ascii().to_lower().to_str_ascii();
 
     // Extract msg:
     while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
-    let msg = str::slice(line, idx, len).to_owned();
+    let msg = line.slice(idx, len).to_owned();
 
     debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
 
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index 153a8de8029..c61adff0063 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -177,8 +177,8 @@ fn parse_name_value_directive(line: &str,
     let keycolon = directive + ":";
     match str::find_str(line, keycolon) {
         Some(colon) => {
-            let value = str::slice(line, colon + str::len(keycolon),
-                                   str::len(line)).to_owned();
+            let value = line.slice(colon + keycolon.len(),
+                                   line.len()).to_owned();
             debug!("%s: %s", directive,  value);
             Some(value)
         }
diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs
index af026473a1b..111de53052c 100644
--- a/src/libextra/getopts.rs
+++ b/src/libextra/getopts.rs
@@ -247,7 +247,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
             let mut names;
             let mut i_arg = None;
             if cur[1] == '-' as u8 {
-                let tail = str::slice(cur, 2, curlen);
+                let tail = cur.slice(2, curlen);
                 let tail_eq: ~[&str] = tail.split_iter('=').collect();
                 if tail_eq.len() <= 1 {
                     names = ~[Long(tail.to_owned())];
diff --git a/src/libextra/net_tcp.rs b/src/libextra/net_tcp.rs
index 87ebfdfb797..9026dc25b2d 100644
--- a/src/libextra/net_tcp.rs
+++ b/src/libextra/net_tcp.rs
@@ -1809,7 +1809,7 @@ mod test {
     }
 
     fn buf_write<W:io::Writer>(w: &W, val: &str) {
-        debug!("BUF_WRITE: val len %?", str::len(val));
+        debug!("BUF_WRITE: val len %?", val.len());
         do str::byte_slice(val) |b_slice| {
             debug!("BUF_WRITE: b_slice len %?",
                             b_slice.len());
diff --git a/src/libextra/net_url.rs b/src/libextra/net_url.rs
index f7e86b00d23..6fd6fa3acd9 100644
--- a/src/libextra/net_url.rs
+++ b/src/libextra/net_url.rs
@@ -291,7 +291,7 @@ pub fn decode_form_urlencoded(s: &[u8]) -> HashMap<~str, ~[~str]> {
 
 
 fn split_char_first(s: &str, c: char) -> (~str, ~str) {
-    let len = str::len(s);
+    let len = s.len();
     let mut index = len;
     let mut mat = 0;
     do io::with_str_reader(s) |rdr| {
@@ -307,16 +307,16 @@ fn split_char_first(s: &str, c: char) -> (~str, ~str) {
         }
     }
     if index+mat == len {
-        return (str::slice(s, 0, index).to_owned(), ~"");
+        return (s.slice(0, index).to_owned(), ~"");
     } else {
-        return (str::slice(s, 0, index).to_owned(),
-             str::slice(s, index + mat, str::len(s)).to_owned());
+        return (s.slice(0, index).to_owned(),
+             s.slice(index + mat, s.len()).to_owned());
     }
 }
 
 fn userinfo_from_str(uinfo: &str) -> UserInfo {
     let (user, p) = split_char_first(uinfo, ':');
-    let pass = if str::len(p) == 0 {
+    let pass = if p.is_empty() {
         None
     } else {
         Some(p)
@@ -333,7 +333,7 @@ fn userinfo_to_str(userinfo: &UserInfo) -> ~str {
 
 fn query_from_str(rawquery: &str) -> Query {
     let mut query: Query = ~[];
-    if str::len(rawquery) != 0 {
+    if !rawquery.is_empty() {
         for rawquery.split_iter('&').advance |p| {
             let (k, v) = split_char_first(p, '=');
             query.push((decode_component(k), decode_component(v)));
@@ -373,7 +373,7 @@ pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> {
                 return Err(~"url: Scheme cannot be empty.");
             } else {
                 return Ok((rawurl.slice(0,i).to_owned(),
-                                rawurl.slice(i+1,str::len(rawurl)).to_owned()));
+                                rawurl.slice(i+1,rawurl.len()).to_owned()));
             }
           }
           _ => {
@@ -475,7 +475,7 @@ fn get_authority(rawurl: &str) ->
               }
               Ip6Host => {
                 if colon_count > 7 {
-                    host = str::slice(rawurl, begin, i).to_owned();
+                    host = rawurl.slice(begin, i).to_owned();
                     pos = i;
                     st = InPort;
                 }
@@ -492,13 +492,13 @@ fn get_authority(rawurl: &str) ->
             colon_count = 0; // reset count
             match st {
               Start => {
-                let user = str::slice(rawurl, begin, i).to_owned();
+                let user = rawurl.slice(begin, i).to_owned();
                 userinfo = Some(UserInfo::new(user, None));
                 st = InHost;
               }
               PassHostPort => {
-                let user = str::slice(rawurl, begin, pos).to_owned();
-                let pass = str::slice(rawurl, pos+1, i).to_owned();
+                let user = rawurl.slice(begin, pos).to_owned();
+                let pass = rawurl.slice(pos+1, i).to_owned();
                 userinfo = Some(UserInfo::new(user, Some(pass)));
                 st = InHost;
               }
@@ -529,31 +529,31 @@ fn get_authority(rawurl: &str) ->
     match st {
       Start => {
         if host_is_end_plus_one() {
-            host = str::slice(rawurl, begin, end+1).to_owned();
+            host = rawurl.slice(begin, end+1).to_owned();
         } else {
-            host = str::slice(rawurl, begin, end).to_owned();
+            host = rawurl.slice(begin, end).to_owned();
         }
       }
       PassHostPort | Ip6Port => {
         if in != Digit {
             return Err(~"Non-digit characters in port.");
         }
-        host = str::slice(rawurl, begin, pos).to_owned();
-        port = Some(str::slice(rawurl, pos+1, end).to_owned());
+        host = rawurl.slice(begin, pos).to_owned();
+        port = Some(rawurl.slice(pos+1, end).to_owned());
       }
       Ip6Host | InHost => {
-        host = str::slice(rawurl, begin, end).to_owned();
+        host = rawurl.slice(begin, end).to_owned();
       }
       InPort => {
         if in != Digit {
             return Err(~"Non-digit characters in port.");
         }
-        port = Some(str::slice(rawurl, pos+1, end).to_owned());
+        port = Some(rawurl.slice(pos+1, end).to_owned());
       }
     }
 
     let rest = if host_is_end_plus_one() { ~"" }
-    else { str::slice(rawurl, end, len).to_owned() };
+    else { rawurl.slice(end, len).to_owned() };
     return Ok((userinfo, host, port, rest));
 }
 
@@ -561,7 +561,7 @@ fn get_authority(rawurl: &str) ->
 // returns the path and unparsed part of url, or an error
 fn get_path(rawurl: &str, authority: bool) ->
     Result<(~str, ~str), ~str> {
-    let len = str::len(rawurl);
+    let len = rawurl.len();
     let mut end = len;
     for rawurl.iter().enumerate().advance |(i,c)| {
         match c {
@@ -585,8 +585,8 @@ fn get_path(rawurl: &str, authority: bool) ->
         }
     }
 
-    return Ok((decode_component(str::slice(rawurl, 0, end)),
-                    str::slice(rawurl, end, len).to_owned()));
+    return Ok((decode_component(rawurl.slice(0, end)),
+                    rawurl.slice(end, len).to_owned()));
 }
 
 // returns the parsed query and the fragment, if present
@@ -594,16 +594,16 @@ fn get_query_fragment(rawurl: &str) ->
     Result<(Query, Option<~str>), ~str> {
     if !str::starts_with(rawurl, "?") {
         if str::starts_with(rawurl, "#") {
-            let f = decode_component(str::slice(rawurl,
+            let f = decode_component(rawurl.slice(
                                                 1,
-                                                str::len(rawurl)));
+                                                rawurl.len()));
             return Ok((~[], Some(f)));
         } else {
             return Ok((~[], None));
         }
     }
-    let (q, r) = split_char_first(str::slice(rawurl, 1, rawurl.len()), '#');
-    let f = if str::len(r) != 0 {
+    let (q, r) = split_char_first(rawurl.slice(1, rawurl.len()), '#');
+    let f = if r.len() != 0 {
         Some(decode_component(r)) } else { None };
     return Ok((query_from_str(q), f));
 }
diff --git a/src/libextra/rope.rs b/src/libextra/rope.rs
index 413a498a20e..1b58aa68f77 100644
--- a/src/libextra/rope.rs
+++ b/src/libextra/rope.rs
@@ -71,7 +71,7 @@ pub fn empty() -> Rope {
  * * the function runs in linear time.
  */
 pub fn of_str(str: @~str) -> Rope {
-    return of_substr(str, 0u, str::len(*str));
+    return of_substr(str, 0u, str.len());
 }
 
 /**
@@ -98,7 +98,7 @@ pub fn of_str(str: @~str) -> Rope {
  */
 pub fn of_substr(str: @~str, byte_offset: uint, byte_len: uint) -> Rope {
     if byte_len == 0u { return node::Empty; }
-    if byte_offset + byte_len  > str::len(*str) { fail!(); }
+    if byte_offset + byte_len  > str.len() { fail!(); }
     return node::Content(node::of_substr(str, byte_offset, byte_len));
 }
 
@@ -657,7 +657,7 @@ pub mod node {
      * the length of `str`.
      */
     pub fn of_str(str: @~str) -> @Node {
-        return of_substr(str, 0u, str::len(*str));
+        return of_substr(str, 0u, str.len());
     }
 
     /**
@@ -705,7 +705,7 @@ pub mod node {
      */
     pub fn of_substr_unsafer(str: @~str, byte_start: uint, byte_len: uint,
                              char_len: uint) -> @Node {
-        assert!((byte_start + byte_len <= str::len(*str)));
+        assert!((byte_start + byte_len <= str.len()));
         let candidate = @Leaf(Leaf {
             byte_offset: byte_start,
             byte_len: byte_len,
@@ -1292,9 +1292,7 @@ mod tests {
                     node::Leaf(x) => {
                         str::push_str(
                             str,
-                            str::slice(
-                                *x.content, x.byte_offset,
-                                x.byte_offset + x.byte_len));
+                            x.content.slice(x.byte_offset, x.byte_offset + x.byte_len));
                     }
                     node::Concat(ref x) => {
                         aux(str, x.left);
@@ -1340,7 +1338,7 @@ mod tests {
         assert!(rope_to_string(r) == *sample);
 
         let mut string_iter = 0u;
-        let string_len = str::len(*sample);
+        let string_len = sample.len();
         let mut rope_iter = iterator::char::start(r);
         let mut equal = true;
         while equal {
diff --git a/src/libextra/sha1.rs b/src/libextra/sha1.rs
index 3ad2e727a5d..658621e25bd 100644
--- a/src/libextra/sha1.rs
+++ b/src/libextra/sha1.rs
@@ -281,7 +281,6 @@ pub fn sha1() -> @Sha1 {
 mod tests {
     use sha1;
 
-    use core::str;
     use core::vec;
 
     #[test]
@@ -396,7 +395,7 @@ mod tests {
 
         // Test that it works when accepting the message in pieces
         for tests.each |t| {
-            let len = str::len(t.input);
+            let len = t.input.len();
             let mut left = len;
             while left > 0u {
                 let take = (left + 1u) / 2u;
diff --git a/src/libextra/time.rs b/src/libextra/time.rs
index e1c78f729a4..f545b28c507 100644
--- a/src/libextra/time.rs
+++ b/src/libextra/time.rs
@@ -279,7 +279,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
             match strs[i] { // can't use let due to stage0 bugs
                 (ref needle, value) => {
                     if match_str(ss, pos, *needle) {
-                        return Some((value, pos + str::len(*needle)));
+                        return Some((value, pos + needle.len()));
                     }
                 }
             }
@@ -598,7 +598,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
                 // It's odd, but to maintain compatibility with c's
                 // strptime we ignore the timezone.
                 let mut pos = pos;
-                let len = str::len(s);
+                let len = s.len();
                 while pos < len {
                     let range = str::char_range_at(s, pos);
                     pos = range.next;
@@ -651,7 +651,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
             tm_nsec: 0_i32,
         };
         let mut pos = 0u;
-        let len = str::len(s);
+        let len = s.len();
         let mut result = Err(~"Invalid time");
 
         while !rdr.eof() && pos < len {
diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc
index 4e285e686df..bd72f0891dd 100644
--- a/src/libfuzzer/fuzzer.rc
+++ b/src/libfuzzer/fuzzer.rc
@@ -376,7 +376,7 @@ pub fn check_variants_T<T:Copy>(crate: @ast::crate,
 
 pub fn last_part(filename: ~str) -> ~str {
     let ix = str::rfind_char(filename, '/').get();
-    str::slice(filename, ix + 1u, str::len(filename) - 3u).to_owned()
+    filename.slice(ix + 1u, filename.len() - 3u).to_owned()
 }
 
 pub enum happiness {
@@ -434,7 +434,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
         "/Users/jruderman/scripts/timed_run_rust_program.py",
         [exe_filename.to_str()]);
     let comb = str::from_bytes(p.output) + "\n" + str::from_bytes(p.error);
-    if str::len(comb) > 1u {
+    if comb.len() > 1u {
         error!("comb comb comb: %?", comb);
     }
 
@@ -712,4 +712,3 @@ pub mod core {
     pub use std::cmp;
     pub use std::sys;
 }
-
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 29e7ba0e62f..fa9e2c9a724 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -686,7 +686,7 @@ pub fn mangle(sess: Session, ss: path) -> ~str {
     for ss.each |s| {
         match *s { path_name(s) | path_mod(s) => {
           let sani = sanitize(*sess.str_of(s));
-          n += fmt!("%u%s", str::len(sani), sani);
+          n += fmt!("%u%s", sani.len(), sani);
         } }
     }
     n += "E"; // End name-sequence.
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index f83d33dcb3c..6314cb62697 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -186,7 +186,7 @@ fn get_rustpkg_lib_path_nearest() -> Result<Path, ~str> {
 // On Unix should be "lib", on windows "bin"
 pub fn libdir() -> ~str {
    let libdir = env!("CFG_LIBDIR");
-   if str::is_empty(libdir) {
+   if libdir.is_empty() {
       fail!("rustc compiled without CFG_LIBDIR environment variable");
    }
    libdir.to_owned()
diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs
index 703516251dc..74e001f4e13 100644
--- a/src/librustc/middle/lint.rs
+++ b/src/librustc/middle/lint.rs
@@ -849,14 +849,14 @@ fn check_item_non_camel_case_types(cx: &Context, it: @ast::item) {
 
     fn ident_without_trailing_underscores<'r>(ident: &'r str) -> &'r str {
         match str::rfind(ident, |c| c != '_') {
-            Some(idx) => str::slice(ident, 0, idx + 1),
+            Some(idx) => ident.slice(0, idx + 1),
             None => ident, // all underscores
         }
     }
 
     fn ident_without_leading_underscores<'r>(ident: &'r str) -> &'r str {
         match str::find(ident, |c| c != '_') {
-            Some(idx) => str::slice(ident, idx, ident.len()),
+            Some(idx) => ident.slice(idx, ident.len()),
             None => ident // all underscores
         }
     }
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 2d2eeff199f..25736afd38a 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -2575,7 +2575,7 @@ impl Resolver {
                     if "???" == module_name {
                         let span = span {
                             lo: span.lo,
-                            hi: span.lo + BytePos(str::len(*segment_name)),
+                            hi: span.lo + BytePos(segment_name.len()),
                             expn_info: span.expn_info,
                         };
                         self.session.span_err(span,
@@ -4830,7 +4830,7 @@ impl Resolver {
 
         if values.len() > 0 &&
             values[smallest] != uint::max_value &&
-            values[smallest] < str::len(name) + 2 &&
+            values[smallest] < name.len() + 2 &&
             values[smallest] <= max_distance &&
             maybes[smallest] != name.to_owned() {
 
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 78aca4c831f..03ae32cf0a6 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -1221,7 +1221,7 @@ pub fn C_estr_slice(cx: @CrateContext, s: @~str) -> ValueRef {
 pub fn C_postr(s: &str) -> ValueRef {
     unsafe {
         return do str::as_c_str(s) |buf| {
-            llvm::LLVMConstString(buf, str::len(s) as c_uint, False)
+            llvm::LLVMConstString(buf, s.len() as c_uint, False)
         };
     }
 }
diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs
index 5f475f1bb9d..bc863fb363f 100644
--- a/src/librustc/middle/trans/debuginfo.rs
+++ b/src/librustc/middle/trans/debuginfo.rs
@@ -245,8 +245,8 @@ fn get_cache(cx: @CrateContext) -> metadata_cache {
 
 fn get_file_path_and_dir(work_dir: &str, full_path: &str) -> (~str, ~str) {
     (if str::starts_with(full_path, work_dir) {
-        str::slice(full_path, str::len(work_dir) + 1u,
-                   str::len(full_path)).to_owned()
+        full_path.slice(work_dir.len() + 1u,
+                   full_path.len()).to_owned()
     } else {
         full_path.to_owned()
     }, work_dir.to_owned())
diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs
index d4f1e42d5ff..c72bf5c7f0b 100644
--- a/src/librustc/util/ppaux.rs
+++ b/src/librustc/util/ppaux.rs
@@ -485,7 +485,7 @@ pub fn parameterized(cx: ctxt,
 
 pub fn ty_to_short_str(cx: ctxt, typ: t) -> ~str {
     let mut s = encoder::encoded_ty(cx, typ);
-    if str::len(s) >= 32u { s = str::slice(s, 0u, 32u).to_owned(); }
+    if s.len() >= 32u { s = s.slice(0u, 32u).to_owned(); }
     return s;
 }
 
diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs
index 24ade927be2..f66012696ae 100644
--- a/src/librustdoc/desc_to_brief_pass.rs
+++ b/src/librustdoc/desc_to_brief_pass.rs
@@ -94,7 +94,7 @@ fn parse_desc(desc: ~str) -> Option<~str> {
 
     match first_sentence(copy desc) {
       Some(first_sentence) => {
-        if str::len(first_sentence) <= max_brief_len {
+        if first_sentence.len() <= max_brief_len {
             Some(first_sentence)
         } else {
             None
@@ -133,7 +133,7 @@ fn first_sentence_(s: &str) -> ~str {
     };
     match idx {
         Some(idx) if idx > 2u => {
-            str::to_owned(str::slice(s, 0, idx - 1))
+            str::to_owned(s.slice(0, idx - 1))
         }
         _ => {
             if str::ends_with(s, ".") {
@@ -165,7 +165,7 @@ pub fn paragraphs(s: &str) -> ~[~str] {
 
             whitespace_lines = 0;
 
-            accum = if str::is_empty(accum) {
+            accum = if accum.is_empty() {
                 copy *line
             } else {
                 accum + "\n" + *line
diff --git a/src/librustdoc/sectionalize_pass.rs b/src/librustdoc/sectionalize_pass.rs
index 75f8e22f67e..61a8d11af7f 100644
--- a/src/librustdoc/sectionalize_pass.rs
+++ b/src/librustdoc/sectionalize_pass.rs
@@ -154,7 +154,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
 
 fn parse_header(line: ~str) -> Option<~str> {
     if str::starts_with(line, "# ") {
-        Some(str::slice(line, 2u, str::len(line)).to_owned())
+        Some(line.slice(2u, line.len()).to_owned())
     } else {
         None
     }
diff --git a/src/librustdoc/unindent_pass.rs b/src/librustdoc/unindent_pass.rs
index 6bb5b2e0cfc..ba6f7184f68 100644
--- a/src/librustdoc/unindent_pass.rs
+++ b/src/librustdoc/unindent_pass.rs
@@ -83,8 +83,8 @@ fn unindent(s: &str) -> ~str {
             if str::is_whitespace(*line) {
                 copy *line
             } else {
-                assert!(str::len(*line) >= min_indent);
-                str::slice(*line, min_indent, str::len(*line)).to_owned()
+                assert!(line.len() >= min_indent);
+                line.slice(min_indent, line.len()).to_owned()
             }
         };
         str::connect(unindented, "\n")
diff --git a/src/libstd/io.rs b/src/libstd/io.rs
index e3977ca0067..8ec3a4cdd81 100644
--- a/src/libstd/io.rs
+++ b/src/libstd/io.rs
@@ -748,7 +748,7 @@ impl<T:Reader> ReaderUtil for T {
             if self.eof() && line.is_empty() { break; }
 
             // trim the \n, so that each_line is consistent with read_line
-            let n = str::len(line);
+            let n = line.len();
             if line[n-1] == '\n' as u8 {
                 unsafe { str::raw::set_len(&mut line, n-1); }
             }
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 2069e61f11e..ab8965a6796 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -525,7 +525,7 @@ pub fn self_exe_path() -> Option<Path> {
  */
 pub fn homedir() -> Option<Path> {
     return match getenv("HOME") {
-        Some(ref p) => if !str::is_empty(*p) {
+        Some(ref p) => if !p.is_empty() {
           Some(Path(*p))
         } else {
           secondary()
@@ -541,7 +541,7 @@ pub fn homedir() -> Option<Path> {
     #[cfg(windows)]
     fn secondary() -> Option<Path> {
         do getenv(~"USERPROFILE").chain |p| {
-            if !str::is_empty(p) {
+            if !p.is_empty() {
                 Some(Path(p))
             } else {
                 None
@@ -566,7 +566,7 @@ pub fn tmpdir() -> Path {
     fn getenv_nonempty(v: &str) -> Option<Path> {
         match getenv(v) {
             Some(x) =>
-                if str::is_empty(x) {
+                if x.is_empty() {
                     None
                 } else {
                     Some(Path(x))
@@ -1449,6 +1449,7 @@ mod tests {
     use rand;
     use run;
     use str;
+    use str::StrSlice;
     use vec;
     use libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
 
@@ -1606,7 +1607,7 @@ mod tests {
 
     #[test]
     fn tmpdir() {
-        assert!(!str::is_empty(os::tmpdir().to_str()));
+        assert!(!os::tmpdir().to_str().is_empty());
     }
 
     // Issue #712
@@ -1671,7 +1672,7 @@ mod tests {
         unsafe {
           let tempdir = getcwd(); // would like to use $TMPDIR,
                                   // doesn't seem to work on Linux
-          assert!((str::len(tempdir.to_str()) > 0u));
+          assert!((tempdir.to_str().len() > 0u));
           let in = tempdir.push("in.txt");
           let out = tempdir.push("out.txt");
 
@@ -1686,7 +1687,7 @@ mod tests {
           let mut buf = str::to_bytes(s) + [0 as u8];
           do vec::as_mut_buf(buf) |b, _len| {
               assert!((libc::fwrite(b as *c_void, 1u as size_t,
-                                   (str::len(s) + 1u) as size_t, ostream)
+                                   (s.len() + 1u) as size_t, ostream)
                       == buf.len() as size_t))
           }
           assert_eq!(libc::fclose(ostream), (0u as c_int));
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 09ea6a5dfa9..b44e79f7d03 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -110,7 +110,7 @@ pub fn from_bytes_slice<'a>(vector: &'a [u8]) -> &'a str {
 /// Copy a slice into a new unique str
 #[inline(always)]
 pub fn to_owned(s: &str) -> ~str {
-    unsafe { raw::slice_bytes_owned(s, 0, len(s)) }
+    unsafe { raw::slice_bytes_owned(s, 0, s.len()) }
 }
 
 impl ToStr for ~str {
@@ -148,7 +148,7 @@ pub fn push_char(s: &mut ~str, ch: char) {
         else if code < max_four_b { 4u }
         else if code < max_five_b { 5u }
         else { 6u };
-        let len = len(*s);
+        let len = s.len();
         let new_len = len + nb;
         reserve_at_least(&mut *s, new_len);
         let off = len;
@@ -453,7 +453,7 @@ Section: Adding to and removing from a string
  * If the string does not contain any characters
  */
 pub fn pop_char(s: &mut ~str) -> char {
-    let end = len(*s);
+    let end = s.len();
     assert!(end > 0u);
     let CharRange {ch, next} = char_range_at_reverse(*s, end);
     unsafe { raw::set_len(s, next); }
@@ -469,7 +469,7 @@ pub fn pop_char(s: &mut ~str) -> char {
  */
 pub fn shift_char(s: &mut ~str) -> char {
     let CharRange {ch, next} = char_range_at(*s, 0u);
-    *s = unsafe { raw::slice_bytes_owned(*s, next, len(*s)) };
+    *s = unsafe { raw::slice_bytes_owned(*s, next, s.len()) };
     return ch;
 }
 
@@ -485,7 +485,7 @@ pub fn shift_char(s: &mut ~str) -> char {
 #[inline]
 pub fn slice_shift_char<'a>(s: &'a str) -> (char, &'a str) {
     let CharRange {ch, next} = char_range_at(s, 0u);
-    let next_s = unsafe { raw::slice_bytes(s, next, len(s)) };
+    let next_s = unsafe { raw::slice_bytes(s, next, s.len()) };
     return (ch, next_s);
 }
 
@@ -554,7 +554,7 @@ pub fn trim_chars<'a>(s: &'a str, chars_to_trim: &[char]) -> &'a str {
 pub fn trim_left<'a>(s: &'a str) -> &'a str {
     match find(s, |c| !char::is_whitespace(c)) {
       None => "",
-      Some(first) => unsafe { raw::slice_bytes(s, first, len(s)) }
+      Some(first) => unsafe { raw::slice_bytes(s, first, s.len()) }
     }
 }
 
@@ -584,7 +584,7 @@ Section: Transforming strings
 pub fn to_bytes(s: &str) -> ~[u8] {
     unsafe {
         let mut v: ~[u8] = ::cast::transmute(to_owned(s));
-        vec::raw::set_len(&mut v, len(s));
+        vec::raw::set_len(&mut v, s.len());
         v
     }
 }
@@ -618,19 +618,7 @@ pub fn to_chars(s: &str) -> ~[char] {
  * `begin`.
  */
 pub fn substr<'a>(s: &'a str, begin: uint, n: uint) -> &'a str {
-    slice(s, begin, begin + count_bytes(s, begin, n))
-}
-
-/**
- * Returns a slice of the given string from the byte range [`begin`..`end`)
- *
- * Fails when `begin` and `end` do not point to valid characters or beyond
- * the last character of the string
- */
-pub fn slice<'a>(s: &'a str, begin: uint, end: uint) -> &'a str {
-    assert!(is_char_boundary(s, begin));
-    assert!(is_char_boundary(s, end));
-    unsafe { raw::slice_bytes(s, begin, end) }
+    s.slice(begin, begin + count_bytes(s, begin, n))
 }
 
 /// An iterator over the substrings of a string, separated by `sep`.
@@ -724,7 +712,7 @@ impl<'self, Sep: StrCharSplitSeparator> Iterator<&'self str> for StrCharSplitIte
 // See Issue #1932 for why this is a naive search
 fn iter_matches<'a,'b>(s: &'a str, sep: &'b str,
                        f: &fn(uint, uint) -> bool) -> bool {
-    let (sep_len, l) = (len(sep), len(s));
+    let (sep_len, l) = (sep.len(), s.len());
     assert!(sep_len > 0u);
     let mut (i, match_start, match_i) = (0u, 0u, 0u);
 
@@ -759,7 +747,7 @@ fn iter_between_matches<'a,'b>(s: &'a str,
         if !f(last_end, from) { return false; }
         last_end = to;
     }
-    return f(last_end, len(s));
+    return f(last_end, s.len());
 }
 
 /**
@@ -889,7 +877,7 @@ pub fn each_split_within<'a>(ss: &'a str,
     let mut state = A;
 
     let mut cont = true;
-    let slice: &fn() = || { cont = it(slice(ss, slice_start, last_end)) };
+    let slice: &fn() = || { cont = it(ss.slice(slice_start, last_end)) };
 
     let machine: &fn((uint, char)) -> bool = |(i, c)| {
         let whitespace = if char::is_whitespace(c)       { Ws }       else { Cr };
@@ -902,7 +890,7 @@ pub fn each_split_within<'a>(ss: &'a str,
             (B, Cr, UnderLim) => { B }
             (B, Cr, OverLim)  if (i - last_start + 1) > lim
                               => fail!("word starting with %? longer than limit!",
-                                       self::slice(ss, last_start, i + 1)),
+                                       ss.slice(last_start, i + 1)),
             (B, Cr, OverLim)  => { slice(); slice_start = last_start; B }
             (B, Ws, UnderLim) => { last_end = i; C }
             (B, Ws, OverLim)  => { last_end = i; slice(); A }
@@ -1178,7 +1166,7 @@ Section: Iterating through strings
 /// Apply a function to each character
 pub fn map(ss: &str, ff: &fn(char) -> char) -> ~str {
     let mut result = ~"";
-    reserve(&mut result, len(ss));
+    reserve(&mut result, ss.len());
     for ss.iter().advance |cc| {
         str::push_char(&mut result, ff(cc));
     }
@@ -1203,7 +1191,7 @@ Section: Searching
  * or `none` if there is no match
  */
 pub fn find_char(s: &str, c: char) -> Option<uint> {
-    find_char_between(s, c, 0u, len(s))
+    find_char_between(s, c, 0u, s.len())
 }
 
 /**
@@ -1223,11 +1211,11 @@ pub fn find_char(s: &str, c: char) -> Option<uint> {
  *
  * # Failure
  *
- * `start` must be less than or equal to `len(s)`. `start` must be the
+ * `start` must be less than or equal to `s.len()`. `start` must be the
  * index of a character boundary, as defined by `is_char_boundary`.
  */
 pub fn find_char_from(s: &str, c: char, start: uint) -> Option<uint> {
-    find_char_between(s, c, start, len(s))
+    find_char_between(s, c, start, s.len())
 }
 
 /**
@@ -1248,14 +1236,14 @@ pub fn find_char_from(s: &str, c: char, start: uint) -> Option<uint> {
  * # Failure
  *
  * `start` must be less than or equal to `end` and `end` must be less than
- * or equal to `len(s)`. `start` must be the index of a character boundary,
+ * or equal to `s.len()`. `start` must be the index of a character boundary,
  * as defined by `is_char_boundary`.
  */
 pub fn find_char_between(s: &str, c: char, start: uint, end: uint)
     -> Option<uint> {
     if c < 128u as char {
         assert!(start <= end);
-        assert!(end <= len(s));
+        assert!(end <= s.len());
         let mut i = start;
         let b = c as u8;
         while i < end {
@@ -1282,7 +1270,7 @@ pub fn find_char_between(s: &str, c: char, start: uint, end: uint)
  * or `none` if there is no match
  */
 pub fn rfind_char(s: &str, c: char) -> Option<uint> {
-    rfind_char_between(s, c, len(s), 0u)
+    rfind_char_between(s, c, s.len(), 0u)
 }
 
 /**
@@ -1302,7 +1290,7 @@ pub fn rfind_char(s: &str, c: char) -> Option<uint> {
  *
  * # Failure
  *
- * `start` must be less than or equal to `len(s)`. `start` must be
+ * `start` must be less than or equal to `s.len()`. `start` must be
  * the index of a character boundary, as defined by `is_char_boundary`.
  */
 pub fn rfind_char_from(s: &str, c: char, start: uint) -> Option<uint> {
@@ -1327,13 +1315,13 @@ pub fn rfind_char_from(s: &str, c: char, start: uint) -> Option<uint> {
  * # Failure
  *
  * `end` must be less than or equal to `start` and `start` must be less than
- * or equal to `len(s)`. `start` must be the index of a character boundary,
+ * or equal to `s.len()`. `start` must be the index of a character boundary,
  * as defined by `is_char_boundary`.
  */
 pub fn rfind_char_between(s: &str, c: char, start: uint, end: uint) -> Option<uint> {
     if c < 128u as char {
         assert!(start >= end);
-        assert!(start <= len(s));
+        assert!(start <= s.len());
         let mut i = start;
         let b = c as u8;
         while i > end {
@@ -1361,7 +1349,7 @@ pub fn rfind_char_between(s: &str, c: char, start: uint, end: uint) -> Option<ui
  * or `none` if there is no match
  */
 pub fn find(s: &str, f: &fn(char) -> bool) -> Option<uint> {
-    find_between(s, 0u, len(s), f)
+    find_between(s, 0u, s.len(), f)
 }
 
 /**
@@ -1381,12 +1369,12 @@ pub fn find(s: &str, f: &fn(char) -> bool) -> Option<uint> {
  *
  * # Failure
  *
- * `start` must be less than or equal to `len(s)`. `start` must be the
+ * `start` must be less than or equal to `s.len()`. `start` must be the
  * index of a character boundary, as defined by `is_char_boundary`.
  */
 pub fn find_from(s: &str, start: uint, f: &fn(char)
     -> bool) -> Option<uint> {
-    find_between(s, start, len(s), f)
+    find_between(s, start, s.len(), f)
 }
 
 /**
@@ -1408,12 +1396,12 @@ pub fn find_from(s: &str, start: uint, f: &fn(char)
  * # Failure
  *
  * `start` must be less than or equal to `end` and `end` must be less than
- * or equal to `len(s)`. `start` must be the index of a character
+ * or equal to `s.len()`. `start` must be the index of a character
  * boundary, as defined by `is_char_boundary`.
  */
 pub fn find_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool) -> Option<uint> {
     assert!(start <= end);
-    assert!(end <= len(s));
+    assert!(end <= s.len());
     assert!(is_char_boundary(s, start));
     let mut i = start;
     while i < end {
@@ -1439,7 +1427,7 @@ pub fn find_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool) -> Op
  * or `none` if there is no match
  */
 pub fn rfind(s: &str, f: &fn(char) -> bool) -> Option<uint> {
-    rfind_between(s, len(s), 0u, f)
+    rfind_between(s, s.len(), 0u, f)
 }
 
 /**
@@ -1459,7 +1447,7 @@ pub fn rfind(s: &str, f: &fn(char) -> bool) -> Option<uint> {
  *
  * # Failure
  *
- * `start` must be less than or equal to `len(s)', `start` must be the
+ * `start` must be less than or equal to `s.len()', `start` must be the
  * index of a character boundary, as defined by `is_char_boundary`
  */
 pub fn rfind_from(s: &str, start: uint, f: &fn(char) -> bool) -> Option<uint> {
@@ -1485,12 +1473,12 @@ pub fn rfind_from(s: &str, start: uint, f: &fn(char) -> bool) -> Option<uint> {
  * # Failure
  *
  * `end` must be less than or equal to `start` and `start` must be less
- * than or equal to `len(s)`. `start` must be the index of a character
+ * than or equal to `s.len()`. `start` must be the index of a character
  * boundary, as defined by `is_char_boundary`
  */
 pub fn rfind_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool) -> Option<uint> {
     assert!(start >= end);
-    assert!(start <= len(s));
+    assert!(start <= s.len());
     assert!(is_char_boundary(s, start));
     let mut i = start;
     while i > end {
@@ -1522,7 +1510,7 @@ fn match_at<'a,'b>(haystack: &'a str, needle: &'b str, at: uint) -> bool {
  * or `none` if there is no match
  */
 pub fn find_str<'a,'b>(haystack: &'a str, needle: &'b str) -> Option<uint> {
-    find_str_between(haystack, needle, 0u, len(haystack))
+    find_str_between(haystack, needle, 0u, haystack.len())
 }
 
 /**
@@ -1542,13 +1530,13 @@ pub fn find_str<'a,'b>(haystack: &'a str, needle: &'b str) -> Option<uint> {
  *
  * # Failure
  *
- * `start` must be less than or equal to `len(s)`
+ * `start` must be less than or equal to `s.len()`
  */
 pub fn find_str_from<'a,'b>(haystack: &'a str,
                             needle: &'b str,
                             start: uint)
                          -> Option<uint> {
-    find_str_between(haystack, needle, start, len(haystack))
+    find_str_between(haystack, needle, start, haystack.len())
 }
 
 /**
@@ -1569,7 +1557,7 @@ pub fn find_str_from<'a,'b>(haystack: &'a str,
  * # Failure
  *
  * `start` must be less than or equal to `end` and `end` must be less than
- * or equal to `len(s)`.
+ * or equal to `s.len()`.
  */
 pub fn find_str_between<'a,'b>(haystack: &'a str,
                                needle: &'b str,
@@ -1577,8 +1565,8 @@ pub fn find_str_between<'a,'b>(haystack: &'a str,
                                end:uint)
                             -> Option<uint> {
     // See Issue #1932 for why this is a naive search
-    assert!(end <= len(haystack));
-    let needle_len = len(needle);
+    assert!(end <= haystack.len());
+    let needle_len = needle.len();
     if needle_len == 0u { return Some(start); }
     if needle_len > end { return None; }
 
@@ -1624,7 +1612,7 @@ pub fn contains_char(haystack: &str, needle: char) -> bool {
  * * needle - The string to look for
  */
 pub fn starts_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
-    let (haystack_len, needle_len) = (len(haystack), len(needle));
+    let (haystack_len, needle_len) = (haystack.len(), needle.len());
     if needle_len == 0u { true }
     else if needle_len > haystack_len { false }
     else { match_at(haystack, needle, 0u) }
@@ -1639,7 +1627,7 @@ pub fn starts_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
  * * needle - The string to look for
  */
 pub fn ends_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
-    let (haystack_len, needle_len) = (len(haystack), len(needle));
+    let (haystack_len, needle_len) = (haystack.len(), needle.len());
     if needle_len == 0u { true }
     else if needle_len > haystack_len { false }
     else { match_at(haystack, needle, haystack_len - needle_len) }
@@ -1649,10 +1637,6 @@ pub fn ends_with<'a,'b>(haystack: &'a str, needle: &'b str) -> bool {
 Section: String properties
 */
 
-/// Returns true if the string has length 0
-#[inline(always)]
-pub fn is_empty(s: &str) -> bool { len(s) == 0u }
-
 /**
  * Returns true if the string contains only whitespace
  *
@@ -1671,15 +1655,9 @@ fn is_alphanumeric(s: &str) -> bool {
     s.iter().all(char::is_alphanumeric)
 }
 
-/// Returns the string length/size in bytes not counting the null terminator
-#[inline(always)]
-pub fn len(s: &str) -> uint {
-    do as_buf(s) |_p, n| { n - 1u }
-}
-
 /// Returns the number of characters that a string holds
 #[inline(always)]
-pub fn char_len(s: &str) -> uint { count_chars(s, 0u, len(s)) }
+pub fn char_len(s: &str) -> uint { count_chars(s, 0u, s.len()) }
 
 /*
 Section: Misc
@@ -1828,7 +1806,7 @@ pub fn count_chars(s: &str, start: uint, end: uint) -> uint {
 pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
     assert!(is_char_boundary(s, start));
     let mut (end, cnt) = (start, n);
-    let l = len(s);
+    let l = s.len();
     while cnt > 0u {
         assert!(end < l);
         let next = char_range_at(s, end).next;
@@ -1856,7 +1834,7 @@ pub fn utf8_char_width(b: u8) -> uint {
  * character sequence.
  */
 pub fn is_char_boundary(s: &str, index: uint) -> bool {
-    if index == len(s) { return true; }
+    if index == s.len() { return true; }
     let b = s[index];
     return b < 128u8 || b >= 192u8;
 }
@@ -1873,7 +1851,7 @@ pub fn is_char_boundary(s: &str, index: uint) -> bool {
  * ~~~ {.rust}
  * let s = "中华Việt Nam";
  * let i = 0u;
- * while i < str::len(s) {
+ * while i < s.len() {
  *     let CharRange {ch, next} = str::char_range_at(s, i);
  *     std::io::println(fmt!("%u: %c",i,ch));
  *     i = next;
@@ -2242,7 +2220,7 @@ pub fn capacity(s: &const ~str) -> uint {
 /// Escape each char in `s` with char::escape_default.
 pub fn escape_default(s: &str) -> ~str {
     let mut out: ~str = ~"";
-    reserve_at_least(&mut out, str::len(s));
+    reserve_at_least(&mut out, s.len());
     for s.iter().advance |c| {
         push_str(&mut out, char::escape_default(c));
     }
@@ -2252,7 +2230,7 @@ pub fn escape_default(s: &str) -> ~str {
 /// Escape each char in `s` with char::escape_unicode.
 pub fn escape_unicode(s: &str) -> ~str {
     let mut out: ~str = ~"";
-    reserve_at_least(&mut out, str::len(s));
+    reserve_at_least(&mut out, s.len());
     for s.iter().advance |c| {
         push_str(&mut out, char::escape_unicode(c));
     }
@@ -2265,7 +2243,7 @@ pub mod raw {
     use libc;
     use ptr;
     use str::raw;
-    use str::{as_buf, is_utf8, len, reserve_at_least};
+    use str::{as_buf, is_utf8, reserve_at_least};
     use vec;
 
     /// Create a Rust string from a null-terminated *u8 buffer
@@ -2394,7 +2372,7 @@ pub mod raw {
 
     /// Removes the last byte from a string and returns it. (Not UTF-8 safe).
     pub unsafe fn pop_byte(s: &mut ~str) -> u8 {
-        let len = len(*s);
+        let len = s.len();
         assert!((len > 0u));
         let b = s[len - 1u];
         set_len(s, len - 1u);
@@ -2403,7 +2381,7 @@ pub mod raw {
 
     /// Removes the first byte from a string and returns it. (Not UTF-8 safe).
     pub unsafe fn shift_byte(s: &mut ~str) -> u8 {
-        let len = len(*s);
+        let len = s.len();
         assert!((len > 0u));
         let b = s[0];
         *s = raw::slice_bytes_owned(*s, 1u, len);
@@ -2567,7 +2545,7 @@ impl<'self> StrSlice<'self> for &'self str {
     }
     /// Returns true if the string has length 0
     #[inline]
-    fn is_empty(&self) -> bool { is_empty(*self) }
+    fn is_empty(&self) -> bool { self.len() == 0 }
     /**
      * Returns true if the string contains only whitespace
      *
@@ -2584,7 +2562,9 @@ impl<'self> StrSlice<'self> for &'self str {
     fn is_alphanumeric(&self) -> bool { is_alphanumeric(*self) }
     /// Returns the size in bytes not counting the null terminator
     #[inline(always)]
-    fn len(&self) -> uint { len(*self) }
+    fn len(&self) -> uint {
+        do as_buf(*self) |_p, n| { n - 1u }
+    }
     /// Returns the number of characters that a string holds
     #[inline]
     fn char_len(&self) -> uint { char_len(*self) }
@@ -2597,7 +2577,9 @@ impl<'self> StrSlice<'self> for &'self str {
      */
     #[inline]
     fn slice(&self, begin: uint, end: uint) -> &'self str {
-        slice(*self, begin, end)
+        assert!(is_char_boundary(*self, begin));
+        assert!(is_char_boundary(*self, end));
+        unsafe { raw::slice_bytes(*self, begin, end) }
     }
     /**
      * Splits a string into a vector of the substrings separated by a given
@@ -2788,8 +2770,8 @@ mod tests {
 
     #[test]
     fn test_eq_slice() {
-        assert!((eq_slice(slice("foobar", 0, 3), "foo")));
-        assert!((eq_slice(slice("barfoo", 3, 6), "foo")));
+        assert!((eq_slice("foobar".slice(0, 3), "foo")));
+        assert!((eq_slice("barfoo".slice(3, 6), "foo")));
         assert!((!eq_slice("foo1", "foo2")));
     }
 
@@ -2803,13 +2785,13 @@ mod tests {
 
     #[test]
     fn test_len() {
-        assert_eq!(len(""), 0u);
-        assert_eq!(len("hello world"), 11u);
-        assert_eq!(len("\x63"), 1u);
-        assert_eq!(len("\xa2"), 2u);
-        assert_eq!(len("\u03c0"), 2u);
-        assert_eq!(len("\u2620"), 3u);
-        assert_eq!(len("\U0001d11e"), 4u);
+        assert_eq!("".len(), 0u);
+        assert_eq!("hello world".len(), 11u);
+        assert_eq!("\x63".len(), 1u);
+        assert_eq!("\xa2".len(), 2u);
+        assert_eq!("\u03c0".len(), 2u);
+        assert_eq!("\u2620".len(), 3u);
+        assert_eq!("\U0001d11e".len(), 4u);
 
         assert_eq!(char_len(""), 0u);
         assert_eq!(char_len("hello world"), 11u);
@@ -2937,7 +2919,7 @@ mod tests {
     #[test]
     fn test_substr() {
         fn t(a: &str, b: &str, start: int) {
-            assert_eq!(substr(a, start as uint, len(b)), b);
+            assert_eq!(substr(a, start as uint, b.len()), b);
         }
         t("hello", "llo", 2);
         t("hello", "el", 1);
@@ -3044,8 +3026,8 @@ mod tests {
 
     #[test]
     fn test_is_empty() {
-        assert!((is_empty("")));
-        assert!((!is_empty("a")));
+        assert!("".is_empty());
+        assert!(!"a".is_empty());
     }
 
     #[test]
@@ -3101,16 +3083,16 @@ mod tests {
 
     #[test]
     fn test_slice() {
-        assert_eq!("ab", slice("abc", 0, 2));
-        assert_eq!("bc", slice("abc", 1, 3));
-        assert_eq!("", slice("abc", 1, 1));
-        assert_eq!("\u65e5", slice("\u65e5\u672c", 0, 3));
+        assert_eq!("ab", "abc".slice(0, 2));
+        assert_eq!("bc", "abc".slice(1, 3));
+        assert_eq!("", "abc".slice(1, 1));
+        assert_eq!("\u65e5", "\u65e5\u672c".slice(0, 3));
 
         let data = "ประเทศไทย中华";
-        assert_eq!("ป", slice(data, 0, 3));
-        assert_eq!("ร", slice(data, 3, 6));
-        assert_eq!("", slice(data, 3, 3));
-        assert_eq!("华", slice(data, 30, 33));
+        assert_eq!("ป", data.slice(0, 3));
+        assert_eq!("ร", data.slice(3, 6));
+        assert_eq!("", data.slice(3, 3));
+        assert_eq!("华", data.slice(30, 33));
 
         fn a_million_letter_X() -> ~str {
             let mut i = 0;
@@ -3129,23 +3111,23 @@ mod tests {
         }
         let letters = a_million_letter_X();
         assert!(half_a_million_letter_X() ==
-            slice(letters, 0u, 3u * 500000u).to_owned());
+            letters.slice(0u, 3u * 500000u).to_owned());
     }
 
     #[test]
     fn test_slice_2() {
         let ss = "中华Việt Nam";
 
-        assert_eq!("华", slice(ss, 3u, 6u));
-        assert_eq!("Việt Nam", slice(ss, 6u, 16u));
+        assert_eq!("华", ss.slice(3u, 6u));
+        assert_eq!("Việt Nam", ss.slice(6u, 16u));
 
-        assert_eq!("ab", slice("abc", 0u, 2u));
-        assert_eq!("bc", slice("abc", 1u, 3u));
-        assert_eq!("", slice("abc", 1u, 1u));
+        assert_eq!("ab", "abc".slice(0u, 2u));
+        assert_eq!("bc", "abc".slice(1u, 3u));
+        assert_eq!("", "abc".slice(1u, 1u));
 
-        assert_eq!("中", slice(ss, 0u, 3u));
-        assert_eq!("华V", slice(ss, 3u, 7u));
-        assert_eq!("", slice(ss, 3u, 3u));
+        assert_eq!("中", ss.slice(0u, 3u));
+        assert_eq!("华V", ss.slice(3u, 7u));
+        assert_eq!("", ss.slice(3u, 3u));
         /*0: 中
           3: 华
           6: V
@@ -3162,7 +3144,7 @@ mod tests {
     #[should_fail]
     #[ignore(cfg(windows))]
     fn test_slice_fail() {
-        slice("中华Việt Nam", 0u, 2u);
+        "中华Việt Nam".slice(0u, 2u);
     }
 
     #[test]
@@ -3420,8 +3402,8 @@ mod tests {
     #[test]
     fn test_subslice_offset() {
         let a = "kernelsprite";
-        let b = slice(a, 7, len(a));
-        let c = slice(a, 0, len(a) - 6);
+        let b = a.slice(7, a.len());
+        let c = a.slice(0, a.len() - 6);
         assert_eq!(subslice_offset(a, b), 7);
         assert_eq!(subslice_offset(a, c), 0);
 
@@ -3448,7 +3430,7 @@ mod tests {
         let v: ~[u8] = to_bytes(s1);
         let s2: ~str = from_bytes(v);
         let mut i: uint = 0u;
-        let n1: uint = len(s1);
+        let n1: uint = s1.len();
         let n2: uint = v.len();
         assert_eq!(n1, n2);
         while i < n1 {
@@ -3601,7 +3583,7 @@ mod tests {
     #[test]
     fn test_to_managed() {
         assert_eq!("abc".to_managed(), @"abc");
-        assert_eq!(slice("abcdef", 1, 5).to_managed(), @"bcde");
+        assert_eq!("abcdef".slice(1, 5).to_managed(), @"bcde");
     }
 
     #[test]
diff --git a/src/libstd/unstable/extfmt.rs b/src/libstd/unstable/extfmt.rs
index 07bcf6d953c..9b74119b08c 100644
--- a/src/libstd/unstable/extfmt.rs
+++ b/src/libstd/unstable/extfmt.rs
@@ -547,7 +547,7 @@ pub mod rt {
         let unpadded = match cv.precision {
           CountImplied => s,
           CountIs(max) => if (max as uint) < str::char_len(s) {
-            str::slice(s, 0, max as uint)
+            s.slice(0, max as uint)
           } else {
             s
           }
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 5f8d6e73cef..52f6e458db3 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -290,9 +290,9 @@ impl FileMap {
         let begin = begin.to_uint();
         let end = match str::find_char_from(*self.src, '\n', begin) {
             Some(e) => e,
-            None => str::len(*self.src)
+            None => self.src.len()
         };
-        str::slice(*self.src, begin, end).to_owned()
+        self.src.slice(begin, end).to_owned()
     }
 
     pub fn record_multibyte_char(&self, pos: BytePos, bytes: uint) {
@@ -418,7 +418,7 @@ impl CodeMap {
         let begin = self.lookup_byte_offset(sp.lo);
         let end = self.lookup_byte_offset(sp.hi);
         assert_eq!(begin.fm.start_pos, end.fm.start_pos);
-        return str::slice(*begin.fm.src,
+        return begin.fm.src.slice(
                           begin.pos.to_uint(), end.pos.to_uint()).to_owned();
     }
 
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index fa4a74b8954..58b01fe78e7 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -14,7 +14,6 @@ use codemap::{Pos, span};
 use codemap;
 
 use core::io;
-use core::str;
 use core::uint;
 use core::vec;
 use extra::term;
@@ -259,7 +258,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
     if elided {
         let last_line = display_lines[display_lines.len() - 1u];
         let s = fmt!("%s:%u ", fm.name, last_line + 1u);
-        let mut indent = str::len(s);
+        let mut indent = s.len();
         let mut out = ~"";
         while indent > 0u { out += " "; indent -= 1u; }
         out += "...\n";
@@ -277,11 +276,11 @@ fn highlight_lines(cm: @codemap::CodeMap,
         while num > 0u { num /= 10u; digits += 1u; }
 
         // indent past |name:## | and the 0-offset column location
-        let left = str::len(fm.name) + digits + lo.col.to_uint() + 3u;
+        let left = fm.name.len() + digits + lo.col.to_uint() + 3u;
         let mut s = ~"";
         // Skip is the number of characters we need to skip because they are
         // part of the 'filename:line ' part of the previous line.
-        let skip = str::len(fm.name) + digits + 3u;
+        let skip = fm.name.len() + digits + 3u;
         for skip.times() {
             s += " ";
         }
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 57df0fe6f86..a715ede7664 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -215,7 +215,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
     let col = col.to_uint();
     let s1 = if all_whitespace(s, 0, uint::min(len, col)) {
         if col < len {
-            str::slice(s, col, len).to_owned()
+            s.slice(col, len).to_owned()
         } else {  ~"" }
     } else { s };
     debug!("pushing line: %s", s1);
@@ -277,7 +277,7 @@ fn read_block_comment(rdr: @mut StringReader,
                 }
             }
         }
-        if str::len(curr_line) != 0 {
+        if curr_line.len() != 0 {
             trim_whitespace_prefix_and_push_line(&mut lines, curr_line, col);
         }
     }
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index f615f1321df..04635fdf4e9 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -366,7 +366,7 @@ fn scan_exponent(rdr: @mut StringReader) -> Option<~str> {
             bump(rdr);
         }
         let exponent = scan_digits(rdr, 10u);
-        if str::len(exponent) > 0u {
+        if exponent.len() > 0u {
             return Some(rslt + exponent);
         } else { rdr.fatal(~"scan_exponent: bad fp literal"); }
     } else { return None::<~str>; }
@@ -434,7 +434,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token {
             tp = if signed { either::Left(ast::ty_i64) }
                       else { either::Right(ast::ty_u64) };
         }
-        if str::len(num_str) == 0u {
+        if num_str.len() == 0u {
             rdr.fatal(~"no valid digits found for number");
         }
         let parsed = match u64::from_str_radix(num_str, base as uint) {
@@ -499,7 +499,7 @@ fn scan_number(c: char, rdr: @mut StringReader) -> token::Token {
         }
         return token::LIT_FLOAT_UNSUFFIXED(str_to_ident(num_str));
     } else {
-        if str::len(num_str) == 0u {
+        if num_str.len() == 0u {
             rdr.fatal(~"no valid digits found for number");
         }
         let parsed = match u64::from_str_radix(num_str, base as uint) {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 5c81d406cd2..10fd46ea4b6 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -249,7 +249,7 @@ pub fn head(s: @ps, w: &str) {
     // outer-box is consistent
     cbox(s, indent_unit);
     // head-box is inconsistent
-    ibox(s, str::len(w) + 1);
+    ibox(s, w.len() + 1);
     // keyword that starts the head
     if !w.is_empty() {
         word_nbsp(s, w);
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 9f125a48de9..c497a30ec5f 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -81,27 +81,27 @@ fn make_random_fasta(wr: @io::Writer,
     for uint::range(0u, n as uint) |_i| {
         str::push_char(&mut op, select_random(myrandom_next(rng, 100u32),
                                               copy genelist));
-        if str::len(op) >= LINE_LENGTH() {
+        if op.len() >= LINE_LENGTH() {
             wr.write_line(op);
             op = ~"";
         }
     }
-    if str::len(op) > 0u { wr.write_line(op); }
+    if op.len() > 0u { wr.write_line(op); }
 }
 
 fn make_repeat_fasta(wr: @io::Writer, id: ~str, desc: ~str, s: ~str, n: int) {
     unsafe {
         wr.write_line(~">" + id + " " + desc);
         let mut op: ~str = ~"";
-        let sl: uint = str::len(s);
+        let sl: uint = s.len();
         for uint::range(0u, n as uint) |i| {
             str::raw::push_byte(&mut op, s[i % sl]);
-            if str::len(op) >= LINE_LENGTH() {
+            if op.len() >= LINE_LENGTH() {
                 wr.write_line(op);
                 op = ~"";
             }
         }
-        if str::len(op) > 0u { wr.write_line(op); }
+        if op.len() > 0u { wr.write_line(op); }
     }
 }
 
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index e403ba6e73d..ef32b0bb2dc 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -191,7 +191,7 @@ fn main() {
    while !rdr.eof() {
       let line: ~str = rdr.read_line();
 
-      if str::len(line) == 0u { loop; }
+      if line.len() == 0u { loop; }
 
       match (line[0] as char, proc_mode) {
 
diff --git a/src/test/compile-fail/die-not-static.rs b/src/test/compile-fail/die-not-static.rs
index c7f5e271818..40a4232717d 100644
--- a/src/test/compile-fail/die-not-static.rs
+++ b/src/test/compile-fail/die-not-static.rs
@@ -2,7 +2,7 @@ use std::str;
 
 fn main() {
     let v = ~"test";
-    let sslice = str::slice(v, 0, v.len());
+    let sslice = v.slice(0, v.len());
     //~^ ERROR borrowed value does not live long enough
     fail!(sslice);
 }
diff --git a/src/test/run-fail/task-spawn-barefn.rs b/src/test/run-fail/task-spawn-barefn.rs
index 2456f968c3c..6e1af6ff7e0 100644
--- a/src/test/run-fail/task-spawn-barefn.rs
+++ b/src/test/run-fail/task-spawn-barefn.rs
@@ -20,5 +20,5 @@ fn main() {
 }
 
 fn startfn() {
-    assert!(str::is_empty(~"Ensure that the child task runs by failing"));
+    assert!("Ensure that the child task runs by failing".is_empty());
 }
diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs
index f02600bb137..e01b2a42f61 100644
--- a/src/test/run-pass/string-self-append.rs
+++ b/src/test/run-pass/string-self-append.rs
@@ -18,8 +18,8 @@ pub fn main() {
     let mut i = 20;
     let mut expected_len = 1u;
     while i > 0 {
-        error!(str::len(a));
-        assert_eq!(str::len(a), expected_len);
+        error!(a.len());
+        assert_eq!(a.len(), expected_len);
         a = a + a; // FIXME(#3387)---can't write 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 0069165aed4..011fb4435c3 100644
--- a/src/test/run-pass/utf8_chars.rs
+++ b/src/test/run-pass/utf8_chars.rs
@@ -18,7 +18,7 @@ pub fn main() {
     let chs: ~[char] = ~['e', 'é', '€', 0x10000 as char];
     let s: ~str = str::from_chars(chs);
 
-    assert!(str::len(s) == 10u);
+    assert!(s.len() == 10u);
     assert!(str::char_len(s) == 4u);
     assert!(str::to_chars(s).len() == 4u);
     assert!(str::from_chars(str::to_chars(s)) == s);