about summary refs log tree commit diff
path: root/src/comp/syntax/ext
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/syntax/ext
parentb5f905342337a3dc12bdc5dc6d98d3ecdf60439d (diff)
Reformat. Issue #855
Diffstat (limited to 'src/comp/syntax/ext')
-rw-r--r--src/comp/syntax/ext/base.rs47
-rw-r--r--src/comp/syntax/ext/concat_idents.rs8
-rw-r--r--src/comp/syntax/ext/env.rs16
-rw-r--r--src/comp/syntax/ext/expand.rs11
-rw-r--r--src/comp/syntax/ext/fmt.rs113
-rw-r--r--src/comp/syntax/ext/ident_to_str.rs8
-rw-r--r--src/comp/syntax/ext/log_syntax.rs5
-rw-r--r--src/comp/syntax/ext/simplext.rs127
8 files changed, 153 insertions, 182 deletions
diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs
index 2dcc43ef178..298f90237bc 100644
--- a/src/comp/syntax/ext/base.rs
+++ b/src/comp/syntax/ext/base.rs
@@ -8,10 +8,10 @@ import std::map::new_str_hash;
 import codemap;
 
 type syntax_expander =
-    fn(&ext_ctxt, span, @ast::expr, &option::t<istr>) -> @ast::expr;
-type macro_def = {ident: istr, ext: syntax_extension};
+    fn(&ext_ctxt, span, @ast::expr, &option::t<str>) -> @ast::expr;
+type macro_def = {ident: str, ext: syntax_extension};
 type macro_definer =
