about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/driver/rustc.rs13
-rw-r--r--src/comp/metadata/creader.rs3
-rw-r--r--src/comp/metadata/decoder.rs27
-rw-r--r--src/comp/metadata/encoder.rs9
-rw-r--r--src/comp/metadata/tyencode.rs76
-rw-r--r--src/comp/syntax/codemap.rs23
-rw-r--r--src/comp/syntax/ext/log_syntax.rs4
-rw-r--r--src/comp/syntax/parse/parser.rs2
-rw-r--r--src/comp/syntax/print/pp.rs8
-rw-r--r--src/comp/syntax/print/pprust.rs6
10 files changed, 96 insertions, 75 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs
index 1ef81eb35ed..08f00479871 100644
--- a/src/comp/driver/rustc.rs
+++ b/src/comp/driver/rustc.rs
@@ -100,7 +100,7 @@ fn parse_input_src(sess: session::session, cfg: &ast::crate_cfg, infile: str)
    -> {crate: @ast::crate, src: str} {
     let srcbytes =
         if infile != "-" {
-            io::file_reader(infile)
+            io::file_reader(istr::from_estr(infile))
         } else { io::stdin() }.read_whole_stream();
     let src = str::unsafe_from_bytes(srcbytes);
     let crate =
@@ -238,18 +238,21 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
       ppm_normal. { ann = pprust::no_ann(); }
     }
     pprust::print_crate(sess.get_codemap(), crate, input,
-                        io::string_reader(src), io::stdout(), ann);
+                        io::string_reader(istr::from_estr(src)),
+                        io::stdout(), ann);
 }
 
 fn version(argv0: str) {
     let vers = "unknown version";
     let env_vers = #env["CFG_VERSION"];
     if str::byte_len(env_vers) != 0u { vers = env_vers; }
-    io::stdout().write_str(#fmt["%s %s\n", argv0, vers]);
+    io::stdout().write_str(
+        istr::from_estr(#fmt["%s %s\n", argv0, vers]));
 }
 
 fn usage(argv0: str) {
-    io::stdout().write_str(#fmt["usage: %s [options] <input>\n", argv0] +
+    io::stdout().write_str(istr::from_estr(
+        #fmt["usage: %s [options] <input>\n", argv0] +
                                "
 options:
 
@@ -283,7 +286,7 @@ options:
     --test             build test harness
     --gc               garbage collect shared data (experimental/temporary)
 
-");
+"));
 }
 
 fn get_os(triple: str) -> session::os {
diff --git a/src/comp/metadata/creader.rs b/src/comp/metadata/creader.rs
index c13de2d6f9d..e06f0ca455f 100644
--- a/src/comp/metadata/creader.rs
+++ b/src/comp/metadata/creader.rs
@@ -86,7 +86,8 @@ 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(
+            istr::from_estr("Could not find metadata in " + path + ".\n"));
       }
     }
 }
diff --git a/src/comp/metadata/decoder.rs b/src/comp/metadata/decoder.rs
index 0476fd88605..522aba23b6f 100644
--- a/src/comp/metadata/decoder.rs
+++ b/src/comp/metadata/decoder.rs
@@ -4,6 +4,7 @@ import std::ebml;
 import std::vec;
 import std::option;
 import std::str;
+import std::istr;
 import std::io;
 import std::map::hashmap;
 import syntax::ast;
@@ -346,18 +347,20 @@ 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(
+            istr::from_estr(#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(
+            istr::from_estr(#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] {
@@ -380,17 +383,18 @@ 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(
+            istr::from_estr(#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);
@@ -403,11 +407,12 @@ 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(
+                istr::from_estr(#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 b2d76729361..12db17936dd 100644
--- a/src/comp/metadata/encoder.rs
+++ b/src/comp/metadata/encoder.rs
@@ -2,6 +2,7 @@
 
 import std::vec;
 import std::str;
+import std::istr;
 import std::uint;
 import std::io;
 import std::option;
@@ -435,7 +436,9 @@ fn encode_index<T>(ebml_w: &ebml::writer, buckets: &[@[entry<T>]],
     ebml::end_tag(ebml_w);
 }
 
-fn write_str(writer: &io::writer, s: &str) { writer.write_str(s); }
+fn write_str(writer: &io::writer, s: &str) {
+    writer.write_str(istr::from_estr(s));
+}
 
 fn write_int(writer: &io::writer, n: &int) {
     writer.write_be_uint(n as uint, 4u);
@@ -616,7 +619,7 @@ fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> str {
     // remaining % 4 bytes.
 
     buf_w.write([0u8, 0u8, 0u8, 0u8]);
-    ret string_w.get_str();
+    ret istr::to_estr(string_w.get_str());
 }
 
 // Get the encoded string for a type
@@ -624,7 +627,7 @@ 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);
-    ret sw.get_str();
+    ret istr::to_estr(sw.get_str());
 }
 
 
diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs
index 34a810adb3b..399ab85fd30 100644
--- a/src/comp/metadata/tyencode.rs
+++ b/src/comp/metadata/tyencode.rs
@@ -46,15 +46,15 @@ fn enc_ty(w: &io::writer, cx: &@ctxt, t: ty::t) {
           none. {
             let sw = io::string_writer();
             enc_sty(sw.get_writer(), cx, ty::struct(cx.tcx, t));
-            result_str = sw.get_str();
+            result_str = istr::to_estr(sw.get_str());
             cx.tcx.short_names_cache.insert(t, result_str);
           }
         }
-        w.write_str(result_str);
+        w.write_str(istr::from_estr(result_str));
       }
       ac_use_abbrevs(abbrevs) {
         alt abbrevs.find(t) {
-          some(a) { w.write_str(a.s); ret; }
+          some(a) { w.write_str(istr::from_estr(a.s)); ret; }
           none. {
             let pos = w.get_buf_writer().tell();
             enc_sty(w, cx, ty::struct(cx.tcx, t));
@@ -100,30 +100,30 @@ 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_str. { w.write_char('s'); }
       ty::ty_istr. { w.write_char('S'); }
       ty::ty_tag(def, tys) {
-        w.write_str("t[");
-        w.write_str(cx.ds(def));
+        w.write_str(~"t[");
+        w.write_str(istr::from_estr(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(']');
       }
@@ -132,9 +132,9 @@ 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_str(istr::from_estr(field.ident));
             w.write_char('=');
             enc_mt(w, cx, field.mt);
         }
@@ -156,17 +156,17 @@ 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);
+            w.write_str(istr::from_estr(m.ident));
             enc_ty_fn(w, cx, m.inputs, m.output, m.cf, m.constrs);
         }
         w.write_char(']');
       }
       ty::ty_res(def, ty, tps) {
-        w.write_str("r[");
-        w.write_str(cx.ds(def));
+        w.write_str(~"r[");
+        w.write_str(istr::from_estr(cx.ds(def)));
         w.write_char('|');
         enc_ty(w, cx, ty);
         for t: ty::t in tps { enc_ty(w, cx, t); }
@@ -174,24 +174,24 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
       }
       ty::ty_var(id) {
         w.write_char('X');
-        w.write_str(istr::to_estr(int::str(id)));
+        w.write_str(int::str(id));
       }
       ty::ty_native(def) {
         w.write_char('E');
-        w.write_str(cx.ds(def));
+        w.write_str(istr::from_estr(cx.ds(def)));
         w.write_char('|');
       }
       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(istr::to_estr(uint::str(id)));
+        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(']');
@@ -235,9 +235,9 @@ fn enc_ty_fn(w: &io::writer, cx: &@ctxt, args: &[ty::arg], out: ty::t,
 
 // FIXME less copy-and-paste
 fn enc_constr(w: &io::writer, cx: &@ctxt, c: &@ty::constr) {
-    w.write_str(path_to_str(c.node.path));
+    w.write_str(istr::from_estr(path_to_str(c.node.path)));
     w.write_char('(');
-    w.write_str(cx.ds(c.node.id));
+    w.write_str(istr::from_estr(cx.ds(c.node.id)));
     w.write_char('|');
     let semi = false;
     for a: @constr_arg in c.node.args {
@@ -245,24 +245,28 @@ 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(istr::from_estr(lit_to_str(l)));
+          }
         }
     }
     w.write_char(')');
 }
 
 fn enc_ty_constr(w: &io::writer, cx: &@ctxt, c: &@ty::type_constr) {
-    w.write_str(path_to_str(c.node.path));
+    w.write_str(istr::from_estr(path_to_str(c.node.path)));
     w.write_char('(');
-    w.write_str(cx.ds(c.node.id));
+    w.write_str(istr::from_estr(cx.ds(c.node.id)));
     w.write_char('|');
     let semi = false;
     for a: @ty::ty_constr_arg in c.node.args {
         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(istr::from_estr(path_to_str(p))); }
+          carg_lit(l) {
+            w.write_str(istr::from_estr(lit_to_str(l))); }
         }
     }
     w.write_char(')');
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs
index e522becd3e0..d9aff69acfa 100644
--- a/src/comp/syntax/codemap.rs
+++ b/src/comp/syntax/codemap.rs
@@ -1,6 +1,7 @@
 import std::vec;
 import std::uint;
 import std::str;
+import std::istr;
 import std::term;
 import std::io;
 import std::option;
@@ -108,13 +109,13 @@ fn emit_diagnostic(sp: &option::t<span>, msg: &str, kind: &str, color: u8,
       }
       none. { }
     }
-    io::stdout().write_str(ss);
+    io::stdout().write_str(istr::from_estr(ss));
     if term::color_supported() {
         term::fg(io::stdout().get_buf_writer(), color);
     }
-    io::stdout().write_str(#fmt["%s:", kind]);
+    io::stdout().write_str(istr::from_estr(#fmt["%s:", kind]));
     if term::color_supported() { term::reset(io::stdout().get_buf_writer()); }
-    io::stdout().write_str(#fmt[" %s\n", msg]);
+    io::stdout().write_str(istr::from_estr(#fmt[" %s\n", msg]));
 
     maybe_highlight_lines(sp, cm, maybe_lines);
 }
@@ -130,7 +131,8 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
 
         // FIXME: reading in the entire file is the worst possible way to
         //        get access to the necessary lines.
-        let file = io::read_whole_file_str(lines.name);
+        let file = istr::to_estr(
+            io::read_whole_file_str(istr::from_estr(lines.name)));
         let fm = get_filemap(cm, lines.name);
 
         // arbitrarily only print up to six lines of the error
@@ -143,18 +145,19 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
         }
         // Print the offending lines
         for line: uint in display_lines {
-            io::stdout().write_str(#fmt["%s:%u ", fm.name, line + 1u]);
+            io::stdout().write_str(
+                istr::from_estr(#fmt["%s:%u ", fm.name, line + 1u]));
             let s = get_line(fm, line as int, file);
             if !str::ends_with(s, "\n") { s += "\n"; }
-            io::stdout().write_str(s);
+            io::stdout().write_str(istr::from_estr(s));
         }
         if elided {
             let last_line = display_lines[vec::len(display_lines) - 1u];
             let s = #fmt["%s:%u ", fm.name, last_line + 1u];
             let indent = str::char_len(s);
-            let out = "";
-            while indent > 0u { out += " "; indent -= 1u; }
-            out += "...\n";
+            let out = ~"";
+            while indent > 0u { out += ~" "; indent -= 1u; }
+            out += ~"...\n";
             io::stdout().write_str(out);
         }
 
@@ -180,7 +183,7 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
                 let width = hi.col - lo.col - 1u;
                 while width > 0u { str::push_char(s, '~'); width -= 1u; }
             }
-            io::stdout().write_str(s + "\n");
+            io::stdout().write_str(istr::from_estr(s + "\n"));
         }
       }
       _ { }
diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs
index a03ff11a66d..3cf240097dc 100644
--- a/src/comp/syntax/ext/log_syntax.rs
+++ b/src/comp/syntax/ext/log_syntax.rs
@@ -1,12 +1,14 @@
 import std::option;
 import base::*;
 import syntax::ast;
+import std::istr;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
                      _body: option::t<str>) -> @ast::expr {
 
     cx.print_backtrace();
-    std::io::stdout().write_line(print::pprust::expr_to_str(arg));
+    std::io::stdout().write_line(
+        istr::from_estr(print::pprust::expr_to_str(arg)));
 
     //trivial expression
     ret @{id: cx.next_id(), node: ast::expr_rec([], option::none), span: sp};
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 59cea6e131d..b5d71a6ee9c 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -63,7 +63,7 @@ type parser =
 fn new_parser_from_file(sess: parse_sess, cfg: ast::crate_cfg, path: str,
                         chpos: uint, byte_pos: uint, ftype: file_type) ->
    parser {
-    let src = io::read_whole_file_str(path);
+    let src = istr::to_estr(io::read_whole_file_str(istr::from_estr(path)));
     let filemap = codemap::new_filemap(path, chpos, byte_pos);
     sess.cm.files += [filemap];
     let itr = @interner::mk(str::hash, str::eq);
diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs
index adeccd4150c..3ad514fdb2e 100644
--- a/src/comp/syntax/print/pp.rs
+++ b/src/comp/syntax/print/pp.rs
@@ -2,7 +2,7 @@
 import std::io;
 import std::vec;
 import std::str;
-
+import std::istr;
 
 /*
  * This pretty-printer is a direct reimplementation of Philip Karlton's
@@ -391,7 +391,7 @@ obj printer(out: io::writer,
     }
     fn print_newline(amount: int) {
         log #fmt["NEWLINE %d", amount];
-        out.write_str("\n");
+        out.write_str(~"\n");
         pending_indentation = 0;
         self.indent(amount);
     }
@@ -407,10 +407,10 @@ obj printer(out: io::writer,
     }
     fn write_str(s: str) {
         while pending_indentation > 0 {
-            out.write_str(" ");
+            out.write_str(~" ");
             pending_indentation -= 1;
         }
-        out.write_str(s);
+        out.write_str(istr::from_estr(s));
     }
     fn print(x: token, L: int) {
         log #fmt["print %s %d (remaining line space=%d)", tok_str(x), L,
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index bf3942f1eab..9dcd56407f7 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -112,7 +112,7 @@ fn fun_to_str(f: &ast::_fn, name: str, params: &[ast::ty_param]) -> str {
     let s = rust_printer(writer.get_writer());
     print_fn(s, f.decl, f.proto, name, params, f.decl.constraints);
     eof(s.s);
-    ret writer.get_str();
+    ret istr::to_estr(writer.get_str());
 }
 
 fn block_to_str(blk: &ast::blk) -> str {
@@ -126,7 +126,7 @@ fn block_to_str(blk: &ast::blk) -> str {
     ibox(s, 0u);
     print_block(s, blk);
     eof(s.s);
-    ret writer.get_str();
+    ret istr::to_estr(writer.get_str());
 }
 
 fn meta_item_to_str(mi: &ast::meta_item) -> str {
@@ -1621,7 +1621,7 @@ fn to_str<T>(t: &T, f: fn(&ps, &T)) -> str {
     let s = rust_printer(writer.get_writer());
     f(s, t);
     eof(s.s);
-    ret writer.get_str();
+    ret istr::to_estr(writer.get_str());
 }
 
 fn next_comment(s: &ps) -> option::t<lexer::cmnt> {