summary refs log tree commit diff
path: root/src/comp/metadata
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-02 15:34:58 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-02 22:11:42 -0700
commit5c49e4f4e92997869de1f75f9089c9db7e7a6ebe (patch)
tree947f6d58da06e589a0ab0627319917a9d2352a8c /src/comp/metadata
parentb5f905342337a3dc12bdc5dc6d98d3ecdf60439d (diff)
downloadrust-5c49e4f4e92997869de1f75f9089c9db7e7a6ebe.tar.gz
rust-5c49e4f4e92997869de1f75f9089c9db7e7a6ebe.zip
Reformat. Issue #855
Diffstat (limited to 'src/comp/metadata')
-rw-r--r--src/comp/metadata/common.rs2
-rw-r--r--src/comp/metadata/creader.rs105
-rw-r--r--src/comp/metadata/csearch.rs4
-rw-r--r--src/comp/metadata/cstore.rs22
-rw-r--r--src/comp/metadata/decoder.rs73
-rw-r--r--src/comp/metadata/encoder.rs70
-rw-r--r--src/comp/metadata/tydecode.rs14
-rw-r--r--src/comp/metadata/tyencode.rs67
8 files changed, 154 insertions, 203 deletions
diff --git a/src/comp/metadata/common.rs b/src/comp/metadata/common.rs
index 05c0de1bb2b..9d6a2c745f8 100644
--- a/src/comp/metadata/common.rs
+++ b/src/comp/metadata/common.rs
@@ -67,7 +67,7 @@ const tag_items_data_item_inlineness: uint = 0x27u;
 // djb's cdb hashes.
 fn hash_node_id(node_id: &int) -> uint { ret 177573u ^ (node_id as uint); }
 