-    fn(&ext_ctxt, span, @ast::expr, &option::t<istr>) -> macro_def;
+    fn(&ext_ctxt, span, @ast::expr, &option::t<str>) -> macro_def;
 
 tag syntax_extension {
     normal(syntax_expander);
@@ -20,25 +20,25 @@ tag syntax_extension {
 
 // A temporary hard-coded map of methods for expanding syntax extension
 // AST nodes into full ASTs
-fn syntax_expander_table() -> hashmap<istr, syntax_extension> {
+fn syntax_expander_table() -> hashmap<str, syntax_extension> {
     let syntax_expanders = new_str_hash::<syntax_extension>();
-    syntax_expanders.insert(~"fmt", normal(ext::fmt::expand_syntax_ext));
-    syntax_expanders.insert(~"env", normal(ext::env::expand_syntax_ext));
-    syntax_expanders.insert(~"macro",
+    syntax_expanders.insert("fmt", normal(ext::fmt::expand_syntax_ext));
+    syntax_expanders.insert("env", normal(ext::env::expand_syntax_ext));
+    syntax_expanders.insert("macro",
                             macro_defining(ext::simplext::add_new_extension));
-    syntax_expanders.insert(~"concat_idents",
+    syntax_expanders.insert("concat_idents",
                             normal(ext::concat_idents::expand_syntax_ext));
-    syntax_expanders.insert(~"ident_to_str",
+    syntax_expanders.insert("ident_to_str",
                             normal(ext::ident_to_str::expand_syntax_ext));
-    syntax_expanders.insert(~"log_syntax",
+    syntax_expanders.insert("log_syntax",
                             normal(ext::log_syntax::expand_syntax_ext));
     ret syntax_expanders;
 }
 
 obj ext_ctxt(sess: @session,
-             crate_file_name_hack: istr,
+             crate_file_name_hack: str,
              mutable backtrace: codemap::opt_span) {
-    fn crate_file_name() -> istr { ret crate_file_name_hack; }
+    fn crate_file_name() -> str { ret crate_file_name_hack; }
 
     fn session() -> @session { ret sess; }
 
@@ -58,30 +58,27 @@ obj ext_ctxt(sess: @session,
             let tmp = pre;
             backtrace = tmp;
           }
-          _ { self.bug(~"tried to pop without a push"); }
+          _ { self.bug("tried to pop without a push"); }
         }
     }
 
-    fn span_fatal(sp: span, msg: istr) -> ! {
+    fn span_fatal(sp: span, msg: str) -> ! {
         self.print_backtrace();
         sess.span_fatal(sp, msg);
     }
-    fn span_err(sp: span, msg: istr) {
+    fn span_err(sp: span, msg: str) {
         self.print_backtrace();
         sess.span_err(sp, msg);
     }
-    fn span_unimpl(sp: span, msg: istr) -> ! {
+    fn span_unimpl(sp: span, msg: str) -> ! {
         self.print_backtrace();
         sess.span_unimpl(sp, msg);
     }
-    fn span_bug(sp: span, msg: istr) -> ! {
+    fn span_bug(sp: span, msg: str) -> ! {
         self.print_backtrace();
         sess.span_bug(sp, msg);
     }
-    fn bug(msg: istr) -> ! {
-        self.print_backtrace();
-        sess.bug(msg);
-    }
+    fn bug(msg: str) -> ! { self.print_backtrace(); sess.bug(msg); }
     fn next_id() -> ast::node_id { ret sess.next_node_id(); }
 
 }
@@ -96,11 +93,10 @@ fn mk_ctxt(sess: &session) -> ext_ctxt {
     // super-ugly and needs a better solution.
     let crate_file_name_hack = sess.get_codemap().files[0].name;
 
-    ret ext_ctxt(@sess, crate_file_name_hack,
-                 codemap::os_none);
+    ret ext_ctxt(@sess, crate_file_name_hack, codemap::os_none);
 }
 
-fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: &istr) -> istr {
+fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: &str) -> str {
     alt expr.node {
       ast::expr_lit(l) {
         alt l.node {
@@ -112,8 +108,7 @@ fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: &istr) -> istr {
     }
 }
 
-fn expr_to_ident(cx: &ext_ctxt, expr: @ast::expr,
-                 error: &istr) -> ast::ident {
+fn expr_to_ident(cx: &ext_ctxt, expr: @ast::expr, error: &str) -> ast::ident {
     alt expr.node {
       ast::expr_path(p) {
         if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs
index f5ce004ea00..53ee6cb0397 100644
--- a/src/comp/syntax/ext/concat_idents.rs
+++ b/src/comp/syntax/ext/concat_idents.rs
@@ -3,17 +3,17 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: &option::t<istr>) -> @ast::expr {
+                     _body: &option::t<str>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
           _ {
-            cx.span_fatal(sp, ~"#concat_idents requires a vector argument .")
+            cx.span_fatal(sp, "#concat_idents requires a vector argument .")
           }
         };
-    let res: ast::ident = ~"";
+    let res: ast::ident = "";
     for e: @ast::expr in args {
-        res += expr_to_ident(cx, e, ~"expected an ident");
+        res += expr_to_ident(cx, e, "expected an ident");
     }
 
     ret @{id: cx.next_id(),
diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs
index 487b12d0bc2..081bfd80c1d 100644
--- a/src/comp/syntax/ext/env.rs
+++ b/src/comp/syntax/ext/env.rs
@@ -12,30 +12,28 @@ import base::*;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: &option::t<istr>) -> @ast::expr {
+                     _body: &option::t<str>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
           _ {
-            cx.span_fatal(sp, ~"#env requires arguments of the form `[...]`.")
+            cx.span_fatal(sp, "#env requires arguments of the form `[...]`.")
           }
         };
     if vec::len::<@ast::expr>(args) != 1u {
-        cx.span_fatal(sp, ~"malformed #env call");
+        cx.span_fatal(sp, "malformed #env call");
     }
     // FIXME: if this was more thorough it would manufacture an
     // option::t<str> rather than just an maybe-empty string.
 
-    let var = expr_to_str(cx, args[0], ~"#env requires a string");
+    let var = expr_to_str(cx, args[0], "#env requires a string");
     alt generic_os::getenv(var) {
-      option::none. { ret make_new_str(cx, sp, ~""); }
-      option::some(s) {
-        ret make_new_str(cx, sp, s);
-      }
+      option::none. { ret make_new_str(cx, sp, ""); }
+      option::some(s) { ret make_new_str(cx, sp, s); }
     }
 }
 
-fn make_new_str(cx: &ext_ctxt, sp: codemap::span, s: &istr) -> @ast::expr {
+fn make_new_str(cx: &ext_ctxt, sp: codemap::span, s: &str) -> @ast::expr {
     ret make_new_lit(cx, sp, ast::lit_str(s));
 }
 //
diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs
index c2a3a201126..7037139bd93 100644
--- a/src/comp/syntax/ext/expand.rs
+++ b/src/comp/syntax/ext/expand.rs
@@ -15,7 +15,7 @@ import syntax::fold::*;
 import syntax::ext::base::*;
 
 
-fn expand_expr(exts: &hashmap<istr, syntax_extension>, cx: &ext_ctxt,
+fn expand_expr(exts: &hashmap<str, syntax_extension>, cx: &ext_ctxt,
                e: &expr_, fld: ast_fold, orig: &fn(&expr_, ast_fold) -> expr_)
    -> expr_ {
     ret alt e {
@@ -27,8 +27,7 @@ fn expand_expr(exts: &hashmap<istr, syntax_extension>, cx: &ext_ctxt,
                 alt exts.find(extname) {
                   none. {
                     cx.span_fatal(pth.span,
-                                  #fmt["macro undefined: '%s'",
-                                       extname])
+                                  #fmt["macro undefined: '%s'", extname])
                   }
                   some(normal(ext)) {
                     let expanded = ext(cx, pth.span, args, body);
@@ -42,14 +41,12 @@ fn expand_expr(exts: &hashmap<istr, syntax_extension>, cx: &ext_ctxt,
                   }
                   some(macro_defining(ext)) {
                     let named_extension = ext(cx, pth.span, args, body);
-                    exts.insert(
-                        named_extension.ident,
-                        named_extension.ext);
+                    exts.insert(named_extension.ident, named_extension.ext);
                     ast::expr_rec([], none)
                   }
                 }
               }
-              _ { cx.span_bug(mac.span, ~"naked syntactic bit") }
+              _ { cx.span_bug(mac.span, "naked syntactic bit") }
             }
           }
           _ { orig(e, fld) }
diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs
index 91a83b06267..aef3cc46902 100644
--- a/src/comp/syntax/ext/fmt.rs
+++ b/src/comp/syntax/ext/fmt.rs
@@ -16,26 +16,24 @@ import codemap::span;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
-                     _body: &option::t<istr>) -> @ast::expr {
+                     _body: &option::t<str>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
           _ {
-            cx.span_fatal(
-                sp, ~"#fmt requires arguments of the form `[...]`.")
+            cx.span_fatal(sp, "#fmt requires arguments of the form `[...]`.")
           }
         };
     if vec::len::<@ast::expr>(args) == 0u {
-        cx.span_fatal(sp, ~"#fmt requires a format string");
+        cx.span_fatal(sp, "#fmt requires a format string");
     }
     let fmt =
         expr_to_str(cx, args[0],
-                    ~"first argument to #fmt must be a "
-                    + ~"string literal.");
+                    "first argument to #fmt must be a " + "string literal.");
     let fmtspan = args[0].span;
     log "Format string:";
     log fmt;
-    fn parse_fmt_err_(cx: &ext_ctxt, sp: span, msg: &istr) -> ! {
+    fn parse_fmt_err_(cx: &ext_ctxt, sp: span, msg: &str) -> ! {
         cx.span_fatal(sp, msg);
     }
     let parse_fmt_err = bind parse_fmt_err_(cx, fmtspan, _);
@@ -52,7 +50,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
         let sp_lit = @{node: lit, span: sp};
         ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp};
     }
-    fn make_new_str(cx: &ext_ctxt, sp: span, s: &istr) -> @ast::expr {
+    fn make_new_str(cx: &ext_ctxt, sp: span, s: &str) -> @ast::expr {
         let lit = ast::lit_str(s);
         ret make_new_lit(cx, sp, lit);
     }
@@ -103,14 +101,13 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
     }
     fn make_path_vec(cx: &ext_ctxt, ident: &ast::ident) -> [ast::ident] {
         fn compiling_std(cx: &ext_ctxt) -> bool {
-            ret str::find(cx.crate_file_name(), ~"std.rc") >= 0;
+            ret str::find(cx.crate_file_name(), "std.rc") >= 0;
         }
         if compiling_std(cx) {
-            ret [~"extfmt", ~"rt", ident];
-        } else { ret [~"std", ~"extfmt", ~"rt", ident]; }
+            ret ["extfmt", "rt", ident];
+        } else { ret ["std", "extfmt", "rt", ident]; }
     }
-    fn make_rt_path_expr(cx: &ext_ctxt, sp: span,
-                         ident: &istr) -> @ast::expr {
+    fn make_rt_path_expr(cx: &ext_ctxt, sp: span, ident: &str) -> @ast::expr {
         let path = make_path_vec(cx, ident);
         ret make_path_expr(cx, sp, path);
     }
@@ -123,11 +120,11 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             for f: flag in flags {
                 let fstr;
                 alt f {
-                  flag_left_justify. { fstr = ~"flag_left_justify"; }
-                  flag_left_zero_pad. { fstr = ~"flag_left_zero_pad"; }
-                  flag_space_for_sign. { fstr = ~"flag_space_for_sign"; }
-                  flag_sign_always. { fstr = ~"flag_sign_always"; }
-                  flag_alternate. { fstr = ~"flag_alternate"; }
+                  flag_left_justify. { fstr = "flag_left_justify"; }
+                  flag_left_zero_pad. { fstr = "flag_left_zero_pad"; }
+                  flag_space_for_sign. { fstr = "flag_space_for_sign"; }
+                  flag_sign_always. { fstr = "flag_sign_always"; }
+                  flag_alternate. { fstr = "flag_alternate"; }
                 }
                 flagexprs += [make_rt_path_expr(cx, sp, fstr)];
             }
@@ -136,22 +133,22 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             // this is a hack placeholder flag
 
             if vec::len::<@ast::expr>(flagexprs) == 0u {
-                flagexprs += [make_rt_path_expr(cx, sp, ~"flag_none")];
+                flagexprs += [make_rt_path_expr(cx, sp, "flag_none")];
             }
             ret make_vec_expr(cx, sp, flagexprs);
         }
         fn make_count(cx: &ext_ctxt, sp: span, cnt: &count) -> @ast::expr {
             alt cnt {
               count_implied. {
-                ret make_rt_path_expr(cx, sp, ~"count_implied");
+                ret make_rt_path_expr(cx, sp, "count_implied");
               }
               count_is(c) {
                 let count_lit = make_new_int(cx, sp, c);
-                let count_is_path = make_path_vec(cx, ~"count_is");
+                let count_is_path = make_path_vec(cx, "count_is");
                 let count_is_args = [count_lit];
                 ret make_call(cx, sp, count_is_path, count_is_args);
               }
-              _ { cx.span_unimpl(sp, ~"unimplemented #fmt conversion"); }
+              _ { cx.span_unimpl(sp, "unimplemented #fmt conversion"); }
             }
         }
         fn make_ty(cx: &ext_ctxt, sp: span, t: &ty) -> @ast::expr {
@@ -159,13 +156,13 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             alt t {
               ty_hex(c) {
                 alt c {
-                  case_upper. { rt_type = ~"ty_hex_upper"; }
-                  case_lower. { rt_type = ~"ty_hex_lower"; }
+                  case_upper. { rt_type = "ty_hex_upper"; }
+                  case_lower. { rt_type = "ty_hex_lower"; }
                 }
               }
-              ty_bits. { rt_type = ~"ty_bits"; }
-              ty_octal. { rt_type = ~"ty_octal"; }
-              _ { rt_type = ~"ty_default"; }
+              ty_bits. { rt_type = "ty_bits"; }
+              ty_octal. { rt_type = "ty_octal"; }
+              _ { rt_type = "ty_default"; }
             }
             ret make_rt_path_expr(cx, sp, rt_type);
         }
@@ -173,10 +170,10 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
                          width_expr: @ast::expr, precision_expr: @ast::expr,
                          ty_expr: @ast::expr) -> @ast::expr {
             ret make_rec_expr(cx, sp,
-                              [{ident: ~"flags", ex: flags_expr},
-                               {ident: ~"width", ex: width_expr},
-                               {ident: ~"precision", ex: precision_expr},
-                               {ident: ~"ty", ex: ty_expr}]);
+                              [{ident: "flags", ex: flags_expr},
+                               {ident: "width", ex: width_expr},
+                               {ident: "precision", ex: precision_expr},
+                               {ident: "ty", ex: ty_expr}]);
         }
         let rt_conv_flags = make_flags(cx, sp, cnv.flags);
         let rt_conv_width = make_count(cx, sp, cnv.width);
@@ -185,9 +182,9 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
         ret make_conv_rec(cx, sp, rt_conv_flags, rt_conv_width,
                           rt_conv_precision, rt_conv_ty);
     }
-    fn make_conv_call(cx: &ext_ctxt, sp: span, conv_type: &istr,
-                      cnv: &conv, arg: @ast::expr) -> @ast::expr {
-        let fname = ~"conv_" + conv_type;
+    fn make_conv_call(cx: &ext_ctxt, sp: span, conv_type: &str, cnv: &conv,
+                      arg: @ast::expr) -> @ast::expr {
+        let fname = "conv_" + conv_type;
         let path = make_path_vec(cx, fname);
         let cnv_expr = make_rt_conv_expr(cx, sp, cnv);
         let args = [cnv_expr, arg];
@@ -205,7 +202,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
               _ { ret false; }
             }
         }
-        let unsupported = ~"conversion not supported in #fmt string";
+        let unsupported = "conversion not supported in #fmt string";
         alt cnv.param {
           option::none. { }
           _ { cx.span_unimpl(sp, unsupported); }
@@ -216,15 +213,15 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
               flag_sign_always. {
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
-                                  ~"+ flag only valid in " +
-                                      ~"signed #fmt conversion");
+                                  "+ flag only valid in " +
+                                      "signed #fmt conversion");
                 }
               }
               flag_space_for_sign. {
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
-                                  ~"space flag only valid in " +
-                                      ~"signed #fmt conversions");
+                                  "space flag only valid in " +
+                                      "signed #fmt conversions");
                 }
               }
               flag_left_zero_pad. { }
@@ -242,28 +239,26 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
           _ { cx.span_unimpl(sp, unsupported); }
         }
         alt cnv.ty {
-          ty_str. { ret make_conv_call(cx, arg.span, ~"str", cnv, arg); }
+          ty_str. { ret make_conv_call(cx, arg.span, "str", cnv, arg); }
           ty_int(sign) {
             alt sign {
-              signed. { ret make_conv_call(cx, arg.span, ~"int", cnv, arg); }
+              signed. { ret make_conv_call(cx, arg.span, "int", cnv, arg); }
               unsigned. {
-                ret make_conv_call(cx, arg.span, ~"uint", cnv, arg);
+                ret make_conv_call(cx, arg.span, "uint", cnv, arg);
               }
             }
           }
-          ty_bool. { ret make_conv_call(cx, arg.span, ~"bool", cnv, arg); }
-          ty_char. { ret make_conv_call(cx, arg.span, ~"char", cnv, arg); }
-          ty_hex(_) { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); }
-          ty_bits. { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); }
-          ty_octal. { ret make_conv_call(cx, arg.span, ~"uint", cnv, arg); }
+          ty_bool. { ret make_conv_call(cx, arg.span, "bool", cnv, arg); }
+          ty_char. { ret make_conv_call(cx, arg.span, "char", cnv, arg); }
+          ty_hex(_) { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
+          ty_bits. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
+          ty_octal. { ret make_conv_call(cx, arg.span, "uint", cnv, arg); }
           _ { cx.span_unimpl(sp, unsupported); }
         }
     }
     fn log_conv(c: conv) {
         alt c.param {
-          some(p) {
-            log ~"param: " + std::int::to_str(p, 10u);
-          }
+          some(p) { log "param: " + std::int::to_str(p, 10u); }
           _ { log "param: none"; }
         }
         for f: flag in c.flags {
@@ -276,21 +271,17 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             }
         }
         alt c.width {
-          count_is(i) { log ~"width: count is "
-              + std::int::to_str(i, 10u); }
+          count_is(i) { log "width: count is " + std::int::to_str(i, 10u); }
           count_is_param(i) {
-            log ~"width: count is param "
-                + std::int::to_str(i, 10u);
+            log "width: count is param " + std::int::to_str(i, 10u);
           }
           count_is_next_param. { log "width: count is next param"; }
           count_implied. { log "width: count is implied"; }
         }
         alt c.precision {
-          count_is(i) { log ~"prec: count is "
-              + std::int::to_str(i, 10u); }
+          count_is(i) { log "prec: count is " + std::int::to_str(i, 10u); }
           count_is_param(i) {
-            log ~"prec: count is param "
-                + std::int::to_str(i, 10u);
+            log "prec: count is param " + std::int::to_str(i, 10u);
           }
           count_is_next_param. { log "prec: count is next param"; }
           count_implied. { log "prec: count is implied"; }
@@ -317,7 +308,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
     }
     let fmt_sp = args[0].span;
     let n = 0u;
