about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-22 15:16:31 -0700
committerbors <bors@rust-lang.org>2014-05-22 15:16:31 -0700
commit87ad19eb78239707f1ceed43e475c6aa052efdbc (patch)
tree35940d52f145bca81dcf73e5e7da7f3847ceb413 /src/libsyntax
parente402e75f4eb79af09b9451f0f232f994b3e2c998 (diff)
parente878721d70349e2055f0ef854085de92e9498fde (diff)
downloadrust-87ad19eb78239707f1ceed43e475c6aa052efdbc.tar.gz
rust-87ad19eb78239707f1ceed43e475c6aa052efdbc.zip
auto merge of #14310 : pcwalton/rust/detildestr-alllibs, r=brson
r? @brson
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/attr.rs3
-rw-r--r--src/libsyntax/crateid.rs12
-rw-r--r--src/libsyntax/diagnostic.rs25
-rw-r--r--src/libsyntax/ext/asm.rs9
-rw-r--r--src/libsyntax/ext/base.rs9
-rw-r--r--src/libsyntax/ext/concat.rs8
-rw-r--r--src/libsyntax/ext/concat_idents.rs2
-rw-r--r--src/libsyntax/ext/deriving/bounds.rs14
-rw-r--r--src/libsyntax/ext/deriving/clone.rs26
-rw-r--r--src/libsyntax/ext/deriving/decodable.rs2
-rw-r--r--src/libsyntax/ext/deriving/encodable.rs3
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs45
-rw-r--r--src/libsyntax/ext/deriving/mod.rs6
-rw-r--r--src/libsyntax/ext/env.rs6
-rw-r--r--src/libsyntax/ext/expand.rs52
-rw-r--r--src/libsyntax/ext/format.rs44
-rw-r--r--src/libsyntax/ext/quote.rs6
-rw-r--r--src/libsyntax/ext/source_util.rs18
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs9
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs9
-rw-r--r--src/libsyntax/parse/attr.rs2
-rw-r--r--src/libsyntax/parse/lexer.rs7
-rw-r--r--src/libsyntax/parse/mod.rs8
-rw-r--r--src/libsyntax/parse/obsolete.rs8
-rw-r--r--src/libsyntax/parse/parser.rs139
-rw-r--r--src/libsyntax/print/pp.rs4
-rw-r--r--src/libsyntax/print/pprust.rs42
28 files changed, 321 insertions, 199 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 5a57c2d6cc6..bc660798240 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -396,7 +396,8 @@ pub fn require_unique_names(diagnostic: &SpanHandler, metas: &[@MetaItem]) {
 
         if !set.insert(name.clone()) {
             diagnostic.span_fatal(meta.span,
-                                  format!("duplicate meta item `{}`", name));
+                                  format!("duplicate meta item `{}`",
+                                          name).as_slice());
         }
     }
 }
diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs
index b7700cf396d..dc699bb9850 100644
--- a/src/libsyntax/crateid.rs
+++ b/src/libsyntax/crateid.rs
@@ -39,7 +39,9 @@ impl fmt::Show for CrateId {
             Some(ref version) => version.as_slice(),
         };
         if self.path == self.name ||
-                self.path.as_slice().ends_with(format!("/{}", self.name)) {
+                self.path
+                    .as_slice()
+                    .ends_with(format!("/{}", self.name).as_slice()) {
             write!(f, "\\#{}", version)
         } else {
             write!(f, "\\#{}:{}", self.name, version)
@@ -52,12 +54,14 @@ impl FromStr for CrateId {
         let pieces: Vec<&str> = s.splitn('#', 1).collect();
         let path = pieces.get(0).to_owned();
 
-        if path.starts_with("/") || path.ends_with("/") ||
-            path.starts_with(".") || path.is_empty() {
+        if path.as_slice().starts_with("/") || path.as_slice().ends_with("/") ||
+            path.as_slice().starts_with(".") || path.is_empty() {
             return None;
         }
 
-        let path_pieces: Vec<&str> = path.rsplitn('/', 1).collect();
+        let path_pieces: Vec<&str> = path.as_slice()
+                                         .rsplitn('/', 1)
+                                         .collect();
         let inferred_name = *path_pieces.get(0);
 
         let (name, version) = if pieces.len() == 1 {
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 3eb6f40ba53..446a8f93753 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -106,7 +106,7 @@ impl SpanHandler {
         fail!(ExplicitBug);
     }
     pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
-        self.span_bug(sp, "unimplemented ".to_owned() + msg);
+        self.span_bug(sp, format!("unimplemented {}", msg).as_slice());
     }
     pub fn handler<'a>(&'a self) -> &'a Handler {
         &self.handler
@@ -143,13 +143,13 @@ impl Handler {
         let s;
         match self.err_count.get() {
           0u => return,
-          1u => s = "aborting due to previous error".to_owned(),
+          1u => s = "aborting due to previous error".to_strbuf(),
           _  => {
             s = format!("aborting due to {} previous errors",
-                     self.err_count.get());
+                        self.err_count.get());
           }
         }
-        self.fatal(s);
+        self.fatal(s.as_slice());
     }
     pub fn warn(&self, msg: &str) {
         self.emit.borrow_mut().emit(None, msg, Warning);
@@ -162,7 +162,7 @@ impl Handler {
         fail!(ExplicitBug);
     }
     pub fn unimpl(&self, msg: &str) -> ! {
-        self.bug("unimplemented ".to_owned() + msg);
+        self.bug(format!("unimplemented {}", msg).as_slice());
     }
     pub fn emit(&self,
                 cmsp: Option<(&codemap::CodeMap, Span)>,
@@ -267,9 +267,12 @@ fn print_diagnostic(dst: &mut EmitterWriter,
         try!(write!(&mut dst.dst, "{} ", topic));
     }
 
-    try!(print_maybe_styled(dst, format!("{}: ", lvl.to_str()),
+    try!(print_maybe_styled(dst,
+                            format!("{}: ", lvl.to_str()).as_slice(),
                             term::attr::ForegroundColor(lvl.color())));
-    try!(print_maybe_styled(dst, format!("{}\n", msg), term::attr::Bold));
+    try!(print_maybe_styled(dst,
+                            format!("{}\n", msg).as_slice(),
+                            term::attr::Bold));
     Ok(())
 }
 
@@ -431,7 +434,8 @@ fn highlight_lines(err: &mut EmitterWriter,
                 s.push_char('~');
             }
         }
-        try!(print_maybe_styled(err, s.into_owned() + "\n",
+        try!(print_maybe_styled(err,
+                                format!("{}\n", s).as_slice(),
                                 term::attr::ForegroundColor(lvl.color())));
     }
     Ok(())
@@ -476,7 +480,7 @@ fn custom_highlight_lines(w: &mut EmitterWriter,
     s.push_char('^');
     s.push_char('\n');
     print_maybe_styled(w,
-                       s.into_owned(),
+                       s.as_slice(),
                        term::attr::ForegroundColor(lvl.color()))
 }
 
@@ -495,7 +499,8 @@ fn print_macro_backtrace(w: &mut EmitterWriter,
         };
         try!(print_diagnostic(w, ss.as_slice(), Note,
                               format!("in expansion of {}{}{}", pre,
-                                      ei.callee.name, post)));
+                                      ei.callee.name,
+                                      post).as_slice()));
         let ss = cm.span_to_str(ei.call_site);
         try!(print_diagnostic(w, ss.as_slice(), Note, "expansion site"));
         try!(print_macro_backtrace(w, cm, ei.call_site));
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index b9c8be290ca..822084df2f6 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -107,7 +107,9 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                         (Some('+'), operand) => {
                             // Save a reference to the output
                             read_write_operands.push((outputs.len(), out));
-                            Some(token::intern_and_get_ident("=" + operand))
+                            Some(token::intern_and_get_ident(format!(
+                                        "={}",
+                                        operand).as_slice()))
                         }
                         _ => {
                             cx.span_err(span, "output operand constraint lacks '=' or '+'");
@@ -208,7 +210,8 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     // Append an input operand, with the form of ("0", expr)
     // that links to an output operand.
     for &(i, out) in read_write_operands.iter() {
-        inputs.push((token::intern_and_get_ident(i.to_str()), out));
+        inputs.push((token::intern_and_get_ident(i.to_str().as_slice()),
+                                                 out));
     }
 
     MacExpr::new(@ast::Expr {
@@ -216,7 +219,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         node: ast::ExprInlineAsm(ast::InlineAsm {
             asm: token::intern_and_get_ident(asm.get()),
             asm_str_style: asm_str_style.unwrap(),
-            clobbers: token::intern_and_get_ident(cons),
+            clobbers: token::intern_and_get_ident(cons.as_slice()),
             inputs: inputs,
             outputs: outputs,
             volatile: volatile,
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 06b56bbe472..854f1d02219 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -533,7 +533,7 @@ pub fn check_zero_tts(cx: &ExtCtxt,
                       tts: &[ast::TokenTree],
                       name: &str) {
     if tts.len() != 0 {
-        cx.span_err(sp, format!("{} takes no arguments", name));
+        cx.span_err(sp, format!("{} takes no arguments", name).as_slice());
     }
 }
 
@@ -545,14 +545,17 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt,
                                name: &str)
                                -> Option<StrBuf> {
     if tts.len() != 1 {
-        cx.span_err(sp, format!("{} takes 1 argument.", name));
+        cx.span_err(sp, format!("{} takes 1 argument.", name).as_slice());
     } else {
         match tts[0] {
             ast::TTTok(_, token::LIT_STR(ident))
             | ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => {
                 return Some(token::get_ident(ident).get().to_strbuf())
             }
-            _ => cx.span_err(sp, format!("{} requires a string.", name)),
+            _ => {
+                cx.span_err(sp,
+                            format!("{} requires a string.", name).as_slice())
+            }
         }
     }
     None
diff --git a/src/libsyntax/ext/concat.rs b/src/libsyntax/ext/concat.rs
index 7c6c9892002..b2baff8d286 100644
--- a/src/libsyntax/ext/concat.rs
+++ b/src/libsyntax/ext/concat.rs
@@ -38,14 +38,14 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
                         accumulator.push_char(c);
                     }
                     ast::LitInt(i, _) | ast::LitIntUnsuffixed(i) => {
-                        accumulator.push_str(format!("{}", i));
+                        accumulator.push_str(format!("{}", i).as_slice());
                     }
                     ast::LitUint(u, _) => {
-                        accumulator.push_str(format!("{}", u));
+                        accumulator.push_str(format!("{}", u).as_slice());
                     }
                     ast::LitNil => {}
                     ast::LitBool(b) => {
-                        accumulator.push_str(format!("{}", b));
+                        accumulator.push_str(format!("{}", b).as_slice());
                     }
                     ast::LitBinary(..) => {
                         cx.span_err(e.span, "cannot concatenate a binary literal");
@@ -59,5 +59,5 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
     }
     base::MacExpr::new(cx.expr_str(
             sp,
-            token::intern_and_get_ident(accumulator.into_owned())))
+            token::intern_and_get_ident(accumulator.as_slice())))
 }
diff --git a/src/libsyntax/ext/concat_idents.rs b/src/libsyntax/ext/concat_idents.rs
index 0e168e7b33b..24478358d79 100644
--- a/src/libsyntax/ext/concat_idents.rs
+++ b/src/libsyntax/ext/concat_idents.rs
@@ -42,7 +42,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             }
         }
     }