-fn hash_path(s: &istr) -> uint {
+fn hash_path(s: &str) -> uint {
     let h = 5381u;
     for ch: u8 in str::bytes(s) { h = (h << 5u) + h ^ (ch as uint); }
     ret h;
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index 4fd911a1bad..2c74f03612e 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -34,8 +34,7 @@ fn read_crates(sess: session::session, crate: &ast::crate) {
     let e =
         @{sess: sess,
           crate_cache: @std::map::new_str_hash::<int>(),
-          library_search_paths:
-          sess.get_opts().library_search_paths,
+          library_search_paths: sess.get_opts().library_search_paths,
           mutable next_crate_num: 1};
     let v =
         visit::mk_simple_visitor(@{visit_view_item:
@@ -47,8 +46,8 @@ fn read_crates(sess: session::session, crate: &ast::crate) {
 
 type env =
     @{sess: session::session,
-      crate_cache: @hashmap<istr, int>,
-      library_search_paths: [istr],
+      crate_cache: @hashmap<str, int>,
+      library_search_paths: [str],
       mutable next_crate_num: ast::crate_num};
 
 fn visit_view_item(e: env, i: &@ast::view_item) {
@@ -68,14 +67,11 @@ fn visit_item(e: env, i: &@ast::item) {
             ret;
         }
         let cstore = e.sess.get_cstore();
-        if !cstore::add_used_library(cstore,
-                                     m.native_name) { ret; }
+        if !cstore::add_used_library(cstore, m.native_name) { ret; }
         for a: ast::attribute in
-            attr::find_attrs_by_name(i.attrs, ~"link_args") {
+            attr::find_attrs_by_name(i.attrs, "link_args") {
             alt attr::get_meta_item_value_str(attr::attr_meta(a)) {
-              some(linkarg) {
-                cstore::add_used_link_args(cstore, linkarg);
-              }
+              some(linkarg) { cstore::add_used_link_args(cstore, linkarg); }
               none. {/* fallthrough */ }
             }
         }
@@ -85,12 +81,11 @@ fn visit_item(e: env, i: &@ast::item) {
 }
 
 // A diagnostic function for dumping crate metadata to an output stream
-fn list_file_metadata(path: &istr, out: io::writer) {
+fn list_file_metadata(path: &str, out: io::writer) {
     alt get_metadata_section(path) {
       option::some(bytes) { decoder::list_crate_metadata(bytes, out); }
       option::none. {
-        out.write_str(
-            ~"Could not find metadata in " + path + ~".\n");
+        out.write_str("Could not find metadata in " + path + ".\n");
       }
     }
 }
@@ -104,8 +99,7 @@ fn metadata_matches(crate_data: &@[u8], metas: &[@ast::meta_item]) -> bool {
 
     for needed: @ast::meta_item in metas {
         if !attr::contains(linkage_metas, needed) {
-            log #fmt["missing %s",
-                     pprust::meta_item_to_str(*needed)];
+            log #fmt["missing %s", pprust::meta_item_to_str(*needed)];
             ret false;
         }
     }
@@ -113,19 +107,18 @@ fn metadata_matches(crate_data: &@[u8], metas: &[@ast::meta_item]) -> bool {
 }
 
 fn default_native_lib_naming(sess: session::session, static: bool) ->
-   {prefix: istr, suffix: istr} {
-    if static { ret {prefix: ~"lib", suffix: ~".rlib"}; }
+   {prefix: str, suffix: str} {
+    if static { ret {prefix: "lib", suffix: ".rlib"}; }
     alt sess.get_targ_cfg().os {
-      session::os_win32. { ret {prefix: ~"", suffix: ~".dll"}; }
-      session::os_macos. { ret {prefix: ~"lib", suffix: ~".dylib"}; }
-      session::os_linux. { ret {prefix: ~"lib", suffix: ~".so"}; }
+      session::os_win32. { ret {prefix: "", suffix: ".dll"}; }
+      session::os_macos. { ret {prefix: "lib", suffix: ".dylib"}; }
+      session::os_linux. { ret {prefix: "lib", suffix: ".so"}; }
     }
 }
 
 fn find_library_crate(sess: &session::session, ident: &ast::ident,
-                      metas: &[@ast::meta_item],
-                      library_search_paths: &[istr])
-   -> option::t<{ident: istr, data: @[u8]}> {
+                      metas: &[@ast::meta_item], library_search_paths: &[str])
+   -> option::t<{ident: str, data: @[u8]}> {
 
     attr::require_unique_names(sess, metas);
 
@@ -133,7 +126,7 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident,
     // is using the wrong type of meta item
     let crate_name =
         {
-            let name_items = attr::find_meta_items_by_name(metas, ~"name");
+            let name_items = attr::find_meta_items_by_name(metas, "name");
             alt vec::last(name_items) {
               some(i) {
                 alt attr::get_meta_item_value_str(i) {
@@ -147,49 +140,41 @@ fn find_library_crate(sess: &session::session, ident: &ast::ident,
 
     let nn = default_native_lib_naming(sess, sess.get_opts().static);
     let x =
-        find_library_crate_aux(nn, crate_name,
-                               metas, library_search_paths);
+        find_library_crate_aux(nn, crate_name, metas, library_search_paths);
     if x != none || sess.get_opts().static { ret x; }
     let nn2 = default_native_lib_naming(sess, true);
-    ret find_library_crate_aux(nn2, crate_name,
-                               metas, library_search_paths);
+    ret find_library_crate_aux(nn2, crate_name, metas, library_search_paths);
 }
 
-fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr},
-                          crate_name: &istr,
+fn find_library_crate_aux(nn: &{prefix: str, suffix: str}, crate_name: &str,
                           metas: &[@ast::meta_item],
-                          library_search_paths: &[istr]) ->
-   option::t<{ident: istr, data: @[u8]}> {
-    let prefix: istr = nn.prefix + crate_name;
-    let suffix: istr = nn.suffix;
+                          library_search_paths: &[str]) ->
+   option::t<{ident: str, data: @[u8]}> {
+    let prefix: str = nn.prefix + crate_name;
+    let suffix: str = nn.suffix;
     // FIXME: we could probably use a 'glob' function in std::fs but it will
     // be much easier to write once the unsafe module knows more about FFI
     // tricks. Currently the glob(3) interface is a bit more than we can
     // stomach from here, and writing a C++ wrapper is more work than just
     // manually filtering fs::list_dir here.
 
-    for library_search_path: istr in library_search_paths {
+    for library_search_path: str in library_search_paths {
         log #fmt["searching %s", library_search_path];
-        for path: istr in fs::list_dir(library_search_path) {
+        for path: str in fs::list_dir(library_search_path) {
             log #fmt["searching %s", path];
-            let f: istr = fs::basename(path);
-            if !(str::starts_with(f, prefix) && str::ends_with(f, suffix))
-               {
-                log #fmt["skipping %s, doesn't look like %s*%s",
-                         path,
-                         prefix,
+            let f: str = fs::basename(path);
+            if !(str::starts_with(f, prefix) && str::ends_with(f, suffix)) {
+                log #fmt["skipping %s, doesn't look like %s*%s", path, prefix,
                          suffix];
                 cont;
             }
             alt get_metadata_section(path) {
               option::some(cvec) {
                 if !metadata_matches(cvec, metas) {
-                    log #fmt["skipping %s, metadata doesn't match",
-                             path];
+                    log #fmt["skipping %s, metadata doesn't match", path];
                     cont;
                 }
-                log #fmt["found %s with matching metadata",
-                         path];
+                log #fmt["found %s with matching metadata", path];
                 ret some({ident: path, data: cvec});
               }
               _ { }
@@ -199,10 +184,11 @@ fn find_library_crate_aux(nn: &{prefix: istr, suffix: istr},
     ret none;
 }
 
-fn get_metadata_section(filename: &istr) -> option::t<@[u8]> {
-    let mb = str::as_buf(filename, { |buf|
-        llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf)
-    });
+fn get_metadata_section(filename: &str) -> option::t<@[u8]> {
+    let mb =
+        str::as_buf(filename, {|buf|
+            llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf)
+        });
     if mb as int == 0 { ret option::none::<@[u8]>; }
     let of = mk_object_file(mb);
     let si = mk_section_iter(of.llof);
@@ -221,17 +207,14 @@ fn get_metadata_section(filename: &istr) -> option::t<@[u8]> {
 }
 
 fn load_library_crate(sess: &session::session, span: span, ident: &ast::ident,
-                      metas: &[@ast::meta_item],
-                      library_search_paths: &[istr])
-   -> {ident: istr, data: @[u8]} {
+                      metas: &[@ast::meta_item], library_search_paths: &[str])
+   -> {ident: str, data: @[u8]} {
 
 
     alt find_library_crate(sess, ident, metas, library_search_paths) {
       some(t) { ret t; }
       none. {
-        sess.span_fatal(span,
-                        #fmt["can't find crate for '%s'",
-                                   ident]);
+        sess.span_fatal(span, #fmt["can't find crate for '%s'", ident]);
       }
     }
 }
@@ -254,13 +237,11 @@ fn resolve_crate(e: env, ident: &ast::ident, metas: [@ast::meta_item],
         // Now resolve the crates referenced by this crate
         let cnum_map = resolve_crate_deps(e, cdata);
 
-        let cmeta = {name: ident,
-                     data: cdata, cnum_map: cnum_map};
+        let cmeta = {name: ident, data: cdata, cnum_map: cnum_map};
 
         let cstore = e.sess.get_cstore();
         cstore::set_crate_data(cstore, cnum, cmeta);
-        cstore::add_used_crate_file(cstore,
-                                    cfilename);
+        cstore::add_used_crate_file(cstore, cfilename);
         ret cnum;
     } else { ret e.crate_cache.get(ident); }
 }
@@ -285,9 +266,7 @@ fn resolve_crate_deps(e: env, cdata: &@[u8]) -> cstore::cnum_map {
             // This is a new one so we've got to load it
             // FIXME: Need better error reporting than just a bogus span
             let fake_span = ast_util::dummy_sp();
-            let local_cnum = resolve_crate(e,
-                                           cname,
-                                           [], fake_span);
+            let local_cnum = resolve_crate(e, cname, [], fake_span);
             cnum_map.insert(extrn_cnum, local_cnum);
         }
     }
diff --git a/src/comp/metadata/csearch.rs b/src/comp/metadata/csearch.rs
index a729c596375..d526ee05247 100644
--- a/src/comp/metadata/csearch.rs
+++ b/src/comp/metadata/csearch.rs
@@ -11,7 +11,7 @@ export lookup_defs;
 export get_tag_variants;
 export get_type;
 
-fn get_symbol(cstore: &cstore::cstore, def: ast::def_id) -> istr {
+fn get_symbol(cstore: &cstore::cstore, def: ast::def_id) -> str {
     let cdata = cstore::get_crate_data(cstore, def.crate).data;
     ret decoder::get_symbol(cdata, def.node);
 }
@@ -63,7 +63,7 @@ fn translate_def_id(sess: &session::session, searched_crate: ast::crate_num,
     let local_cnum =
         alt cmeta.cnum_map.find(ext_cnum) {
           option::some(n) { n }
-          option::none. { sess.bug(~"didn't find a crate in the cnum_map") }
+          option::none. { sess.bug("didn't find a crate in the cnum_map") }
         };
 
     ret {crate: local_cnum, node: node_id};
diff --git a/src/comp/metadata/cstore.rs b/src/comp/metadata/cstore.rs
index c5f161394bd..ed737e046ec 100644
--- a/src/comp/metadata/cstore.rs
+++ b/src/comp/metadata/cstore.rs
@@ -29,7 +29,7 @@ export get_use_stmt_cnum;
 // own crate numbers.
 type cnum_map = map::hashmap<ast::crate_num, ast::crate_num>;
 
-type crate_metadata = {name: istr, data: @[u8], cnum_map: cnum_map};
+type crate_metadata = {name: str, data: @[u8], cnum_map: cnum_map};
 
 // This is a bit of an experiment at encapsulating the data in cstore. By
 // keeping all the data in a non-exported tag variant, it's impossible for
@@ -41,9 +41,9 @@ tag cstore { private(cstore_private); }
 type cstore_private =
     @{metas: map::hashmap<ast::crate_num, crate_metadata>,
       use_crate_map: use_crate_map,
-      mutable used_crate_files: [istr],
-      mutable used_libraries: [istr],
-      mutable used_link_args: [istr]};
+      mutable used_crate_files: [str],
+      mutable used_libraries: [str],
+      mutable used_link_args: [str]};
 
 // Map from node_id's of local use statements to crate numbers
 type use_crate_map = map::hashmap<ast::node_id, ast::crate_num>;
@@ -82,18 +82,18 @@ iter iter_crate_data(cstore: &cstore) ->
     }
 }
 
-fn add_used_crate_file(cstore: &cstore, lib: &istr) {
+fn add_used_crate_file(cstore: &cstore, lib: &str) {
     if !vec::member(lib, p(cstore).used_crate_files) {
         p(cstore).used_crate_files += [lib];
     }
 }
 
-fn get_used_crate_files(cstore: &cstore) -> [istr] {
+fn get_used_crate_files(cstore: &cstore) -> [str] {
     ret p(cstore).used_crate_files;
 }
 
-fn add_used_library(cstore: &cstore, lib: &istr) -> bool {
-    if lib == ~"" { ret false; }
+fn add_used_library(cstore: &cstore, lib: &str) -> bool {
+    if lib == "" { ret false; }
 
     if vec::member(lib, p(cstore).used_libraries) { ret false; }
 
@@ -101,15 +101,15 @@ fn add_used_library(cstore: &cstore, lib: &istr) -> bool {
     ret true;
 }
 
-fn get_used_libraries(cstore: &cstore) -> [istr] {
+fn get_used_libraries(cstore: &cstore) -> [str] {
     ret p(cstore).used_libraries;
 }
 
-fn add_used_link_args(cstore: &cstore, args: &istr) {
+fn add_used_link_args(cstore: &cstore, args: &str) {
     p(cstore).used_link_args += str::split(args, ' ' as u8);
 }
 
-fn get_used_link_args(cstore: &cstore) -> [istr] {
+fn get_used_link_args(cstore: &cstore) -> [str] {
     ret p(cstore).used_link_args;
 }
 
diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs
index e99e9d274da..7803e6922a1 100644
--- a/src/comp/metadata/decoder.rs
+++ b/src/comp/metadata/decoder.rs
@@ -83,7 +83,7 @@ fn item_family(item: &ebml::doc) -> u8 {
     ret ebml::doc_as_uint(fam) as u8;
 }
 
-fn item_symbol(item: &ebml::doc) -> istr {
+fn item_symbol(item: &ebml::doc) -> str {
     let sym = ebml::get_doc(item, tag_items_data_item_symbol);
     ret str::unsafe_from_bytes(ebml::doc_data(sym));
 }
@@ -96,7 +96,7 @@ fn variant_tag_id(d: &ebml::doc) -> ast::def_id {
 fn item_type(item: &ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt,
              extres: &external_resolver) -> ty::t {
     fn parse_external_def_id(this_cnum: ast::crate_num,
-                             extres: &external_resolver, s: &istr) ->
+                             extres: &external_resolver, s: &str) ->
        ast::def_id {
         let buf = str::bytes(s);
         let external_def_id = parse_def_id(buf);
@@ -149,16 +149,15 @@ fn tag_variant_ids(item: &ebml::doc, this_cnum: ast::crate_num) ->
 // Given a path and serialized crate metadata, returns the ID of the
 // definition the path refers to.
 fn resolve_path(path: &[ast::ident], data: @[u8]) -> [ast::def_id] {
-    fn eq_item(data: &[u8], s: &istr) -> bool {
+    fn eq_item(data: &[u8], s: &str) -> bool {
         ret str::eq(str::unsafe_from_bytes(data), s);
     }
-    let s = str::connect(path, ~"::");
+    let s = str::connect(path, "::");
     let md = ebml::new_doc(data);
     let paths = ebml::get_doc(md, tag_paths);
     let eqer = bind eq_item(_, s);
     let result: [ast::def_id] = [];
-    for doc: ebml::doc in lookup_hash(paths, eqer,
-                                      hash_path(s)) {
+    for doc: ebml::doc in lookup_hash(paths, eqer, hash_path(s)) {
         let did_doc = ebml::get_doc(doc, tag_def_id);
         result += [parse_def_id(ebml::doc_data(did_doc))];
     }
@@ -222,7 +221,7 @@ fn get_type_param_kinds(data: @[u8], id: ast::node_id) -> [ast::kind] {
     ret item_ty_param_kinds(lookup_item(id, data));
 }
 
-fn get_symbol(data: @[u8], id: ast::node_id) -> istr {
+fn get_symbol(data: @[u8], id: ast::node_id) -> str {
     ret item_symbol(lookup_item(id, data));
 }
 
@@ -268,7 +267,7 @@ fn family_has_type_params(fam_ch: u8) -> bool {
         };
 }
 
-fn read_path(d: &ebml::doc) -> {path: istr, pos: uint} {
+fn read_path(d: &ebml::doc) -> {path: str, pos: uint} {
     let desc = ebml::doc_data(d);
     let pos = ebml::be_uint_from_bytes(@desc, 0u, 4u);
     let pathbytes = vec::slice::<u8>(desc, 4u, vec::len::<u8>(desc));
@@ -276,23 +275,23 @@ fn read_path(d: &ebml::doc) -> {path: istr, pos: uint} {
     ret {path: path, pos: pos};
 }
 
-fn describe_def(items: &ebml::doc, id: ast::def_id) -> istr {
-    if id.crate != ast::local_crate { ret ~"external"; }
+fn describe_def(items: &ebml::doc, id: ast::def_id) -> str {
+    if id.crate != ast::local_crate { ret "external"; }
     ret item_family_to_str(item_family(find_item(id.node, items)));
 }
 
-fn item_family_to_str(fam: u8) -> istr {
+fn item_family_to_str(fam: u8) -> str {
     alt fam as char {
-      'c' { ret ~"const"; }
-      'f' { ret ~"fn"; }
-      'p' { ret ~"pure fn"; }
-      'F' { ret ~"native fn"; }
-      'y' { ret ~"type"; }
-      'T' { ret ~"native type"; }
-      't' { ret ~"type"; }
-      'm' { ret ~"mod"; }
-      'n' { ret ~"native mod"; }
-      'v' { ret ~"tag"; }
+      'c' { ret "const"; }
+      'f' { ret "fn"; }
+      'p' { ret "pure fn"; }
+      'F' { ret "native fn"; }
+      'y' { ret "type"; }
+      'T' { ret "native type"; }
+      't' { ret "type"; }
+      'm' { ret "mod"; }
+      'n' { ret "native mod"; }
+      'v' { ret "tag"; }
     }
 }
 
@@ -347,29 +346,25 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
 
 fn list_meta_items(meta_items: &ebml::doc, out: io::writer) {
     for mi: @ast::meta_item in get_meta_items(meta_items) {
-        out.write_str(
-                #fmt["%s\n",
-                     pprust::meta_item_to_str(*mi)]);
+        out.write_str(#fmt["%s\n", pprust::meta_item_to_str(*mi)]);
     }
 }
 
 fn list_crate_attributes(md: &ebml::doc, out: io::writer) {
-    out.write_str(~"=Crate Attributes=\n");
+    out.write_str("=Crate Attributes=\n");
 
     for attr: ast::attribute in get_attributes(md) {
-        out.write_str(
-                #fmt["%s\n",
-                     pprust::attribute_to_str(attr)]);
+        out.write_str(#fmt["%s\n", pprust::attribute_to_str(attr)]);
     }
 
-    out.write_str(~"\n\n");
+    out.write_str("\n\n");
 }
 
 fn get_crate_attributes(data: @[u8]) -> [ast::attribute] {
     ret get_attributes(ebml::new_doc(data));
 }
 
-type crate_dep = {cnum: ast::crate_num, ident: istr};
+type crate_dep = {cnum: ast::crate_num, ident: str};
 
 fn get_crate_deps(data: @[u8]) -> [crate_dep] {
     let deps: [crate_dep] = [];
@@ -385,19 +380,17 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] {
 }
 
 fn list_crate_deps(data: @[u8], out: io::writer) {
-    out.write_str(~"=External Dependencies=\n");
+    out.write_str("=External Dependencies=\n");
 
     for dep: crate_dep in get_crate_deps(data) {
-        out.write_str(
-            #fmt["%d %s\n", dep.cnum,
-                                 dep.ident]);
+        out.write_str(#fmt["%d %s\n", dep.cnum, dep.ident]);
     }
 
-    out.write_str(~"\n");
+    out.write_str("\n");
 }
 
 fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
-    out.write_str(~"=Items=\n");
+    out.write_str("=Items=\n");
     let paths = ebml::get_doc(md, tag_paths);
     let items = ebml::get_doc(md, tag_items);
     let index = ebml::get_doc(paths, tag_index);
@@ -410,13 +403,11 @@ fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
             let def = ebml::doc_at(bytes, data.pos);
             let did_doc = ebml::get_doc(def, tag_def_id);
             let did = parse_def_id(ebml::doc_data(did_doc));
-            out.write_str(
-                    #fmt["%s (%s)\n",
-                         data.path,
-                         describe_def(items, did)]);
+            out.write_str(#fmt["%s (%s)\n", data.path,
+                               describe_def(items, did)]);
         }
     }
-    out.write_str(~"\n");
+    out.write_str("\n");
 }
 
 fn list_crate_metadata(bytes: &@[u8], out: io::writer) {
diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs
index e1a9e54a6c5..342ddcc887d 100644
--- a/src/comp/metadata/encoder.rs
+++ b/src/comp/metadata/encoder.rs
@@ -26,7 +26,7 @@ type abbrev_map = map::hashmap<ty::t, tyencode::ty_abbrev>;
 type encode_ctxt = {ccx: @crate_ctxt, type_abbrevs: abbrev_map};
 
 // Path table encoding
-fn encode_name(ebml_w: &ebml::writer, name: &istr) {
+fn encode_name(ebml_w: &ebml::writer, name: &str) {
     ebml::start_tag(ebml_w, tag_paths_data_name);
     ebml_w.writer.write(str::bytes(name));
     ebml::end_tag(ebml_w);
@@ -41,7 +41,7 @@ fn encode_def_id(ebml_w: &ebml::writer, id: &def_id) {
 type entry<T> = {val: T, pos: uint};
 
 fn encode_tag_variant_paths(ebml_w: &ebml::writer, variants: &[variant],
-                            path: &[istr], index: &mutable [entry<istr>]) {
+                            path: &[str], index: &mutable [entry<str>]) {
     for variant: variant in variants {
         add_to_index(ebml_w, path, index, variant.node.name);
         ebml::start_tag(ebml_w, tag_paths_data_item);
@@ -51,16 +51,16 @@ fn encode_tag_variant_paths(ebml_w: &ebml::writer, variants: &[variant],
     }
 }
 
-fn add_to_index(ebml_w: &ebml::writer, path: &[istr],
-                index: &mutable [entry<istr>], name: &istr) {
+fn add_to_index(ebml_w: &ebml::writer, path: &[str],
+                index: &mutable [entry<str>], name: &str) {
     let full_path = path + [name];
     index +=
-        [{val: str::connect(full_path, ~"::"), pos: ebml_w.writer.tell()}];
+        [{val: str::connect(full_path, "::"), pos: ebml_w.writer.tell()}];
 }
 
 fn encode_native_module_item_paths(ebml_w: &ebml::writer, nmod: &native_mod,
-                                   path: &[istr],
-                                   index: &mutable [entry<istr>]) {
+                                   path: &[str],
+                                   index: &mutable [entry<str>]) {
     for nitem: @native_item in nmod.items {
         add_to_index(ebml_w, path, index, nitem.ident);
         ebml::start_tag(ebml_w, tag_paths_data_item);
@@ -71,7 +71,7 @@ fn encode_native_module_item_paths(ebml_w: &ebml::writer, nmod: &native_mod,
 }
 
 fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod,
-                            path: &[istr], index: &mutable [entry<istr>]) {
+                            path: &[str], index: &mutable [entry<str>]) {
     for it: @item in module.items {
         if !ast_util::is_exported(it.ident, module) { cont; }
         alt it.node {
@@ -94,9 +94,7 @@ fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod,
             ebml::start_tag(ebml_w, tag_paths_data_mod);
             encode_name(ebml_w, it.ident);
             encode_def_id(ebml_w, local_def(it.id));
-            encode_module_item_paths(ebml_w, _mod,
-                                     path + [it.ident],
-                                     index);
+            encode_module_item_paths(ebml_w, _mod, path + [it.ident], index);
             ebml::end_tag(ebml_w);
           }
           item_native_mod(nmod) {
@@ -104,10 +102,8 @@ fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod,
             ebml::start_tag(ebml_w, tag_paths_data_mod);
             encode_name(ebml_w, it.ident);
             encode_def_id(ebml_w, local_def(it.id));
-            encode_native_module_item_paths(
-                ebml_w, nmod,
-                path + [it.ident],
-                index);
+            encode_native_module_item_paths(ebml_w, nmod, path + [it.ident],
+                                            index);
             ebml::end_tag(ebml_w);
           }
           item_ty(_, tps) {
@@ -153,9 +149,9 @@ fn encode_module_item_paths(ebml_w: &ebml::writer, module: &_mod,
     }
 }
 
-fn encode_item_paths(ebml_w: &ebml::writer, crate: &@crate) -> [entry<istr>] {
-    let index: [entry<istr>] = [];
-    let path: [istr] = [];
+fn encode_item_paths(ebml_w: &ebml::writer, crate: &@crate) -> [entry<str>] {
+    let index: [entry<str>] = [];
+    let path: [str] = [];
     ebml::start_tag(ebml_w, tag_paths);
     encode_module_item_paths(ebml_w, crate.node.module, path, index);
     ebml::end_tag(ebml_w);
@@ -176,9 +172,7 @@ fn encode_inlineness(ebml_w: &ebml::writer, c: u8) {
     ebml::end_tag(ebml_w);
 }
 
-fn def_to_str(did: &def_id) -> istr {
-    ret #fmt["%d:%d", did.crate, did.node];
-}
+fn def_to_str(did: &def_id) -> str { ret #fmt["%d:%d", did.crate, did.node]; }
 
 fn encode_type_param_kinds(ebml_w: &ebml::writer, tps: &[ty_param]) {
     ebml::start_tag(ebml_w, tag_items_data_item_ty_param_kinds);
@@ -441,9 +435,7 @@ fn encode_index<T>(ebml_w: &ebml::writer, buckets: &[@[entry<T>]],
     ebml::end_tag(ebml_w);
 }
 
-fn write_str(writer: &io::writer, s: &istr) {
-    writer.write_str(s);
-}
+fn write_str(writer: &io::writer, s: &str) { writer.write_str(s); }
 
 fn write_int(writer: &io::writer, n: &int) {
     writer.write_be_uint(n as uint, 4u);
@@ -505,24 +497,22 @@ fn synthesize_crate_attrs(ecx: &@encode_ctxt, crate: &@crate) -> [attribute] {
     fn synthesize_link_attr(ecx: &@encode_ctxt, items: &[@meta_item]) ->
        attribute {
 
-        assert (ecx.ccx.link_meta.name != ~"");
-        assert (ecx.ccx.link_meta.vers != ~"");
+        assert (ecx.ccx.link_meta.name != "");
+        assert (ecx.ccx.link_meta.vers != "");
 
         let name_item =
-            attr::mk_name_value_item_str(
-                ~"name", ecx.ccx.link_meta.name);
+            attr::mk_name_value_item_str("name", ecx.ccx.link_meta.name);
         let vers_item =
-            attr::mk_name_value_item_str(
-                ~"vers", ecx.ccx.link_meta.vers);
+            attr::mk_name_value_item_str("vers", ecx.ccx.link_meta.vers);
 
         let other_items =
             {
-                let tmp = attr::remove_meta_items_by_name(items, ~"name");
-                attr::remove_meta_items_by_name(tmp, ~"vers")
+                let tmp = attr::remove_meta_items_by_name(items, "name");
+                attr::remove_meta_items_by_name(tmp, "vers")
             };
 
         let meta_items = [name_item, vers_item] + other_items;
-        let link_item = attr::mk_list_item(~"link", meta_items);
+        let link_item = attr::mk_list_item("link", meta_items);
 
         ret attr::mk_attr(link_item);
     }
@@ -531,7 +521,7 @@ fn synthesize_crate_attrs(ecx: &@encode_ctxt, crate: &@crate) -> [attribute] {
     let found_link_attr = false;
     for attr: attribute in crate.node.attrs {
         attrs +=
-            if attr::get_attr_name(attr) != ~"link" {
+            if attr::get_attr_name(attr) != "link" {
                 [attr]
             } else {
                 alt attr.node.value.node {
@@ -551,9 +541,9 @@ fn synthesize_crate_attrs(ecx: &@encode_ctxt, crate: &@crate) -> [attribute] {
 
 fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) {
 
-    fn get_ordered_names(cstore: &cstore::cstore) -> [istr] {
+    fn get_ordered_names(cstore: &cstore::cstore) -> [str] {
         type hashkv = @{key: crate_num, val: cstore::crate_metadata};
-        type numname = {crate: crate_num, ident: istr};
+        type numname = {crate: crate_num, ident: str};
 
         // Pull the cnums and names out of cstore
         let pairs: [mutable numname] = [mutable];
@@ -575,7 +565,7 @@ fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) {
         }
 
         // Return just the names
-        fn name(kv: &numname) -> istr { kv.ident }
+        fn name(kv: &numname) -> str { kv.ident }
         // mutable -> immutable hack for vec::map
         let immpairs = vec::slice(pairs, 0u, vec::len(pairs));
         ret vec::map(name, immpairs);
@@ -586,7 +576,7 @@ fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) {
     // FIXME: This is not nearly enough to support correct versioning
     // but is enough to get transitive crate dependencies working.
     ebml::start_tag(ebml_w, tag_crate_deps);
-    for cname: istr in get_ordered_names(cstore) {
+    for cname: str in get_ordered_names(cstore) {
         ebml::start_tag(ebml_w, tag_crate_dep);
         ebml_w.writer.write(str::bytes(cname));
         ebml::end_tag(ebml_w);
@@ -594,7 +584,7 @@ fn encode_crate_deps(ebml_w: &ebml::writer, cstore: &cstore::cstore) {
     ebml::end_tag(ebml_w);
 }
 
-fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> istr {
+fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> str {
 
     let abbrevs = map::mk_hashmap(ty::hash_ty, ty::eq_ty);
     let ecx = @{ccx: cx, type_abbrevs: abbrevs};
@@ -630,7 +620,7 @@ fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> istr {
 }
 
 // Get the encoded string for a type
-fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> istr {
+fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> str {
     let cx = @{ds: def_to_str, tcx: tcx, abbrevs: tyencode::ac_no_abbrevs};
     let sw = io::string_writer();
     tyencode::enc_ty(sw.get_writer(), cx, t);
diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs
index c72bc020288..1adbc2d47a2 100644
--- a/src/comp/metadata/tydecode.rs
+++ b/src/comp/metadata/tydecode.rs
@@ -20,7 +20,7 @@ export parse_ty_data;
 // data buffer. Whatever format you choose should not contain pipe characters.
 
 // Callback to translate defs to strs or back:
-type str_def = fn(&istr) -> ast::def_id;
+type str_def = fn(&str) -> ast::def_id;
 
 type pstate =
     {data: @[u8], crate: int, mutable pos: uint, len: uint, tcx: ty::ctxt};
@@ -42,7 +42,7 @@ fn parse_ident(st: @pstate, sd: str_def, last: char) -> ast::ident {
 
 fn parse_ident_(st: @pstate, _sd: str_def, is_last: fn(char) -> bool) ->
    ast::ident {
-    let rslt = ~"";
+    let rslt = "";
     while !is_last(peek(st) as char) {
         rslt += str::unsafe_from_byte(next(st));
     }
@@ -224,7 +224,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
         assert (next(st) as char == '[');
         let fields: [ty::field] = [];
         while peek(st) as char != ']' {
-            let name = ~"";
+            let name = "";
             while peek(st) as char != '=' {
                 name += str::unsafe_from_byte(next(st));
             }
@@ -277,7 +277,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
               'W' { proto = ast::proto_iter; }
               'F' { proto = ast::proto_fn; }
             }
-            let name = ~"";
+            let name = "";
             while peek(st) as char != '[' {
                 name += str::unsafe_from_byte(next(st));
             }
@@ -342,10 +342,8 @@ fn parse_mt(st: @pstate, sd: str_def) -> ty::mt {
 }
 
 fn parse_def(st: @pstate, sd: str_def) -> ast::def_id {
-    let def = ~"";
-    while peek(st) as char != '|' {
-        def += str::unsafe_from_byte(next(st));
-    }
+    let def = "";
+    while peek(st) as char != '|' { def += str::unsafe_from_byte(next(st)); }
     st.pos = st.pos + 1u;
     ret sd(def);
 }
diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs
index 46015f72cf8..1688b8b7d12 100644
--- a/src/comp/metadata/tyencode.rs
+++ b/src/comp/metadata/tyencode.rs
@@ -19,14 +19,14 @@ export ac_use_abbrevs;
 export enc_ty;
 
 type ctxt =
-     // Def -> str Callback:
-     // The type context.
-     {ds: fn(&def_id) -> istr, tcx: ty::ctxt, abbrevs: abbrev_ctxt};
+    // Def -> str Callback:
+    // The type context.
+    {ds: fn(&def_id) -> str, tcx: ty::ctxt, abbrevs: abbrev_ctxt};
 
 // Compact string representation for ty.t values. API ty_str & parse_from_str.
 // Extra parameters are for converting to/from def_ids in the string rep.
 // Whatever format you choose should not contain pipe characters.
-type ty_abbrev = {pos: uint, len: uint, s: @istr};
+type ty_abbrev = {pos: uint, len: uint, s: @str};
 
 tag abbrev_ctxt { ac_no_abbrevs; ac_use_abbrevs(hashmap<ty::t, ty_abbrev>); }
 
@@ -40,7 +40,7 @@ fn cx_uses_abbrevs(cx: &@ctxt) -> bool {
 fn enc_ty(w: &io::writer, cx: &@ctxt, t: ty::t) {
     alt cx.abbrevs {
       ac_no_abbrevs. {
-        let result_str: @istr;
+        let result_str: @str;
         alt cx.tcx.short_names_cache.find(t) {
           some(s) { result_str = s; }
           none. {
@@ -71,8 +71,8 @@ fn enc_ty(w: &io::writer, cx: &@ctxt, t: ty::t) {
                 // I.e. it's actually an abbreviation.
 
                 let s =
-                    ~"#" + uint::to_str(pos, 16u) + ~":" +
-                    uint::to_str(len, 16u) + ~"#";
+                    "#" + uint::to_str(pos, 16u) + ":" +
+                        uint::to_str(len, 16u) + "#";
                 let a = {pos: pos, len: len, s: @s};
                 abbrevs.insert(t, a);
             }
@@ -100,29 +100,29 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
       ty::ty_float. { w.write_char('l'); }
       ty::ty_machine(mach) {
         alt mach {
-          ty_u8. { w.write_str(~"Mb"); }
-          ty_u16. { w.write_str(~"Mw"); }
-          ty_u32. { w.write_str(~"Ml"); }
-          ty_u64. { w.write_str(~"Md"); }
-          ty_i8. { w.write_str(~"MB"); }
-          ty_i16. { w.write_str(~"MW"); }
-          ty_i32. { w.write_str(~"ML"); }
-          ty_i64. { w.write_str(~"MD"); }
-          ty_f32. { w.write_str(~"Mf"); }
-          ty_f64. { w.write_str(~"MF"); }
+          ty_u8. { w.write_str("Mb"); }
+          ty_u16. { w.write_str("Mw"); }
+          ty_u32. { w.write_str("Ml"); }
+          ty_u64. { w.write_str("Md"); }
+          ty_i8. { w.write_str("MB"); }
+          ty_i16. { w.write_str("MW"); }
+          ty_i32. { w.write_str("ML"); }
+          ty_i64. { w.write_str("MD"); }
+          ty_f32. { w.write_str("Mf"); }
+          ty_f64. { w.write_str("MF"); }
         }
       }
       ty::ty_char. { w.write_char('c'); }
       ty::ty_istr. { w.write_char('S'); }
       ty::ty_tag(def, tys) {
-        w.write_str(~"t[");
+        w.write_str("t[");
         w.write_str(cx.ds(def));
         w.write_char('|');
         for t: ty::t in tys { enc_ty(w, cx, t); }
         w.write_char(']');
       }
       ty::ty_tup(ts) {
-        w.write_str(~"T[");
+        w.write_str("T[");
         for t in ts { enc_ty(w, cx, t); }
         w.write_char(']');
       }
@@ -131,7 +131,7 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
       ty::ty_ptr(mt) { w.write_char('*'); enc_mt(w, cx, mt); }
       ty::ty_vec(mt) { w.write_char('I'); enc_mt(w, cx, mt); }
       ty::ty_rec(fields) {
-        w.write_str(~"R[");
+        w.write_str("R[");
         for field: ty::field in fields {
             w.write_str(field.ident);
             w.write_char('=');
@@ -155,7 +155,7 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
         enc_ty_fn(w, cx, args, out, return, []);
       }
       ty::ty_obj(methods) {
-        w.write_str(~"O[");
+        w.write_str("O[");
         for m: ty::method in methods {
             enc_proto(w, m.proto);
             w.write_str(m.ident);
@@ -164,17 +164,14 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
         w.write_char(']');
       }
       ty::ty_res(def, ty, tps) {
-        w.write_str(~"r[");
+        w.write_str("r[");
         w.write_str(cx.ds(def));
         w.write_char('|');
         enc_ty(w, cx, ty);
         for t: ty::t in tps { enc_ty(w, cx, t); }
         w.write_char(']');
       }
-      ty::ty_var(id) {
-        w.write_char('X');
-        w.write_str(int::str(id));
-      }
+      ty::ty_var(id) { w.write_char('X'); w.write_str(int::str(id)); }
       ty::ty_native(def) {
         w.write_char('E');
         w.write_str(cx.ds(def));
@@ -182,15 +179,15 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
       }
       ty::ty_param(id, k) {
         alt k {
-          kind_unique. { w.write_str(~"pu"); }
-          kind_shared. { w.write_str(~"ps"); }
-          kind_pinned. { w.write_str(~"pp"); }
+          kind_unique. { w.write_str("pu"); }
+          kind_shared. { w.write_str("ps"); }
+          kind_pinned. { w.write_str("pp"); }
         }
         w.write_str(uint::str(id));
       }
       ty::ty_type. { w.write_char('Y'); }
       ty::ty_constr(ty, cs) {
-        w.write_str(~"A[");
+        w.write_str("A[");
         enc_ty(w, cx, ty);
         for tc: @ty::type_constr in cs { enc_ty_constr(w, cx, tc); }
         w.write_char(']');
@@ -244,9 +241,7 @@ fn enc_constr(w: &io::writer, cx: &@ctxt, c: &@ty::constr) {
         alt a.node {
           carg_base. { w.write_char('*'); }
           carg_ident(i) { w.write_uint(i); }
-          carg_lit(l) {
-            w.write_str(lit_to_str(l));
-          }
+          carg_lit(l) { w.write_str(lit_to_str(l)); }
         }
     }
     w.write_char(')');
@@ -262,10 +257,8 @@ fn enc_ty_constr(w: &io::writer, cx: &@ctxt, c: &@ty::type_constr) {
         if semi { w.write_char(';'); } else { semi = true; }
         alt a.node {
           carg_base. { w.write_char('*'); }
-          carg_ident(p) {
-            w.write_str(path_to_str(p)); }
-          carg_lit(l) {
-            w.write_str(lit_to_str(l)); }
+          carg_ident(p) { w.write_str(path_to_str(p)); }
+          carg_lit(l) { w.write_str(lit_to_str(l)); }
         }
     }
     w.write_char(')');