-    let tmp_expr = make_new_str(cx, sp, ~"");
+    let tmp_expr = make_new_str(cx, sp, "");
     let nargs = vec::len::<@ast::expr>(args);
     for pc: piece in pieces {
         alt pc {
@@ -329,8 +320,8 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             n += 1u;
             if n >= nargs {
                 cx.span_fatal(sp,
-                              ~"not enough arguments to #fmt " +
-                                  ~"for the given format string");
+                              "not enough arguments to #fmt " +
+                                  "for the given format string");
             }
             log "Building conversion:";
             log_conv(conv);
diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs
index f30d6932555..1cf015fcaf0 100644
--- a/src/comp/syntax/ext/ident_to_str.rs
+++ b/src/comp/syntax/ext/ident_to_str.rs
@@ -5,20 +5,20 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: &option::t<istr>) -> @ast::expr {
+                     _body: &option::t<str>) -> @ast::expr {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
           _ {
-            cx.span_fatal(sp, ~"#ident_to_str requires a vector argument .")
+            cx.span_fatal(sp, "#ident_to_str requires a vector argument .")
           }
         };
     if vec::len::<@ast::expr>(args) != 1u {
-        cx.span_fatal(sp, ~"malformed #ident_to_str call");
+        cx.span_fatal(sp, "malformed #ident_to_str call");
     }
 
     ret make_new_lit(cx, sp,
                      ast::lit_str(expr_to_ident(cx, args[0u],
-                                                ~"expected an ident")));
+                                                "expected an ident")));
 
 }
diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs
index a8fa657c20c..50e7e307bdc 100644
--- a/src/comp/syntax/ext/log_syntax.rs
+++ b/src/comp/syntax/ext/log_syntax.rs
@@ -4,11 +4,10 @@ import syntax::ast;
 import std::str;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     _body: &option::t<istr>) -> @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(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/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs
index 3496791ce6e..4e76ec0d787 100644
--- a/src/comp/syntax/ext/simplext.rs
+++ b/src/comp/syntax/ext/simplext.rs
@@ -57,29 +57,29 @@ tag matchable {
 }
 
 /* for when given an incompatible bit of AST */
-fn match_error(cx: &ext_ctxt, m: &matchable, expected: &istr) -> ! {
+fn match_error(cx: &ext_ctxt, m: &matchable, expected: &str) -> ! {
     alt m {
       match_expr(x) {
         cx.span_fatal(x.span,
-                      ~"this argument is an expr, expected " + expected);
+                      "this argument is an expr, expected " + expected);
       }
       match_path(x) {
         cx.span_fatal(x.span,
-                      ~"this argument is a path, expected " + expected);
+                      "this argument is a path, expected " + expected);
       }
       match_ident(x) {
         cx.span_fatal(x.span,
-                      ~"this argument is an ident, expected " + expected);
+                      "this argument is an ident, expected " + expected);
       }
       match_ty(x) {
         cx.span_fatal(x.span,
-                      ~"this argument is a type, expected " + expected);
+                      "this argument is a type, expected " + expected);
       }
       match_block(x) {
         cx.span_fatal(x.span,
-                      ~"this argument is a block, expected " + expected);
+                      "this argument is a block, expected " + expected);
       }