-    let res = str_to_ident(res_str.into_owned());
+    let res = str_to_ident(res_str.as_slice());
 
     let e = @ast::Expr {
         id: ast::DUMMY_NODE_ID,
diff --git a/src/libsyntax/ext/deriving/bounds.rs b/src/libsyntax/ext/deriving/bounds.rs
index b5b2667f892..d90c7f37213 100644
--- a/src/libsyntax/ext/deriving/bounds.rs
+++ b/src/libsyntax/ext/deriving/bounds.rs
@@ -25,12 +25,18 @@ pub fn expand_deriving_bound(cx: &mut ExtCtxt,
                 "Copy" => "Copy",
                 "Send" => "Send",
                 "Share" => "Share",
-                ref tname => cx.span_bug(span,
-                                         format!("expected built-in trait name but found {}",
-                                                 *tname))
+                ref tname => {
+                    cx.span_bug(span,
+                                format!("expected built-in trait name but \
+                                         found {}",
+                                        *tname).as_slice())
+                }
             }
         },
-        _ => return cx.span_err(span, "unexpected value in deriving, expected a trait")
+        _ => {
+            return cx.span_err(span, "unexpected value in deriving, expected \
+                                      a trait")
+        }
     };
 
     let trait_def = TraitDef {
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 51024158822..89c94891b33 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -66,12 +66,17 @@ fn cs_clone(
             ctor_ident = variant.node.name;
             all_fields = af;
         },
-        EnumNonMatching(..) => cx.span_bug(trait_span,
-                                           format!("non-matching enum variants in `deriving({})`",
-                                                  name)),
-        StaticEnum(..) | StaticStruct(..) => cx.span_bug(trait_span,
-                                                         format!("static method in `deriving({})`",
-                                                                 name))
+        EnumNonMatching(..) => {
+            cx.span_bug(trait_span,
+                        format!("non-matching enum variants in \
+                                 `deriving({})`",
+                                name).as_slice())
+        }
+        StaticEnum(..) | StaticStruct(..) => {
+            cx.span_bug(trait_span,
+                        format!("static method in `deriving({})`",
+                                name).as_slice())
+        }
     }
 
     if all_fields.len() >= 1 && all_fields.get(0).name.is_none() {
@@ -83,9 +88,12 @@ fn cs_clone(
         let fields = all_fields.iter().map(|field| {
             let ident = match field.name {
                 Some(i) => i,
-                None => cx.span_bug(trait_span,
-                                    format!("unnamed field in normal struct in `deriving({})`",
-                                            name))
+                None => {
+                    cx.span_bug(trait_span,
+                                format!("unnamed field in normal struct in \
+                                         `deriving({})`",
+                                        name).as_slice())
+                }
             };
             cx.field_imm(field.span, ident, subcall(field))
         }).collect::<Vec<_>>();
diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs
index 2447535f1f3..172ae8dca62 100644
--- a/src/libsyntax/ext/deriving/decodable.rs
+++ b/src/libsyntax/ext/deriving/decodable.rs
@@ -168,7 +168,7 @@ fn decode_static_fields(cx: &mut ExtCtxt,
                 let fields = fields.iter().enumerate().map(|(i, &span)| {
                     getarg(cx, span,
                            token::intern_and_get_ident(format!("_field{}",
-                                                               i)),
+                                                               i).as_slice()),
                            i)
                 }).collect();
 
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index 75b051b2f10..b8a3eea0014 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -154,7 +154,8 @@ fn encodable_substructure(cx: &mut ExtCtxt, trait_span: Span,
                 let name = match name {
                     Some(id) => token::get_ident(id),
                     None => {
-                        token::intern_and_get_ident(format!("_field{}", i))
+                        token::intern_and_get_ident(format!("_field{}",
+                                                            i).as_slice())
                     }
                 };
                 let enc = cx.expr_method_call(span, self_, encode, vec!(blkencoder));
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index 6df4da89402..0875daddc0f 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -574,7 +574,7 @@ impl<'a> MethodDef<'a> {
 
         for (i, ty) in self.args.iter().enumerate() {
             let ast_ty = ty.to_ty(cx, trait_.span, type_ident, generics);
-            let ident = cx.ident_of(format!("__arg_{}", i));
+            let ident = cx.ident_of(format!("__arg_{}", i).as_slice());
             arg_tys.push((ident, ast_ty));
 
             let arg_expr = cx.expr_ident(trait_.span, ident);
@@ -674,9 +674,13 @@ impl<'a> MethodDef<'a> {
                                  // [fields of next Self arg], [etc]]
         let mut patterns = Vec::new();
         for i in range(0u, self_args.len()) {
-            let (pat, ident_expr) = trait_.create_struct_pattern(cx, type_ident, struct_def,
-                                                                 format!("__self_{}", i),
-                                                                 ast::MutImmutable);
+            let (pat, ident_expr) =
+                trait_.create_struct_pattern(cx,
+                                             type_ident,
+                                             struct_def,
+                                             format!("__self_{}",
+                                                     i).as_slice(),
+                                             ast::MutImmutable);
             patterns.push(pat);
             raw_fields.push(ident_expr);
         }
@@ -875,7 +879,7 @@ impl<'a> MethodDef<'a> {
 
         } else {  // there are still matches to create
             let current_match_str = if match_count == 0 {
-                "__self".to_owned()
+                "__self".to_strbuf()
             } else {
                 format!("__arg_{}", match_count)
             };
@@ -895,10 +899,11 @@ impl<'a> MethodDef<'a> {
 
                 // matching-variant match
                 let variant = *enum_def.variants.get(index);
-                let (pattern, idents) = trait_.create_enum_variant_pattern(cx,
-                                                                           variant,
-                                                                           current_match_str,
-                                                                           ast::MutImmutable);
+                let (pattern, idents) = trait_.create_enum_variant_pattern(
+                    cx,
+                    variant,
+                    current_match_str.as_slice(),
+                    ast::MutImmutable);
 
                 matches_so_far.push((index, variant, idents));
                 let arm_expr = self.build_enum_match(cx,
@@ -926,10 +931,12 @@ impl<'a> MethodDef<'a> {
             } else {
                 // create an arm matching on each variant
                 for (index, &variant) in enum_def.variants.iter().enumerate() {
-                    let (pattern, idents) = trait_.create_enum_variant_pattern(cx,
-                                                                               variant,
-                                                                               current_match_str,
-                                                                               ast::MutImmutable);
+                    let (pattern, idents) =
+                        trait_.create_enum_variant_pattern(
+                            cx,
+                            variant,
+                            current_match_str.as_slice(),
+                            ast::MutImmutable);
 
                     matches_so_far.push((index, variant, idents));
                     let new_matching =
@@ -1081,7 +1088,11 @@ impl<'a> TraitDef<'a> {
                     cx.span_bug(sp, "a struct with named and unnamed fields in `deriving`");
                 }
             };
-            let path = cx.path_ident(sp, cx.ident_of(format!("{}_{}", prefix, i)));
+            let path =
+                cx.path_ident(sp,
+                              cx.ident_of(format!("{}_{}",
+                                                  prefix,
+                                                  i).as_slice()));
             paths.push(path.clone());
             let val = cx.expr(
                 sp, ast::ExprParen(
@@ -1127,7 +1138,11 @@ impl<'a> TraitDef<'a> {
                 let mut ident_expr = Vec::new();
                 for (i, va) in variant_args.iter().enumerate() {
                     let sp = self.set_expn_info(cx, va.ty.span);
-                    let path = cx.path_ident(sp, cx.ident_of(format!("{}_{}", prefix, i)));
+                    let path =
+                        cx.path_ident(sp,
+                                      cx.ident_of(format!("{}_{}",
+                                                          prefix,
+                                                          i).as_slice()));
 
                     paths.push(path.clone());
                     let val = cx.expr(
diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs
index 1187e83308b..aeff36a49e6 100644
--- a/src/libsyntax/ext/deriving/mod.rs
+++ b/src/libsyntax/ext/deriving/mod.rs
@@ -96,8 +96,10 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
                             "Copy" => expand!(bounds::expand_deriving_bound),
 
                             ref tname => {
-                                cx.span_err(titem.span, format!("unknown \
-                                    `deriving` trait: `{}`", *tname));
+                                cx.span_err(titem.span,
+                                            format!("unknown `deriving` \
+                                                     trait: `{}`",
+                                                    *tname).as_slice());
                             }
                         };
                     }
diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs
index 8dbfbc53cec..d1a4d2f3ee3 100644
--- a/src/libsyntax/ext/env.rs
+++ b/src/libsyntax/ext/env.rs
@@ -53,7 +53,7 @@ pub fn expand_option_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                                    cx.ident_of("Some")),
                               vec!(cx.expr_str(sp,
                                                token::intern_and_get_ident(
-                                          s))))
+                                          s.as_slice()))))
       }
     };
     MacExpr::new(e)
@@ -80,7 +80,7 @@ pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
         1 => {
             token::intern_and_get_ident(format!("environment variable `{}` \
                                                  not defined",
-                                                var))
+                                                var).as_slice())
         }
         2 => {
             match expr_to_str(cx, *exprs.get(1), "expected string literal") {
@@ -99,7 +99,7 @@ pub fn expand_env(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             cx.span_err(sp, msg.get());
             cx.expr_uint(sp, 0)
         }
-        Some(s) => cx.expr_str(sp, token::intern_and_get_ident(s))
+        Some(s) => cx.expr_str(sp, token::intern_and_get_ident(s.as_slice()))
     };
     MacExpr::new(e)
 }
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index e3b1037ccc0..989d0a463c3 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -47,10 +47,9 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
                 // Token-tree macros:
                 MacInvocTT(ref pth, ref tts, _) => {
                     if pth.segments.len() > 1u {
-                        fld.cx.span_err(
-                            pth.span,
-                            format!("expected macro name without module \
-                                  separators"));
+                        fld.cx.span_err(pth.span,
+                                        "expected macro name without module \
+                                         separators");
                         // let compilation continue
                         return DummyResult::raw_expr(e.span);
                     }
@@ -62,7 +61,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
                             fld.cx.span_err(
                                 pth.span,
                                 format!("macro undefined: '{}'",
-                                        extnamestr.get()));
+                                        extnamestr.get()).as_slice());
 
                             // let compilation continue
                             return DummyResult::raw_expr(e.span);
@@ -93,11 +92,10 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
                                 None => {
                                     fld.cx.span_err(
                                         pth.span,
-                                        format!(
-                                            "non-expr macro in expr pos: {}",
-                                            extnamestr.get()
-                                        )
-                                    );
+                                        format!("non-expr macro in expr pos: \
+                                                 {}",
+                                                extnamestr.get().as_slice()
+                                        ).as_slice());
                                     return DummyResult::raw_expr(e.span);
                                 }
                             };
@@ -109,8 +107,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr {
                             fld.cx.span_err(
                                 pth.span,
                                 format!("'{}' is not a tt-style macro",
-                                        extnamestr.get())
-                            );
+                                        extnamestr.get()).as_slice());
                             return DummyResult::raw_expr(e.span);
                         }
                     };
@@ -384,18 +381,19 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
         None => {
             fld.cx.span_err(pth.span,
                             format!("macro undefined: '{}!'",
-                                    extnamestr));
+                                    extnamestr).as_slice());
             // let compilation continue
             return SmallVector::zero();
         }
 
         Some(&NormalTT(ref expander, span)) => {
             if it.ident.name != parse::token::special_idents::invalid.name {
-                fld.cx.span_err(pth.span,
-                                format!("macro {}! expects no ident argument, \
-                                        given '{}'",
-                                        extnamestr,
-                                        token::get_ident(it.ident)));
+                fld.cx
+                   .span_err(pth.span,
+                             format!("macro {}! expects no ident argument, \
+                                      given '{}'",
+                                     extnamestr,
+                                     token::get_ident(it.ident)).as_slice());
                 return SmallVector::zero();
             }
             fld.cx.bt_push(ExpnInfo {
@@ -414,7 +412,7 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
             if it.ident.name == parse::token::special_idents::invalid.name {
                 fld.cx.span_err(pth.span,
                                 format!("macro {}! expects an ident argument",
-                                        extnamestr.get()));
+                                        extnamestr.get()).as_slice());
                 return SmallVector::zero();
             }
             fld.cx.bt_push(ExpnInfo {
@@ -432,7 +430,7 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
         _ => {
             fld.cx.span_err(it.span,
                             format!("{}! is not legal in item position",
-                                    extnamestr.get()));
+                                    extnamestr.get()).as_slice());
             return SmallVector::zero();
         }
     };