-      match_exact. { cx.bug(~"what is a match_exact doing in a bindings?"); }
+      match_exact. { cx.bug("what is a match_exact doing in a bindings?"); }
     }
 }
 
@@ -102,7 +102,7 @@ fn elts_to_ell(cx: &ext_ctxt, elts: &[@expr]) ->
             alt m.node {
               ast::mac_ellipsis. {
                 if res != none {
-                    cx.span_fatal(m.span, ~"only one ellipsis allowed");
+                    cx.span_fatal(m.span, "only one ellipsis allowed");
                 }
                 res =
                     some({pre: vec::slice(elts, 0u, idx - 1u),
@@ -190,8 +190,7 @@ fn use_selectors_to_bind(b: &binders, e: @expr) -> option::t<bindings> {
         alt sel(match_expr(e)) { none. { ret none; } _ { } }
     }
     let never_mind: bool = false;
-    for each pair: @{key: ident,
-                     val: selector} in b.real_binders.items() {
+    for each pair: @{key: ident, val: selector} in b.real_binders.items() {
         alt pair.val(match_expr(e)) {
           none. { never_mind = true; }
           some(mtc) { res.insert(pair.key, mtc); }
@@ -252,8 +251,8 @@ fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t<arb_depth<matchable>>,
         ret alt follow(m, idx_path) {
               seq(_, sp) {
                 cx.span_fatal(sp,
-                              ~"syntax matched under ... but not " +
-                                  ~"used that way.")
+                              "syntax matched under ... but not " +
+                                  "used that way.")
               }
               leaf(m) { ret some(m) }
             }
@@ -267,9 +266,7 @@ iter free_vars(b: &bindings, e: @expr) -> ident {
     let idents: hashmap<ident, ()> = new_str_hash::<()>();
     fn mark_ident(i: &ident, _fld: ast_fold, b: &bindings,
                   idents: &hashmap<ident, ()>) -> ident {
-        if b.contains_key(i) {
-            idents.insert(i, ());
-        }
+        if b.contains_key(i) { idents.insert(i, ()); }
         ret i;
     }
     // using fold is a hack: we want visit, but it doesn't hit idents ) :
@@ -309,13 +306,10 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
                         let len = vec::len(*ms);
                         if old_len != len {
                             let msg =
-                                #fmt["'%s' occurs %u times, but ",
-                                     fv, len] +
-                                    #fmt["'%s' occurs %u times",
-                                         old_name,
+                                #fmt["'%s' occurs %u times, but ", fv, len] +
+                                    #fmt["'%s' occurs %u times", old_name,
                                          old_len];
-                            cx.span_fatal(
-                                repeat_me.span, msg);
+                            cx.span_fatal(repeat_me.span, msg);
                         }
                       }
                     }
@@ -325,8 +319,8 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
             alt repeat {
               none. {
                 cx.span_fatal(repeat_me.span,
-                              ~"'...' surrounds an expression without any" +
-                                  ~" repeating syntax variables");
+                              "'...' surrounds an expression without any" +
+                                  " repeating syntax variables");
               }
               some({rep_count: rc, _}) {
                 /* Whew, we now know how how many times to repeat */
@@ -354,7 +348,7 @@ fn transcribe_ident(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
                     i: &ident, _fld: ast_fold) -> ident {
     ret alt follow_for_trans(cx, b.find(i), idx_path) {
           some(match_ident(a_id)) { a_id.node }
-          some(m) { match_error(cx, m, ~"an identifier") }
+          some(m) { match_error(cx, m, "an identifier") }
           none. { i }
         }
 }
@@ -369,7 +363,7 @@ fn transcribe_path(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
             {global: false, idents: [id.node], types: []}
           }
           some(match_path(a_pth)) { a_pth.node }
-          some(m) { match_error(cx, m, ~"a path") }
+          some(m) { match_error(cx, m, "a path") }
           none. { p }
         }
 }
@@ -394,7 +388,7 @@ fn transcribe_expr(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
               }
               some(match_path(a_pth)) { expr_path(a_pth) }
               some(match_expr(a_exp)) { a_exp.node }
-              some(m) { match_error(cx, m, ~"an expression") }
+              some(m) { match_error(cx, m, "an expression") }
               none. { orig(e, fld) }
             }
           }