@@ -459,7 +457,7 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
                 None => {
                     fld.cx.span_err(pth.span,
                                     format!("expr macro in item position: {}",
-                                            extnamestr.get()));
+                                            extnamestr.get()).as_slice());
                     return SmallVector::zero();
                 }
             }
@@ -532,7 +530,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) {
         // this is fatal: there are almost certainly macros we need
         // inside this crate, so continue would spew "macro undefined"
         // errors
-        Err(err) => fld.cx.span_fatal(krate.span, err)
+        Err(err) => fld.cx.span_fatal(krate.span, err.as_slice())
     };
 
     unsafe {
@@ -540,7 +538,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) {
             match lib.symbol(registrar.as_slice()) {
                 Ok(registrar) => registrar,
                 // again fatal if we can't register macros
-                Err(err) => fld.cx.span_fatal(krate.span, err)
+                Err(err) => fld.cx.span_fatal(krate.span, err.as_slice())
             };
         registrar(|name, extension| {
             let extension = match extension {
@@ -581,7 +579,9 @@ pub fn expand_stmt(s: &Stmt, fld: &mut MacroExpander) -> SmallVector<@Stmt> {
     let extnamestr = token::get_ident(extname);
     let marked_after = match fld.extsbox.find(&extname.name) {
         None => {
-            fld.cx.span_err(pth.span, format!("macro undefined: '{}'", extnamestr));
+            fld.cx.span_err(pth.span,
+                            format!("macro undefined: '{}'",
+                                    extnamestr).as_slice());
             return SmallVector::zero();
         }
 
@@ -609,7 +609,7 @@ pub fn expand_stmt(s: &Stmt, fld: &mut MacroExpander) -> SmallVector<@Stmt> {
                 None => {
                     fld.cx.span_err(pth.span,
                                     format!("non-stmt macro in stmt pos: {}",
-                                            extnamestr));
+                                            extnamestr).as_slice());
                     return SmallVector::zero();
                 }
             };
@@ -619,7 +619,7 @@ pub fn expand_stmt(s: &Stmt, fld: &mut MacroExpander) -> SmallVector<@Stmt> {
 
         _ => {
             fld.cx.span_err(pth.span, format!("'{}' is not a tt-style macro",
-                                              extnamestr));
+                                              extnamestr).as_slice());
             return SmallVector::zero();
         }
     };
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 01124fdfa54..ad4b798cfe5 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -130,7 +130,7 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool,
                 _ => {
                     ecx.span_err(p.span,
                                  format!("expected ident for named argument, but found `{}`",
-                                         p.this_token_to_str()));
+                                         p.this_token_to_str()).as_slice());
                     return (invocation, None);
                 }
             };
@@ -141,7 +141,9 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool,
             match names.find_equiv(&name) {
                 None => {}
                 Some(prev) => {
-                    ecx.span_err(e.span, format!("duplicate argument named `{}`", name));
+                    ecx.span_err(e.span,
+                                 format!("duplicate argument named `{}`",
+                                         name).as_slice());
                     ecx.parse_sess.span_diagnostic.span_note(prev.span, "previously here");
                     continue
                 }
@@ -246,13 +248,15 @@ impl<'a, 'b> Context<'a, 'b> {
                         match arm.selector {
                             parse::Keyword(name) => {
                                 self.ecx.span_err(self.fmtsp,
-                                                  format!("duplicate selector \
-                                                           `{}`", name));
+                                                  format!("duplicate \
+                                                           selector `{}`",
+                                                          name).as_slice());
                             }
                             parse::Literal(idx) => {
                                 self.ecx.span_err(self.fmtsp,
-                                                  format!("duplicate selector \
-                                                           `={}`", idx));
+                                                  format!("duplicate \
+                                                           selector `={}`",
+                                                          idx).as_slice());
                             }
                         }
                     }
@@ -267,7 +271,7 @@ impl<'a, 'b> Context<'a, 'b> {
                     if !seen_cases.insert(arm.selector) {
                         self.ecx.span_err(self.fmtsp,
                                           format!("duplicate selector `{}`",
-                                               arm.selector));
+                                                  arm.selector).as_slice());
                     } else if arm.selector == "" {
                         self.ecx.span_err(self.fmtsp,
                                           "empty selector in `select`");
@@ -286,7 +290,7 @@ impl<'a, 'b> Context<'a, 'b> {
                 if self.args.len() <= arg {
                     let msg = format!("invalid reference to argument `{}` (there \
                                     are {} arguments)", arg, self.args.len());
-                    self.ecx.span_err(self.fmtsp, msg);
+                    self.ecx.span_err(self.fmtsp, msg.as_slice());
                     return;
                 }
                 {
@@ -306,7 +310,7 @@ impl<'a, 'b> Context<'a, 'b> {
                     Some(e) => e.span,
                     None => {
                         let msg = format!("there is no argument named `{}`", name);
-                        self.ecx.span_err(self.fmtsp, msg);
+                        self.ecx.span_err(self.fmtsp, msg.as_slice());
                         return;
                     }
                 };
@@ -349,19 +353,19 @@ impl<'a, 'b> Context<'a, 'b> {
                                   format!("argument redeclared with type `{}` when \
                                            it was previously `{}`",
                                           *ty,
-                                          *cur));
+                                          *cur).as_slice());
             }
             (&Known(ref cur), _) => {
                 self.ecx.span_err(sp,
                                   format!("argument used to format with `{}` was \
                                            attempted to not be used for formatting",
-                                           *cur));
+                                           *cur).as_slice());
             }
             (_, &Known(ref ty)) => {
                 self.ecx.span_err(sp,
                                   format!("argument previously used as a format \
                                            argument attempted to be used as `{}`",
-                                           *ty));
+                                           *ty).as_slice());
             }
             (_, _) => {
                 self.ecx.span_err(sp, "argument declared with multiple formats");
@@ -480,7 +484,7 @@ impl<'a, 'b> Context<'a, 'b> {
                             }).collect();
                         let (lr, selarg) = match arm.selector {
                             parse::Keyword(t) => {
-                                let p = self.rtpath(t.to_str());
+                                let p = self.rtpath(t.to_str().as_slice());
                                 let p = self.ecx.path_global(sp, p);
                                 (self.rtpath("Keyword"), self.ecx.expr_path(p))
                             }
@@ -516,7 +520,8 @@ impl<'a, 'b> Context<'a, 'b> {
                     ), None);
         let st = ast::ItemStatic(ty, ast::MutImmutable, method);
         let static_name = self.ecx.ident_of(format!("__STATIC_METHOD_{}",
-                                                    self.method_statics.len()));
+                                                    self.method_statics
+                                                        .len()).as_slice());
         let item = self.ecx.item(sp, static_name, self.static_attrs(), st);
         self.method_statics.push(item);
         self.ecx.expr_ident(sp, static_name)