@@ -411,7 +405,7 @@ fn transcribe_type(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
               some(id) {
                 alt follow_for_trans(cx, b.find(id), idx_path) {
                   some(match_ty(ty)) { ty.node }
-                  some(m) { match_error(cx, m, ~"a type") }
+                  some(m) { match_error(cx, m, "a type") }
                   none. { orig(t, fld) }
                 }
               }
@@ -431,14 +425,14 @@ fn transcribe_block(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
                     orig: fn(&blk_, ast_fold) -> blk_) -> blk_ {
     ret alt block_to_ident(blk) {
           some(id) {
-            alt follow_for_trans(cx, b.find(
-                id), idx_path) {
+            alt follow_for_trans(cx, b.find(id), idx_path) {
               some(match_block(new_blk)) { new_blk.node }
 
 
+
               // possibly allow promotion of ident/path/expr to blocks?
               some(m) {
-                match_error(cx, m, ~"a block")
+                match_error(cx, m, "a block")
               }
               none. { orig(blk, fld) }
             }
@@ -469,12 +463,12 @@ fn p_t_s_rec(cx: &ext_ctxt, m: &matchable, s: &selector, b: &binders) {
 
                 if vec::len(post) > 0u {
                     cx.span_unimpl(e.span,
-                                   ~"matching after `...` not yet supported");
+                                   "matching after `...` not yet supported");
                 }
               }
               {pre: pre, rep: none., post: post} {
                 if post != [] {
-                    cx.bug(~"elts_to_ell provided an invalid result");
+                    cx.bug("elts_to_ell provided an invalid result");
                 }
                 p_t_s_r_length(cx, vec::len(pre), false, s, b);
                 p_t_s_r_actual_vector(cx, pre, false, s, b);
@@ -483,6 +477,7 @@ fn p_t_s_rec(cx: &ext_ctxt, m: &matchable, s: &selector, b: &binders) {
           }
 
 
+
           /* TODO: handle embedded types and blocks, at least */
           expr_mac(mac) {
             p_t_s_r_mac(cx, mac, s, b);
@@ -494,7 +489,7 @@ fn p_t_s_rec(cx: &ext_ctxt, m: &matchable, s: &selector, b: &binders) {
                       match_expr(e) {
                         if e == pat { some(leaf(match_exact)) } else { none }
                       }
-                      _ { cx.bug(~"broken traversal in p_t_s_r") }
+                      _ { cx.bug("broken traversal in p_t_s_r") }
                     }
             }
             b.literal_ast_matchers += [bind select(cx, _, e)];
@@ -530,14 +525,13 @@ fn p_t_s_r_path(cx: &ext_ctxt, p: &path, s: &selector, b: &binders) {
         fn select(cx: &ext_ctxt, m: &matchable) -> match_result {
             ret alt m {
                   match_expr(e) { some(leaf(specialize_match(m))) }
-                  _ { cx.bug(~"broken traversal in p_t_s_r") }
+                  _ { cx.bug("broken traversal in p_t_s_r") }
                 }
         }
         if b.real_binders.contains_key(p_id) {
-            cx.span_fatal(p.span, ~"duplicate binding identifier");
+            cx.span_fatal(p.span, "duplicate binding identifier");
         }
-        b.real_binders.insert(p_id,
-                              compose_sels(s, bind select(cx, _)));
+        b.real_binders.insert(p_id, compose_sels(s, bind select(cx, _)));
       }
       none. { }
     }
@@ -560,16 +554,15 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) {
               match_expr(e) {
                 alt e.node { expr_mac(mac) { fn_m(mac) } _ { none } }
               }
-              _ { cx.bug(~"broken traversal in p_t_s_r") }
+              _ { cx.bug("broken traversal in p_t_s_r") }
             }
     }
-    fn no_des(cx: &ext_ctxt, sp: &span, syn: &istr) -> ! {
-        cx.span_fatal(sp, ~"destructuring "
-                      + syn + ~" is not yet supported");
+    fn no_des(cx: &ext_ctxt, sp: &span, syn: &str) -> ! {
+        cx.span_fatal(sp, "destructuring " + syn + " is not yet supported");
     }
     alt mac.node {
-      ast::mac_ellipsis. { cx.span_fatal(mac.span, ~"misused `...`"); }
-      ast::mac_invoc(_, _, _) { no_des(cx, mac.span, ~"macro calls"); }
+      ast::mac_ellipsis. { cx.span_fatal(mac.span, "misused `...`"); }
+      ast::mac_invoc(_, _, _) { no_des(cx, mac.span, "macro calls"); }
       ast::mac_embed_type(ty) {
         alt ty.node {
           ast::ty_path(pth, _) {
@@ -583,13 +576,12 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) {
                         }
                 }
                 let final_step = bind select_pt_1(cx, _, select_pt_2);
-                b.real_binders.insert(
-                    id, compose_sels(s, final_step));
+                b.real_binders.insert(id, compose_sels(s, final_step));
               }
-              none. { no_des(cx, pth.span, ~"under `#<>`"); }
+              none. { no_des(cx, pth.span, "under `#<>`"); }
             }
           }
-          _ { no_des(cx, ty.span, ~"under `#<>`"); }
+          _ { no_des(cx, ty.span, "under `#<>`"); }
         }
       }
       ast::mac_embed_block(blk) {
@@ -604,10 +596,9 @@ fn p_t_s_r_mac(cx: &ext_ctxt, mac: &ast::mac, s: &selector, b: &binders) {
                     }
             }
             let final_step = bind select_pt_1(cx, _, select_pt_2);