@@ -662,7 +667,7 @@ impl<'a, 'b> Context<'a, 'b> {
                 continue // error already generated
             }
 
-            let name = self.ecx.ident_of(format!("__arg{}", i));
+            let name = self.ecx.ident_of(format!("__arg{}", i).as_slice());
             pats.push(self.ecx.pat_ident(e.span, name));
             heads.push(self.ecx.expr_addr_of(e.span, e));
             locals.push(self.format_arg(e.span, Exact(i),
@@ -674,7 +679,8 @@ impl<'a, 'b> Context<'a, 'b> {
                 Some(..) | None => continue
             };
 
-            let lname = self.ecx.ident_of(format!("__arg{}", *name));
+            let lname = self.ecx.ident_of(format!("__arg{}",
+                                                  *name).as_slice());
             pats.push(self.ecx.pat_ident(e.span, lname));
             heads.push(self.ecx.expr_addr_of(e.span, e));
             *names.get_mut(*self.name_positions.get(name)) =
@@ -786,8 +792,10 @@ impl<'a, 'b> Context<'a, 'b> {
                     "x" => "secret_lower_hex",
                     "X" => "secret_upper_hex",
                     _ => {
-                        self.ecx.span_err(sp, format!("unknown format trait `{}`",
-                                                      *tyname));
+                        self.ecx
+                            .span_err(sp,
+                                      format!("unknown format trait `{}`",
+                                              *tyname).as_slice());
                         "dummy"
                     }
                 }
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index b3eec136c7d..bb3a88f44e4 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -436,7 +436,7 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
                 ast::TyI32 => "TyI32".to_owned(),
                 ast::TyI64 => "TyI64".to_owned()
             };
-            let e_ity = cx.expr_ident(sp, id_ext(s_ity));
+            let e_ity = cx.expr_ident(sp, id_ext(s_ity.as_slice()));
 
             let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
 
@@ -453,7 +453,7 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
                 ast::TyU32 => "TyU32".to_owned(),
                 ast::TyU64 => "TyU64".to_owned()
             };
-            let e_uty = cx.expr_ident(sp, id_ext(s_uty));
+            let e_uty = cx.expr_ident(sp, id_ext(s_uty.as_slice()));
 
             let e_u64 = cx.expr_lit(sp, ast::LitUint(u, ast::TyU64));
 
@@ -476,7 +476,7 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
                 ast::TyF64 => "TyF64".to_owned(),
                 ast::TyF128 => "TyF128".to_owned()
             };
-            let e_fty = cx.expr_ident(sp, id_ext(s_fty));
+            let e_fty = cx.expr_ident(sp, id_ext(s_fty.as_slice()));
 
             let e_fident = mk_ident(cx, sp, fident);
 
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 6bc08741c07..452719d2dd8 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -76,7 +76,9 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
                    .map(|x| token::get_ident(*x).get().to_strbuf())
                    .collect::<Vec<StrBuf>>()
                    .connect("::");
-    base::MacExpr::new(cx.expr_str(sp, token::intern_and_get_ident(string)))
+    base::MacExpr::new(cx.expr_str(
+            sp,
+            token::intern_and_get_ident(string.as_slice())))
 }
 
 // include! : parse the given file as an expr
@@ -111,7 +113,10 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     let file = res_rel_file(cx, sp, &Path::new(file));
     let bytes = match File::open(&file).read_to_end() {
         Err(e) => {
-            cx.span_err(sp, format!("couldn't read {}: {}", file.display(), e));
+            cx.span_err(sp,
+                        format!("couldn't read {}: {}",
+                                file.display(),
+                                e).as_slice());
             return DummyResult::expr(sp);
         }
         Ok(bytes) => bytes,
@@ -127,7 +132,9 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             base::MacExpr::new(cx.expr_str(sp, interned))
         }
         None => {
-            cx.span_err(sp, format!("{} wasn't a utf-8 file", file.display()));
+            cx.span_err(sp,
+                        format!("{} wasn't a utf-8 file",
+                                file.display()).as_slice());
             return DummyResult::expr(sp);
         }
     }
@@ -142,7 +149,10 @@ pub fn expand_include_bin(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     let file = res_rel_file(cx, sp, &Path::new(file));
     match File::open(&file).read_to_end() {
         Err(e) => {
-            cx.span_err(sp, format!("couldn't read {}: {}", file.display(), e));
+            cx.span_err(sp,
+                        format!("couldn't read {}: {}",
+                                file.display(),
+                                e).as_slice());
             return DummyResult::expr(sp);
         }
         Ok(bytes) => {
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 89e8d48425f..ce1c7da585f 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -188,7 +188,9 @@ pub fn nameize(p_s: &ParseSess, ms: &[Matcher], res: &[Rc<NamedMatch>])
             if ret_val.contains_key(&bind_name) {
                 let string = token::get_ident(bind_name);
                 p_s.span_diagnostic
-                   .span_fatal(span, "duplicated bind name: " + string.get())
+                   .span_fatal(span,
+                               format!("duplicated bind name: {}",
+                                       string.get()).as_slice())
             }
             ret_val.insert(bind_name, res[idx].clone());
           }
@@ -455,6 +457,9 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
         res
       }
       "matchers" => token::NtMatchers(p.parse_matchers()),
-      _ => p.fatal("unsupported builtin nonterminal parser: ".to_owned() + name)
+      _ => {
+          p.fatal(format!("unsupported builtin nonterminal parser: {}",
+                          name).as_slice())
+      }
     }
 }
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 7ff690582d6..f234b0c234d 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -52,7 +52,7 @@ impl<'a> ParserAnyMacro<'a> {
                                following",
                               token_str);
             let span = parser.span;
-            parser.span_err(span, msg);
+            parser.span_err(span, msg.as_slice());
         }
     }
 }
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 1f264e73d4a..6d799eeae6c 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -89,9 +89,10 @@ fn lookup_cur_matched(r: &TtReader, name: Ident) -> Rc<NamedMatch> {
     match matched_opt {
         Some(s) => lookup_cur_matched_by_matched(r, s),
         None => {
-            r.sp_diag.span_fatal(r.cur_span,
-                                 format!("unknown macro variable `{}`",
-                                         token::get_ident(name)));
+            r.sp_diag
+             .span_fatal(r.cur_span,
+                         format!("unknown macro variable `{}`",
+                                 token::get_ident(name)).as_slice());
         }
     }
 }
@@ -269,7 +270,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
                         r.sp_diag.span_fatal(
                             r.cur_span, /* blame the macro writer */
                             format!("variable '{}' is still repeating at this depth",
-                                    token::get_ident(ident)));
+                                    token::get_ident(ident)).as_slice());
                     }
                 }
             }
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 80ee459a62d..6f17412fa63 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -88,7 +88,7 @@ impl<'a> ParserAttr for Parser<'a> {
             _ => {
                 let token_str = self.this_token_to_str();
                 self.fatal(format!("expected `\\#` but found `{}`",
-                                   token_str));
+                                   token_str).as_slice());
             }
         };
 
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index c78d2aaf3a7..5a7a816dbb3 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -589,13 +589,13 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
             bump(rdr);
             bump(rdr);
             check_float_base(rdr, start_bpos, rdr.last_pos, base);
-            return token::LIT_FLOAT(str_to_ident(num_str.into_owned()),
+            return token::LIT_FLOAT(str_to_ident(num_str.as_slice()),
                                     ast::TyF32);
         } else if c == '6' && n == '4' {
             bump(rdr);
             bump(rdr);
             check_float_base(rdr, start_bpos, rdr.last_pos, base);
-            return token::LIT_FLOAT(str_to_ident(num_str.into_owned()),
+            return token::LIT_FLOAT(str_to_ident(num_str.as_slice()),
                                     ast::TyF64);
             /* FIXME (#2252): if this is out of range for either a
             32-bit or 64-bit float, it won't be noticed till the
@@ -612,8 +612,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
     }
     if is_float {
         check_float_base(rdr, start_bpos, rdr.last_pos, base);
-        return token::LIT_FLOAT_UNSUFFIXED(str_to_ident(
-                num_str.into_owned()));
+        return token::LIT_FLOAT_UNSUFFIXED(str_to_ident(num_str.as_slice()));
     } else {
         if num_str.len() == 0u {
             fatal_span(rdr, start_bpos, rdr.last_pos,
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 8e139b049c5..31a67ff92f5 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -224,7 +224,9 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
     let bytes = match File::open(path).read_to_end() {
         Ok(bytes) => bytes,
         Err(e) => {
-            err(format!("couldn't read {}: {}", path.display(), e));
+            err(format!("couldn't read {}: {}",
+                        path.display(),
+                        e).as_slice());
             unreachable!()
         }
     };
@@ -233,7 +235,9 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
             return string_to_filemap(sess, s.to_strbuf(),
                                      path.as_str().unwrap().to_strbuf())
         }
-        None => err(format!("{} is not UTF-8 encoded", path.display())),
+        None => {
+            err(format!("{} is not UTF-8 encoded", path.display()).as_slice())
+        }
     }
     unreachable!()
 }
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index b6aa47128e6..394b68d4a72 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -158,10 +158,14 @@ impl<'a> ParserObsoleteMethods for Parser<'a> {
               kind: ObsoleteSyntax,
               kind_str: &str,
               desc: &str) {
-        self.span_err(sp, format!("obsolete syntax: {}", kind_str));
+        self.span_err(sp,
+                      format!("obsolete syntax: {}", kind_str).as_slice());
 
         if !self.obsolete_set.contains(&kind) {
-            self.sess.span_diagnostic.handler().note(format!("{}", desc));
+            self.sess
+                .span_diagnostic
+                .handler()
+                .note(format!("{}", desc).as_slice());
             self.obsolete_set.insert(kind);
         }
     }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 5829f63b2c5..4897fed6928 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -371,12 +371,12 @@ impl<'a> Parser<'a> {
     pub fn unexpected_last(&mut self, t: &token::Token) -> ! {
         let token_str = Parser::token_to_str(t);
         self.span_fatal(self.last_span, format!("unexpected token: `{}`",
-                                                token_str));
+                                                token_str).as_slice());
     }
 
     pub fn unexpected(&mut self) -> ! {
         let this_token = self.this_token_to_str();
-        self.fatal(format!("unexpected token: `{}`", this_token));
+        self.fatal(format!("unexpected token: `{}`", this_token).as_slice());
     }
 
     // expect and consume the token t. Signal an error if
@@ -389,7 +389,7 @@ impl<'a> Parser<'a> {
             let this_token_str = self.this_token_to_str();
             self.fatal(format!("expected `{}` but found `{}`",
                                token_str,
-                               this_token_str))
+                               this_token_str).as_slice())
         }
     }
 
@@ -420,11 +420,15 @@ impl<'a> Parser<'a> {
             let expect = tokens_to_str(expected.as_slice());
             let actual = self.this_token_to_str();
             self.fatal(
-                if expected.len() != 1 {
-                    format!("expected one of `{}` but found `{}`", expect, actual)
+                (if expected.len() != 1 {
+                    (format!("expected one of `{}` but found `{}`",
+                             expect,
+                             actual))
                 } else {
-                    format!("expected `{}` but found `{}`", expect, actual)
-                }
+                    (format!("expected `{}` but found `{}`",
+                             expect,
+                             actual))
+                }).as_slice()
             )
         }
     }
@@ -501,7 +505,8 @@ impl<'a> Parser<'a> {
             }
             _ => {
                 let token_str = self.this_token_to_str();
-                self.fatal(format!( "expected ident, found `{}`", token_str))
+                self.fatal((format!("expected ident, found `{}`",
+                                    token_str)).as_slice())
             }
         }
     }
@@ -545,7 +550,7 @@ impl<'a> Parser<'a> {
             let id_interned_str = token::get_ident(kw.to_ident());
             let token_str = self.this_token_to_str();
             self.fatal(format!("expected `{}`, found `{}`",
-                               id_interned_str, token_str))
+                               id_interned_str, token_str).as_slice())
         }
     }
 
@@ -554,7 +559,8 @@ impl<'a> Parser<'a> {
         if token::is_strict_keyword(&self.token) {
             let token_str = self.this_token_to_str();
             self.span_err(self.span,
-                          format!("found `{}` in ident position", token_str));
+                          format!("found `{}` in ident position",
+                                  token_str).as_slice());
         }
     }
 
@@ -562,7 +568,8 @@ impl<'a> Parser<'a> {
     pub fn check_reserved_keywords(&mut self) {
         if token::is_reserved_keyword(&self.token) {
             let token_str = self.this_token_to_str();
-            self.fatal(format!("`{}` is a reserved keyword", token_str))
+            self.fatal(format!("`{}` is a reserved keyword",
+                               token_str).as_slice())
         }
     }
 
@@ -581,7 +588,7 @@ impl<'a> Parser<'a> {
                     Parser::token_to_str(&token::BINOP(token::AND));
                 self.fatal(format!("expected `{}`, found `{}`",
                                    found_token,
-                                   token_str))
+                                   token_str).as_slice())
             }
         }
     }
@@ -600,7 +607,8 @@ impl<'a> Parser<'a> {
                 let token_str =
                     Parser::token_to_str(&token::BINOP(token::OR));
                 self.fatal(format!("expected `{}`, found `{}`",
-                                   token_str, found_token))
+                                   token_str,
+                                   found_token).as_slice())
             }
         }
     }
@@ -650,7 +658,8 @@ impl<'a> Parser<'a> {
             let found_token = self.this_token_to_str();
             let token_str = Parser::token_to_str(&token::LT);
             self.fatal(format!("expected `{}`, found `{}`",
-                               token_str, found_token))
+                               token_str,
+                               found_token).as_slice())
         }
     }
 
@@ -690,7 +699,7 @@ impl<'a> Parser<'a> {
                 let this_token_str = self.this_token_to_str();
                 self.fatal(format!("expected `{}`, found `{}`",
                                    gt_str,
-                                   this_token_str))
+                                   this_token_str).as_slice())
             }
         }
     }
@@ -1186,8 +1195,8 @@ impl<'a> Parser<'a> {
 
               _ => {
                   let token_str = p.this_token_to_str();
-                  p.fatal(format!("expected `;` or `\\{` but found `{}`",
-                                  token_str))
+                  p.fatal((format!("expected `;` or `\\{` but found `{}`",
+                                   token_str)).as_slice())
               }
             }
         })
@@ -1359,7 +1368,7 @@ impl<'a> Parser<'a> {
             TyInfer
         } else {
             let msg = format!("expected type, found token {:?}", self.token);
-            self.fatal(msg);
+            self.fatal(msg.as_slice());
         };
 
         let sp = mk_sp(lo, self.last_span.hi);
@@ -1631,7 +1640,7 @@ impl<'a> Parser<'a> {
                 };
             }
             _ => {
-                self.fatal(format!("expected a lifetime name"));
+                self.fatal(format!("expected a lifetime name").as_slice());
             }
         }
     }
@@ -1667,7 +1676,7 @@ impl<'a> Parser<'a> {
                     let msg = format!("expected `,` or `>` after lifetime \
                                       name, got: {:?}",
                                       self.token);
-                    self.fatal(msg);
+                    self.fatal(msg.as_slice());
                 }
             }
         }
@@ -2122,7 +2131,7 @@ impl<'a> Parser<'a> {
                   };
                   let token_str = p.this_token_to_str();
                   p.fatal(format!("incorrect close delimiter: `{}`",
-                                  token_str))
+                                  token_str).as_slice())
               },
               /* we ought to allow different depths of unquotation */
               token::DOLLAR if p.quote_depth > 0u => {
@@ -2773,7 +2782,7 @@ impl<'a> Parser<'a> {
                 if self.token != token::RBRACE {
                     let token_str = self.this_token_to_str();
                     self.fatal(format!("expected `\\}`, found `{}`",
-                                       token_str))
+                                       token_str).as_slice())
                 }
                 etc = true;
                 break;
@@ -2793,7 +2802,8 @@ impl<'a> Parser<'a> {
                 match bind_type {
                     BindByRef(..) | BindByValue(MutMutable) => {
                         let token_str = self.this_token_to_str();
-                        self.fatal(format!("unexpected `{}`", token_str))
+                        self.fatal(format!("unexpected `{}`",
+                                           token_str).as_slice())
                     }
                     _ => {}
                 }
@@ -3202,7 +3212,8 @@ impl<'a> Parser<'a> {
                     };
                     let tok_str = self.this_token_to_str();
                     self.fatal(format!("expected {}`(` or `\\{`, but found `{}`",
-                                       ident_str, tok_str))
+                                       ident_str,
+                                       tok_str).as_slice())
                 }
             };
 