-            b.real_binders.insert(id,
-                                  compose_sels(s, final_step));
+            b.real_binders.insert(id, compose_sels(s, final_step));
           }
-          none. { no_des(cx, blk.span, ~"under `#{}`"); }
+          none. { no_des(cx, blk.span, "under `#{}`"); }
         }
       }
     }
@@ -635,7 +626,7 @@ fn p_t_s_r_ellipses(cx: &ext_ctxt, repeat_me: @expr, offset: uint,
                   _ { none }
                 }
               }
-              _ { cx.bug(~"broken traversal in p_t_s_r") }
+              _ { cx.bug("broken traversal in p_t_s_r") }
             }
     }
     p_t_s_rec(cx, match_expr(repeat_me),
@@ -680,7 +671,7 @@ fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], _repeat_after: bool,
                       _ { none }
                     }
                   }
-                  _ { cx.bug(~"broken traversal in p_t_s_r") }
+                  _ { cx.bug("broken traversal in p_t_s_r") }
                 }
         }
         p_t_s_rec(cx, match_expr(elts[idx]),
@@ -690,25 +681,25 @@ fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], _repeat_after: bool,
 }
 
 fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                     _body: &option::t<istr>) -> base::macro_def {
+                     _body: &option::t<str>) -> base::macro_def {
     let args: [@ast::expr] =
         alt arg.node {
           ast::expr_vec(elts, _) { elts }
           _ {
             cx.span_fatal(sp,
-                          ~"#macro requires arguments of the form `[...]`.")
+                          "#macro requires arguments of the form `[...]`.")
           }
         };
 