@@ -3606,7 +3617,8 @@ impl<'a> Parser<'a> {
     fn expect_self_ident(&mut self) {
         if !self.is_self_ident() {
             let token_str = self.this_token_to_str();
-            self.fatal(format!("expected `self` but found `{}`", token_str))
+            self.fatal(format!("expected `self` but found `{}`",
+                               token_str).as_slice())
         }
         self.bump();
     }
@@ -3738,7 +3750,7 @@ impl<'a> Parser<'a> {
                 _ => {
                     let token_str = self.this_token_to_str();
                     self.fatal(format!("expected `,` or `)`, found `{}`",
-                                       token_str))
+                                       token_str).as_slice())
                 }
             }
         } else {
@@ -4005,8 +4017,9 @@ impl<'a> Parser<'a> {
                 fields.push(self.parse_struct_decl_field());
             }
             if fields.len() == 0 {
-                self.fatal(format!("unit-like struct definition should be written as `struct {};`",
-                                   token::get_ident(class_name)));
+                self.fatal(format!("unit-like struct definition should be \
+                                    written as `struct {};`",
+                                   token::get_ident(class_name)).as_slice());
             }
             self.bump();
         } else if self.token == token::LPAREN {
@@ -4036,7 +4049,7 @@ impl<'a> Parser<'a> {
             let token_str = self.this_token_to_str();
             self.fatal(format!("expected `\\{`, `(`, or `;` after struct \
                                 name but found `{}`",
-                               token_str))
+                               token_str).as_slice())
         }
 
         let _ = ast::DUMMY_NODE_ID;  // FIXME: Workaround for crazy bug.
@@ -4066,7 +4079,7 @@ impl<'a> Parser<'a> {
                 let token_str = self.this_token_to_str();
                 self.span_fatal(self.span,
                                 format!("expected `,`, or `\\}` but found `{}`",
-                                        token_str))
+                                        token_str).as_slice())
             }
         }
         a_var
@@ -4147,7 +4160,7 @@ impl<'a> Parser<'a> {
               _ => {
                   let token_str = self.this_token_to_str();
                   self.fatal(format!("expected item but found `{}`",
-                                     token_str))
+                                     token_str).as_slice())
               }
             }
         }
@@ -4229,8 +4242,8 @@ impl<'a> Parser<'a> {
             Some(d) => (dir_path.join(d), true),
             None => {
                 let mod_name = mod_string.get().to_owned();
-                let default_path_str = mod_name + ".rs";
-                let secondary_path_str = mod_name + "/mod.rs";
+                let default_path_str = format!("{}.rs", mod_name);
+                let secondary_path_str = format!("{}/mod.rs", mod_name);
                 let default_path = dir_path.join(default_path_str.as_slice());
                 let secondary_path = dir_path.join(secondary_path_str.as_slice());
                 let default_exists = default_path.exists();
@@ -4246,12 +4259,14 @@ impl<'a> Parser<'a> {
                     self.span_note(id_sp,
                                    format!("maybe move this module `{0}` \
                                             to its own directory via \
-                                            `{0}/mod.rs`", this_module));
+                                            `{0}/mod.rs`",
+                                           this_module).as_slice());
                     if default_exists || secondary_exists {
                         self.span_note(id_sp,
                                        format!("... or maybe `use` the module \
                                                 `{}` instead of possibly \
-                                                redeclaring it", mod_name));
+                                                redeclaring it",
+                                               mod_name).as_slice());
                     }
                     self.abort_if_errors();
                 }
@@ -4260,12 +4275,19 @@ impl<'a> Parser<'a> {
                     (true, false) => (default_path, false),
                     (false, true) => (secondary_path, true),
                     (false, false) => {
-                        self.span_fatal(id_sp, format!("file not found for module `{}`", mod_name));
+                        self.span_fatal(id_sp,
+                                        format!("file not found for module \
+                                                 `{}`",
+                                                 mod_name).as_slice());
                     }
                     (true, true) => {
-                        self.span_fatal(id_sp,
-                                        format!("file for module `{}` found at both {} and {}",
-                                             mod_name, default_path_str, secondary_path_str));
+                        self.span_fatal(
+                            id_sp,
+                            format!("file for module `{}` found at both {} \
+                                     and {}",
+                                    mod_name,
+                                    default_path_str,
+                                    secondary_path_str).as_slice());
                     }
                 }
             }
@@ -4290,7 +4312,7 @@ impl<'a> Parser<'a> {
                     err.push_str(" -> ");
                 }
                 err.push_str(path.display().as_maybe_owned().as_slice());
-                self.span_fatal(id_sp, err.into_owned());
+                self.span_fatal(id_sp, err.as_slice());
             }
             None => ()
         }
@@ -4348,12 +4370,14 @@ impl<'a> Parser<'a> {
         let ty = self.parse_ty(false);
         let hi = self.span.hi;
         self.expect(&token::SEMI);
-        @ast::ForeignItem { ident: ident,
-                            attrs: attrs,
-                            node: ForeignItemStatic(ty, mutbl),
-                            id: ast::DUMMY_NODE_ID,
-                            span: mk_sp(lo, hi),
-                            vis: vis }
+        @ast::ForeignItem {
+            ident: ident,
+            attrs: attrs,
+            node: ForeignItemStatic(ty, mutbl),
+            id: ast::DUMMY_NODE_ID,
+            span: mk_sp(lo, hi),
+            vis: vis,
+        }
     }
 
     // parse safe/unsafe and fn
@@ -4418,8 +4442,9 @@ impl<'a> Parser<'a> {
             _ => {
                 let token_str = self.this_token_to_str();
                 self.span_fatal(self.span,
-                                format!("expected extern crate name but found `{}`",
-                                        token_str));
+                                format!("expected extern crate name but \
+                                         found `{}`",
+                                        token_str).as_slice());
             }
         };
 
@@ -4586,11 +4611,10 @@ impl<'a> Parser<'a> {
                     None => {
                         self.span_err(
                             self.span,
-                            format!("illegal ABI: \
-                                  expected one of [{}], \
-                                  found `{}`",
-                                 abi::all_names().connect(", "),
-                                 the_string));
+                            format!("illegal ABI: expected one of [{}], \
+                                     found `{}`",
+                                    abi::all_names().connect(", "),
+                                    the_string).as_slice());
                         None
                     }
                 }
@@ -4645,7 +4669,8 @@ impl<'a> Parser<'a> {
                    self.span_err(mk_sp(lo, self.last_span.hi),
                                  format!("`extern mod` is obsolete, use \
                                           `extern crate` instead \
-                                          to refer to external crates."))
+                                          to refer to external \
+                                          crates.").as_slice())
                 }
                 return self.parse_item_extern_crate(lo, visibility, attrs);
             }
@@ -4670,7 +4695,8 @@ impl<'a> Parser<'a> {
 
             let token_str = self.this_token_to_str();
             self.span_fatal(self.span,
-                            format!("expected `\\{` or `fn` but found `{}`", token_str));
+                            format!("expected `\\{` or `fn` but found `{}`",
+                                    token_str).as_slice());
         }
 
         let is_virtual = self.eat_keyword(keywords::Virtual);
@@ -5076,7 +5102,8 @@ impl<'a> Parser<'a> {
                         }
                         ViewItemExternCrate(..) if !extern_mod_allowed => {
                             self.span_err(view_item.span,
-                                          "\"extern crate\" declarations are not allowed here");
+                                          "\"extern crate\" declarations are \
+                                           not allowed here");
                         }
                         ViewItemExternCrate(..) => {}
                     }
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index f08cf264f8b..b334aa63270 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -135,7 +135,9 @@ pub fn buf_str(toks: Vec<Token>,
         if i != left {
             s.push_str(", ");
         }
-        s.push_str(format!("{}={}", szs.get(i), tok_str(toks.get(i).clone())));
+        s.push_str(format!("{}={}",
+                           szs.get(i),
+                           tok_str(toks.get(i).clone())).as_slice());
         i += 1u;
         i %= n;
     }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 15b931d5854..5500ca45753 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -141,7 +141,8 @@ pub fn to_str(f: |&mut State| -> IoResult<()>) -> StrBuf {
         // that we "know" to be a `MemWriter` that works around the lack of checked
         // downcasts.
         let (_, wr): (uint, Box<MemWriter>) = mem::transmute_copy(&s.s.out);
-        let result = str::from_utf8_owned(wr.get_ref().to_owned()).unwrap();
+        let result =
+            str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap();
         mem::forget(wr);
         result.to_strbuf()
     }
@@ -623,7 +624,7 @@ impl<'a> State<'a> {
             }
             ast::ItemForeignMod(ref nmod) => {
                 try!(self.head("extern"));
-                try!(self.word_nbsp(nmod.abi.to_str()));
+                try!(self.word_nbsp(nmod.abi.to_str().as_slice()));
                 try!(self.bopen());
                 try!(self.print_foreign_mod(nmod, item.attrs.as_slice()));
                 try!(self.bclose(item.span));
@@ -2234,7 +2235,7 @@ impl<'a> State<'a> {
                 let mut res = StrBuf::from_str("'");
                 ch.escape_default(|c| res.push_char(c));
                 res.push_char('\'');
-                word(&mut self.s, res.into_owned())
+                word(&mut self.s, res.as_slice())
             }
             ast::LitInt(i, t) => {
                 word(&mut self.s,
@@ -2247,11 +2248,14 @@ impl<'a> State<'a> {
                                               ast_util::ForceSuffix).as_slice())
             }
             ast::LitIntUnsuffixed(i) => {
-                word(&mut self.s, format!("{}", i))
+                word(&mut self.s, format!("{}", i).as_slice())
             }
             ast::LitFloat(ref f, t) => {
                 word(&mut self.s,
-                     f.get() + ast_util::float_ty_to_str(t).as_slice())
+                     format!(
+                         "{}{}",
+                         f.get(),
+                         ast_util::float_ty_to_str(t).as_slice()).as_slice())
             }
             ast::LitFloatUnsuffixed(ref f) => word(&mut self.s, f.get()),
             ast::LitNil => word(&mut self.s, "()"),
@@ -2261,8 +2265,13 @@ impl<'a> State<'a> {
             ast::LitBinary(ref arr) => {
                 try!(self.ibox(indent_unit));
                 try!(word(&mut self.s, "["));
-                try!(self.commasep_cmnt(Inconsistent, arr.as_slice(),
-                                        |s, u| word(&mut s.s, format!("{}", *u)),
+                try!(self.commasep_cmnt(Inconsistent,
+                                        arr.as_slice(),
+                                        |s, u| {
+                                            word(&mut s.s,
+                                                 format!("{}",
+                                                         *u).as_slice())
+                                        },
                                         |_| lit.span));
                 try!(word(&mut self.s, "]"));
                 self.end()
@@ -2354,11 +2363,16 @@ impl<'a> State<'a> {
     pub fn print_string(&mut self, st: &str,
                         style: ast::StrStyle) -> IoResult<()> {
         let st = match style {
-            ast::CookedStr => format!("\"{}\"", st.escape_default()),
-            ast::RawStr(n) => format!("r{delim}\"{string}\"{delim}",
-                                      delim="#".repeat(n), string=st)
+            ast::CookedStr => {
+                (format!("\"{}\"", st.escape_default()))
+            }
+            ast::RawStr(n) => {
+                (format!("r{delim}\"{string}\"{delim}",
+                         delim="#".repeat(n),
+                         string=st))
+            }
         };
-        word(&mut self.s, st)
+        word(&mut self.s, st.as_slice())
     }
 
     pub fn next_comment(&mut self) -> Option<comments::Comment> {
@@ -2389,7 +2403,7 @@ impl<'a> State<'a> {
             Some(abi::Rust) => Ok(()),
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abi.to_str())
+                self.word_nbsp(abi.to_str().as_slice())
             }
             None => Ok(())
         }
@@ -2400,7 +2414,7 @@ impl<'a> State<'a> {
         match opt_abi {
             Some(abi) => {
                 try!(self.word_nbsp("extern"));
-                self.word_nbsp(abi.to_str())
+                self.word_nbsp(abi.to_str().as_slice())
             }
             None => Ok(())
         }
@@ -2416,7 +2430,7 @@ impl<'a> State<'a> {
 
         if abi != abi::Rust {
             try!(self.word_nbsp("extern"));
-            try!(self.word_nbsp(abi.to_str()));
+            try!(self.word_nbsp(abi.to_str().as_slice()));
         }
 
         word(&mut self.s, "fn")