-    let macro_name: option::t<istr> = none;
+    let macro_name: option::t<str> = none;
     let clauses: [@clause] = [];
     for arg: @expr in args {
         alt arg.node {
           expr_vec(elts, mut) {
             if vec::len(elts) != 2u {
                 cx.span_fatal((*arg).span,
-                              ~"extension clause must consist of [" +
-                                  ~"macro invocation, expansion body]");
+                              "extension clause must consist of [" +
+                                  "macro invocation, expansion body]");
             }
 
 
@@ -723,15 +714,15 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
                           some(other_id) {
                             if id != other_id {
                                 cx.span_fatal(pth.span,
-                                              ~"macro name must be " +
-                                                  ~"consistent");
+                                              "macro name must be " +
+                                                  "consistent");
                             }
                           }
                         }
                       }
                       none. {
                         cx.span_fatal(pth.span,
-                                      ~"macro name must not be a path");
+                                      "macro name must not be a path");
                       }
                     }
                     clauses +=
@@ -744,14 +735,14 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
               }
               _ {
                 cx.span_fatal(elts[0u].span,
-                              ~"extension clause must" +
-                                  ~" start with a macro invocation.");
+                              "extension clause must" +
+                                  " start with a macro invocation.");
               }
             }
           }
           _ {
             cx.span_fatal((*arg).span,
-                          ~"extension must be [clause, " + ~" ...]");
+                          "extension must be [clause, " + " ...]");
           }
         }
     }
@@ -763,22 +754,22 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
                some(id) { id }
                none. {
                  cx.span_fatal(sp,
-                               ~"macro definition must have " +
-                                   ~"at least one clause")
+                               "macro definition must have " +
+                                   "at least one clause")
                }
              },
          ext: normal(ext)};
 
     fn generic_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                         _body: &option::t<istr>,
-                         clauses: [@clause]) -> @expr {
+                         _body: &option::t<str>, clauses: [@clause]) ->
+       @expr {
         for c: @clause in clauses {
             alt use_selectors_to_bind(c.params, arg) {
               some(bindings) { ret transcribe(cx, bindings, c.body) }
               none. { cont; }
             }
         }
-        cx.span_fatal(sp, ~"no clauses match macro invocation");
+        cx.span_fatal(sp, "no clauses match macro invocation");
     }
 }