summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2014-04-15 18:17:48 -0700
committerBrian Anderson <banderson@mozilla.com>2014-04-18 17:25:34 -0700
commit919889a1d688a6bbe2edac8705f048f06b1b455c (patch)
tree322a69fa39bdaf37bbfffc84020acbd4c87871d0 /src/libsyntax
parentb75683cadf6c4c55360202cd6a0106be80532451 (diff)
downloadrust-919889a1d688a6bbe2edac8705f048f06b1b455c.tar.gz
rust-919889a1d688a6bbe2edac8705f048f06b1b455c.zip
Replace all ~"" with "".to_owned()
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/codemap.rs34
-rw-r--r--src/libsyntax/crateid.rs46
-rw-r--r--src/libsyntax/diagnostic.rs8
-rw-r--r--src/libsyntax/ext/asm.rs2
-rw-r--r--src/libsyntax/ext/deriving/encodable.rs6
-rw-r--r--src/libsyntax/ext/deriving/generic.rs2
-rw-r--r--src/libsyntax/ext/expand.rs26
-rw-r--r--src/libsyntax/ext/quote.rs32
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs8
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
-rw-r--r--src/libsyntax/fold.rs10
-rw-r--r--src/libsyntax/parse/comments.rs26
-rw-r--r--src/libsyntax/parse/lexer.rs81
-rw-r--r--src/libsyntax/parse/mod.rs30
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/libsyntax/parse/token.rs106
-rw-r--r--src/libsyntax/print/pp.rs8
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/util/parser_testing.rs4
20 files changed, 220 insertions, 219 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index e0b84438353..437f865b449 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -187,7 +187,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 {
 }
 
 pub fn float_ty_to_str(t: FloatTy) -> ~str {
-    match t { TyF32 => ~"f32", TyF64 => ~"f64" }
+    match t { TyF32 => "f32".to_owned(), TyF64 => "f64".to_owned() }
 }
 
 pub fn is_call_expr(e: @Expr) -> bool {
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index b174dffdfec..760310e81d3 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -354,7 +354,7 @@ impl CodeMap {
 
     pub fn span_to_str(&self, sp: Span) -> ~str {
         if self.files.borrow().len() == 0 && sp == DUMMY_SP {
-            return ~"no-location";
+            return "no-location".to_owned();
         }
 
         let lo = self.lookup_char_pos_adj(sp.lo);
@@ -515,19 +515,19 @@ mod test {
     #[test]
     fn t1 () {
         let cm = CodeMap::new();
-        let fm = cm.new_filemap(~"blork.rs",~"first line.\nsecond line");
+        let fm = cm.new_filemap("blork.rs".to_owned(),"first line.\nsecond line".to_owned());
         fm.next_line(BytePos(0));
-        assert_eq!(&fm.get_line(0),&~"first line.");
+        assert_eq!(&fm.get_line(0),&"first line.".to_owned());
         // TESTING BROKEN BEHAVIOR:
         fm.next_line(BytePos(10));
-        assert_eq!(&fm.get_line(1),&~".");
+        assert_eq!(&fm.get_line(1),&".".to_owned());
     }
 
     #[test]
     #[should_fail]
     fn t2 () {
         let cm = CodeMap::new();
-        let fm = cm.new_filemap(~"blork.rs",~"first line.\nsecond line");
+        let fm = cm.new_filemap("blork.rs".to_owned(),"first line.\nsecond line".to_owned());
         // TESTING *REALLY* BROKEN BEHAVIOR:
         fm.next_line(BytePos(0));
         fm.next_line(BytePos(10));
@@ -536,9 +536,9 @@ mod test {
 
     fn init_code_map() -> CodeMap {
         let cm = CodeMap::new();
-        let fm1 = cm.new_filemap(~"blork.rs",~"first line.\nsecond line");
-        let fm2 = cm.new_filemap(~"empty.rs",~"");
-        let fm3 = cm.new_filemap(~"blork2.rs",~"first line.\nsecond line");
+        let fm1 = cm.new_filemap("blork.rs".to_owned(),"first line.\nsecond line".to_owned());
+        let fm2 = cm.new_filemap("empty.rs".to_owned(),"".to_owned());
+        let fm3 = cm.new_filemap("blork2.rs".to_owned(),"first line.\nsecond line".to_owned());
 
         fm1.next_line(BytePos(0));
         fm1.next_line(BytePos(12));
@@ -555,11 +555,11 @@ mod test {
         let cm = init_code_map();
 
         let fmabp1 = cm.lookup_byte_offset(BytePos(22));
-        assert_eq!(fmabp1.fm.name, ~"blork.rs");
+        assert_eq!(fmabp1.fm.name, "blork.rs".to_owned());
         assert_eq!(fmabp1.pos, BytePos(22));
 
         let fmabp2 = cm.lookup_byte_offset(BytePos(24));
-        assert_eq!(fmabp2.fm.name, ~"blork2.rs");
+        assert_eq!(fmabp2.fm.name, "blork2.rs".to_owned());
         assert_eq!(fmabp2.pos, BytePos(0));
     }
 
@@ -581,12 +581,12 @@ mod test {
         let cm = init_code_map();
 
         let loc1 = cm.lookup_char_pos(BytePos(22));
-        assert_eq!(loc1.file.name, ~"blork.rs");
+        assert_eq!(loc1.file.name, "blork.rs".to_owned());
         assert_eq!(loc1.line, 2);
         assert_eq!(loc1.col, CharPos(10));
 
         let loc2 = cm.lookup_char_pos(BytePos(24));
-        assert_eq!(loc2.file.name, ~"blork2.rs");
+        assert_eq!(loc2.file.name, "blork2.rs".to_owned());
         assert_eq!(loc2.line, 1);
         assert_eq!(loc2.col, CharPos(0));
     }
@@ -594,8 +594,8 @@ mod test {
     fn init_code_map_mbc() -> CodeMap {
         let cm = CodeMap::new();
         // € is a three byte utf8 char.
-        let fm1 = cm.new_filemap(~"blork.rs",~"fir€st €€€€ line.\nsecond line");
-        let fm2 = cm.new_filemap(~"blork2.rs",~"first line€€.\n€ second line");
+        let fm1 = cm.new_filemap("blork.rs".to_owned(),"fir€st €€€€ line.\nsecond line".to_owned());
+        let fm2 = cm.new_filemap("blork2.rs".to_owned(),"first line€€.\n€ second line".to_owned());
 
         fm1.next_line(BytePos(0));
         fm1.next_line(BytePos(22));
@@ -639,7 +639,7 @@ mod test {
         let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None};
         let file_lines = cm.span_to_lines(span);
 
-        assert_eq!(file_lines.file.name, ~"blork.rs");
+        assert_eq!(file_lines.file.name, "blork.rs".to_owned());
         assert_eq!(file_lines.lines.len(), 1);
         assert_eq!(*file_lines.lines.get(0), 1u);
     }
@@ -651,7 +651,7 @@ mod test {
         let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None};
         let snippet = cm.span_to_snippet(span);
 
-        assert_eq!(snippet, Some(~"second line"));
+        assert_eq!(snippet, Some("second line".to_owned()));
     }
 
     #[test]
@@ -661,6 +661,6 @@ mod test {
         let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None};
         let sstr =  cm.span_to_str(span);
 
-        assert_eq!(sstr, ~"blork.rs:2:1: 2:12");
+        assert_eq!(sstr, "blork.rs:2:1: 2:12".to_owned());
     }
 }
diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs
index 353e1a23b5e..61c6af62768 100644
--- a/src/libsyntax/crateid.rs
+++ b/src/libsyntax/crateid.rs
@@ -123,17 +123,17 @@ impl CrateId {
 #[test]
 fn bare_name() {
     let crateid: CrateId = from_str("foo").expect("valid crateid");
-    assert_eq!(crateid.name, ~"foo");
+    assert_eq!(crateid.name, "foo".to_owned());
     assert_eq!(crateid.version, None);
-    assert_eq!(crateid.path, ~"foo");
+    assert_eq!(crateid.path, "foo".to_owned());
 }
 
 #[test]
 fn bare_name_single_char() {
     let crateid: CrateId = from_str("f").expect("valid crateid");
-    assert_eq!(crateid.name, ~"f");
+    assert_eq!(crateid.name, "f".to_owned());
     assert_eq!(crateid.version, None);
-    assert_eq!(crateid.path, ~"f");
+    assert_eq!(crateid.path, "f".to_owned());
 }
 
 #[test]
@@ -145,17 +145,17 @@ fn empty_crateid() {
 #[test]
 fn simple_path() {
     let crateid: CrateId = from_str("example.com/foo/bar").expect("valid crateid");
-    assert_eq!(crateid.name, ~"bar");
+    assert_eq!(crateid.name, "bar".to_owned());
     assert_eq!(crateid.version, None);
-    assert_eq!(crateid.path, ~"example.com/foo/bar");
+    assert_eq!(crateid.path, "example.com/foo/bar".to_owned());
 }
 
 #[test]
 fn simple_version() {
     let crateid: CrateId = from_str("foo#1.0").expect("valid crateid");
-    assert_eq!(crateid.name, ~"foo");
-    assert_eq!(crateid.version, Some(~"1.0"));
-    assert_eq!(crateid.path, ~"foo");
+    assert_eq!(crateid.name, "foo".to_owned());
+    assert_eq!(crateid.version, Some("1.0".to_owned()));
+    assert_eq!(crateid.path, "foo".to_owned());
 }
 
 #[test]
@@ -173,39 +173,39 @@ fn path_ends_with_slash() {
 #[test]
 fn path_and_version() {
     let crateid: CrateId = from_str("example.com/foo/bar#1.0").expect("valid crateid");
-    assert_eq!(crateid.name, ~"bar");
-    assert_eq!(crateid.version, Some(~"1.0"));
-    assert_eq!(crateid.path, ~"example.com/foo/bar");
+    assert_eq!(crateid.name, "bar".to_owned());
+    assert_eq!(crateid.version, Some("1.0".to_owned()));
+    assert_eq!(crateid.path, "example.com/foo/bar".to_owned());
 }
 
 #[test]
 fn single_chars() {
     let crateid: CrateId = from_str("a/b#1").expect("valid crateid");
-    assert_eq!(crateid.name, ~"b");
-    assert_eq!(crateid.version, Some(~"1"));
-    assert_eq!(crateid.path, ~"a/b");
+    assert_eq!(crateid.name, "b".to_owned());
+    assert_eq!(crateid.version, Some("1".to_owned()));
+    assert_eq!(crateid.path, "a/b".to_owned());
 }
 
 #[test]
 fn missing_version() {
     let crateid: CrateId = from_str("foo#").expect("valid crateid");
-    assert_eq!(crateid.name, ~"foo");
+    assert_eq!(crateid.name, "foo".to_owned());
     assert_eq!(crateid.version, None);
-    assert_eq!(crateid.path, ~"foo");
+    assert_eq!(crateid.path, "foo".to_owned());
 }
 
 #[test]
 fn path_and_name() {
     let crateid: CrateId = from_str("foo/rust-bar#bar:1.0").expect("valid crateid");
-    assert_eq!(crateid.name, ~"bar");
-    assert_eq!(crateid.version, Some(~"1.0"));
-    assert_eq!(crateid.path, ~"foo/rust-bar");
+    assert_eq!(crateid.name, "bar".to_owned());
+    assert_eq!(crateid.version, Some("1.0".to_owned()));
+    assert_eq!(crateid.path, "foo/rust-bar".to_owned());
 }
 
 #[test]
 fn empty_name() {
     let crateid: CrateId = from_str("foo/bar#:1.0").expect("valid crateid");
-    assert_eq!(crateid.name, ~"bar");
-    assert_eq!(crateid.version, Some(~"1.0"));
-    assert_eq!(crateid.path, ~"foo/bar");
+    assert_eq!(crateid.name, "bar".to_owned());
+    assert_eq!(crateid.version, Some("1.0".to_owned()));
+    assert_eq!(crateid.path, "foo/bar".to_owned());
 }
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index e63f2960421..4d487689c67 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -99,7 +99,7 @@ impl SpanHandler {
         fail!(ExplicitBug);
     }
     pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
-        self.span_bug(sp, ~"unimplemented " + msg);
+        self.span_bug(sp, "unimplemented ".to_owned() + msg);
     }
     pub fn handler<'a>(&'a self) -> &'a Handler {
         &self.handler
@@ -136,7 +136,7 @@ impl Handler {
         let s;
         match self.err_count.get() {
           0u => return,
-          1u => s = ~"aborting due to previous error",
+          1u => s = "aborting due to previous error".to_owned(),
           _  => {
             s = format!("aborting due to {} previous errors",
                      self.err_count.get());
@@ -155,7 +155,7 @@ impl Handler {
         fail!(ExplicitBug);
     }
     pub fn unimpl(&self, msg: &str) -> ! {
-        self.bug(~"unimplemented " + msg);
+        self.bug("unimplemented ".to_owned() + msg);
     }
     pub fn emit(&self,
                 cmsp: Option<(&codemap::CodeMap, Span)>,
@@ -452,7 +452,7 @@ fn print_macro_backtrace(w: &mut EmitterWriter,
                          sp: Span)
                          -> io::IoResult<()> {
     for ei in sp.expn_info.iter() {
-        let ss = ei.callee.span.as_ref().map_or(~"", |span| cm.span_to_str(*span));
+        let ss = ei.callee.span.as_ref().map_or("".to_owned(), |span| cm.span_to_str(*span));
         let (pre, post) = match ei.callee.format {
             codemap::MacroAttribute => ("#[", "]"),
             codemap::MacroBang => ("", "!")
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs
index efefe885acb..9b362f8d942 100644
--- a/src/libsyntax/ext/asm.rs
+++ b/src/libsyntax/ext/asm.rs
@@ -56,7 +56,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     let mut asm_str_style = None;
     let mut outputs = Vec::new();
     let mut inputs = Vec::new();
-    let mut cons = ~"";
+    let mut cons = "".to_owned();
     let mut volatile = false;
     let mut alignstack = false;
     let mut dialect = ast::AsmAtt;
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs
index 90ea8701562..1c3edce96fb 100644
--- a/src/libsyntax/ext/deriving/encodable.rs
+++ b/src/libsyntax/ext/deriving/encodable.rs
@@ -36,7 +36,7 @@ impl<D:Decoder> Decodable for node_id {
     fn decode(d: &D) -> Node {
         d.read_struct("Node", 1, || {
             Node {
-                id: d.read_field(~"x", 0, || decode(d))
+                id: d.read_field("x".to_owned(), 0, || decode(d))
             }
         })
     }
@@ -73,8 +73,8 @@ would yield functions like:
         fn decode(d: &D) -> spanned<T> {
             d.read_rec(|| {
                 {
-                    node: d.read_field(~"node", 0, || decode(d)),
-                    span: d.read_field(~"span", 1, || decode(d)),
+                    node: d.read_field("node".to_owned(), 0, || decode(d)),
+                    span: d.read_field("span".to_owned(), 1, || decode(d)),
                 }
             })
         }
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index 8a44caf34a5..1d4aa08f9e3 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -864,7 +864,7 @@ impl<'a> MethodDef<'a> {
 
         } else {  // there are still matches to create
             let current_match_str = if match_count == 0 {
-                ~"__self"
+                "__self".to_owned()
             } else {
                 format!("__arg_{}", match_count)
             };
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index d73cb3856f9..734d07ccb8f 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1019,11 +1019,11 @@ mod test {
     // make sure that macros can leave scope
     #[should_fail]
     #[test] fn macros_cant_escape_fns_test () {
-        let src = ~"fn bogus() {macro_rules! z (() => (3+4))}\
-                    fn inty() -> int { z!() }";
+        let src = "fn bogus() {macro_rules! z (() => (3+4))}\
+                   fn inty() -> int { z!() }".to_owned();
         let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
-            ~"<test>",
+            "<test>".to_owned(),
             src,
             Vec::new(), &sess);
         // should fail:
@@ -1039,11 +1039,11 @@ mod test {
     // make sure that macros can leave scope for modules
     #[should_fail]
     #[test] fn macros_cant_escape_mods_test () {
-        let src = ~"mod foo {macro_rules! z (() => (3+4))}\
-                    fn inty() -> int { z!() }";
+        let src = "mod foo {macro_rules! z (() => (3+4))}\
+                   fn inty() -> int { z!() }".to_owned();
         let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
-            ~"<test>",
+            "<test>".to_owned(),
             src,
             Vec::new(), &sess);
         // should fail:
@@ -1058,11 +1058,11 @@ mod test {
 
     // macro_escape modules shouldn't cause macros to leave scope
     #[test] fn macros_can_escape_flattened_mods_test () {
-        let src = ~"#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
-                    fn inty() -> int { z!() }";
+        let src = "#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\
+                   fn inty() -> int { z!() }".to_owned();
         let sess = parse::new_parse_sess();
         let crate_ast = parse::parse_crate_from_source_str(
-            ~"<test>",
+            "<test>".to_owned(),
             src,
             Vec::new(), &sess);
         // should fail:
@@ -1130,7 +1130,7 @@ mod test {
     //}
 
     #[test] fn macro_tokens_should_match(){
-        expand_crate_str(~"macro_rules! m((a)=>(13)) fn main(){m!(a);}");
+        expand_crate_str("macro_rules! m((a)=>(13)) fn main(){m!(a);}".to_owned());
     }
 
     // renaming tests expand a crate and then check that the bindings match
@@ -1260,10 +1260,10 @@ mod test {
     }
 
     #[test] fn fmt_in_macro_used_inside_module_macro() {
-        let crate_str = ~"macro_rules! fmt_wrap(($b:expr)=>($b.to_str()))
+        let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_str()))
 macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}}))
 foo_module!()
-";
+".to_owned();
         let cr = expand_crate_str(crate_str);
         // find the xx binding
         let mut name_finder = new_name_finder(Vec::new());
@@ -1309,7 +1309,7 @@ foo_module!()
 
     #[test]
     fn pat_idents(){
-        let pat = string_to_pat(~"(a,Foo{x:c @ (b,9),y:Bar(4,d)})");
+        let pat = string_to_pat("(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_owned());
         let mut pat_idents = new_name_finder(Vec::new());
         pat_idents.visit_pat(pat, ());
         assert_eq!(pat_idents.ident_accumulator,
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 7664d089149..7d86b988077 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -393,11 +393,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
 
         LIT_INT(i, ity) => {
             let s_ity = match ity {
-                ast::TyI => ~"TyI",
-                ast::TyI8 => ~"TyI8",
-                ast::TyI16 => ~"TyI16",
-                ast::TyI32 => ~"TyI32",
-                ast::TyI64 => ~"TyI64"
+                ast::TyI => "TyI".to_owned(),
+                ast::TyI8 => "TyI8".to_owned(),
+                ast::TyI16 => "TyI16".to_owned(),
+                ast::TyI32 => "TyI32".to_owned(),
+                ast::TyI64 => "TyI64".to_owned()
             };
             let e_ity = cx.expr_ident(sp, id_ext(s_ity));
 
@@ -410,11 +410,11 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
 
         LIT_UINT(u, uty) => {
             let s_uty = match uty {
-                ast::TyU => ~"TyU",
-                ast::TyU8 => ~"TyU8",
-                ast::TyU16 => ~"TyU16",
-                ast::TyU32 => ~"TyU32",
-                ast::TyU64 => ~"TyU64"
+                ast::TyU => "TyU".to_owned(),
+                ast::TyU8 => "TyU8".to_owned(),
+                ast::TyU16 => "TyU16".to_owned(),
+                ast::TyU32 => "TyU32".to_owned(),
+                ast::TyU64 => "TyU64".to_owned()
             };
             let e_uty = cx.expr_ident(sp, id_ext(s_uty));
 
@@ -435,8 +435,8 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
 
         LIT_FLOAT(fident, fty) => {
             let s_fty = match fty {
-                ast::TyF32 => ~"TyF32",
-                ast::TyF64 => ~"TyF64"
+                ast::TyF32 => "TyF32".to_owned(),
+                ast::TyF64 => "TyF64".to_owned()
             };
             let e_fty = cx.expr_ident(sp, id_ext(s_fty));
 
@@ -649,10 +649,10 @@ fn expand_wrapper(cx: &ExtCtxt,
                   cx_expr: @ast::Expr,
                   expr: @ast::Expr) -> @ast::Expr {
     let uses = vec!( cx.view_use_glob(sp, ast::Inherited,
-                                   ids_ext(vec!(~"syntax",
-                                             ~"ext",
-                                             ~"quote",
-                                             ~"rt"))) );
+                                   ids_ext(vec!("syntax".to_owned(),
+                                             "ext".to_owned(),
+                                             "quote".to_owned(),
+                                             "rt".to_owned()))) );
 
     let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr);
 
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 62999fb496a..8143f2aceeb 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -366,9 +366,9 @@ pub fn parse(sess: &ParseSess,
                 }
                 return Success(nameize(sess, ms, v.as_slice()));
             } else if eof_eis.len() > 1u {
-                return Error(sp, ~"ambiguity: multiple successful parses");
+                return Error(sp, "ambiguity: multiple successful parses".to_owned());
             } else {
-                return Failure(sp, ~"unexpected end of macro invocation");
+                return Failure(sp, "unexpected end of macro invocation".to_owned());
             }
         } else {
             if (bb_eis.len() > 0u && next_eis.len() > 0u)
@@ -436,7 +436,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
         token::IDENT(sn,b) => { p.bump(); token::NtIdent(~sn,b) }
         _ => {
             let token_str = token::to_str(&p.token);
-            p.fatal(~"expected ident, found " + token_str)
+            p.fatal("expected ident, found ".to_owned() + token_str)
         }
       },
       "path" => {
@@ -450,6 +450,6 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
         res
       }
       "matchers" => token::NtMatchers(p.parse_matchers()),
-      _ => p.fatal(~"unsupported builtin nonterminal parser: " + name)
+      _ => p.fatal("unsupported builtin nonterminal parser: ".to_owned() + name)
     }
 }
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 279544d106e..78ea37587f0 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -132,7 +132,7 @@ fn generic_extension(cx: &ExtCtxt,
 
     // Which arm's failure should we report? (the one furthest along)
     let mut best_fail_spot = DUMMY_SP;
-    let mut best_fail_msg = ~"internal error: ran no matchers";
+    let mut best_fail_msg = "internal error: ran no matchers".to_owned();
 
     for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
         match **lhs {
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index cc3ae025263..fc4f427d8d7 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -947,24 +947,24 @@ mod test {
     #[test] fn ident_transformation () {
         let mut zz_fold = ToZzIdentFolder;
         let ast = string_to_crate(
-            ~"#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}");
+            "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_owned());
         let folded_crate = zz_fold.fold_crate(ast);
         assert_pred!(matches_codepattern,
                      "matches_codepattern",
                      pprust::to_str(|s| fake_print_crate(s, &folded_crate)),
-                     ~"#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}");
+                     "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_owned());
     }
 
     // even inside macro defs....
     #[test] fn ident_transformation_in_defs () {
         let mut zz_fold = ToZzIdentFolder;
         let ast = string_to_crate(
-            ~"macro_rules! a {(b $c:expr $(d $e:token)f+ => \
-              (g $(d $d $e)+))} ");
+            "macro_rules! a {(b $c:expr $(d $e:token)f+ => \
+             (g $(d $d $e)+))} ".to_owned());
         let folded_crate = zz_fold.fold_crate(ast);
         assert_pred!(matches_codepattern,
                      "matches_codepattern",
                      pprust::to_str(|s| fake_print_crate(s, &folded_crate)),
-                     ~"zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))");
+                     "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))".to_owned());
     }
 }
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 1a246eb7f2c..a96905f8597 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -238,7 +238,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<~str> ,
         Some(col) => {
             if col < len {
                 s.slice(col, len).to_owned()
-            } else {  ~"" }
+            } else {  "".to_owned() }
         }
         None => s,
     };
@@ -279,7 +279,7 @@ fn read_block_comment(rdr: &mut StringReader,
         while level > 0 {
             debug!("=== block comment level {}", level);
             if is_eof(rdr) {
-                rdr.fatal(~"unterminated block comment");
+                rdr.fatal("unterminated block comment".to_owned());
             }
             if rdr.curr_is('\n') {
                 trim_whitespace_prefix_and_push_line(&mut lines,
@@ -405,41 +405,41 @@ mod test {
     #[test] fn test_block_doc_comment_1() {
         let comment = "/**\n * Test \n **  Test\n *   Test\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, ~" Test \n*  Test\n   Test");
+        assert_eq!(stripped, " Test \n*  Test\n   Test".to_owned());
     }
 
     #[test] fn test_block_doc_comment_2() {
         let comment = "/**\n * Test\n *  Test\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, ~" Test\n  Test");
+        assert_eq!(stripped, " Test\n  Test".to_owned());
     }
 
     #[test] fn test_block_doc_comment_3() {
         let comment = "/**\n let a: *int;\n *a = 5;\n*/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, ~" let a: *int;\n *a = 5;");
+        assert_eq!(stripped, " let a: *int;\n *a = 5;".to_owned());
     }
 
     #[test] fn test_block_doc_comment_4() {
         let comment = "/*******************\n test\n *********************/";
         let stripped = strip_doc_comment_decoration(comment);
-        assert_eq!(stripped, ~" test");
+        assert_eq!(stripped, " test".to_owned());
     }
 
     #[test] fn test_line_doc_comment() {
         let stripped = strip_doc_comment_decoration("/// test");
-        assert_eq!(stripped, ~" test");
+        assert_eq!(stripped, " test".to_owned());
         let stripped = strip_doc_comment_decoration("///! test");
-        assert_eq!(stripped, ~" test");
+        assert_eq!(stripped, " test".to_owned());
         let stripped = strip_doc_comment_decoration("// test");
-        assert_eq!(stripped, ~" test");
+        assert_eq!(stripped, " test".to_owned());
         let stripped = strip_doc_comment_decoration("// test");
-        assert_eq!(stripped, ~" test");
+        assert_eq!(stripped, " test".to_owned());
         let stripped = strip_doc_comment_decoration("///test");
-        assert_eq!(stripped, ~"test");
+        assert_eq!(stripped, "test".to_owned());
         let stripped = strip_doc_comment_decoration("///!test");
-        assert_eq!(stripped, ~"test");
+        assert_eq!(stripped, "test".to_owned());
         let stripped = strip_doc_comment_decoration("//test");
-        assert_eq!(stripped, ~"test");
+        assert_eq!(stripped, "test".to_owned());
     }
 }
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index c1c91cb6a4f..ff087d95e50 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -400,9 +400,9 @@ fn consume_block_comment(rdr: &mut StringReader) -> Option<TokenAndSpan> {
     while level > 0 {
         if is_eof(rdr) {
             let msg = if is_doc_comment {
-                ~"unterminated block doc-comment"
+                "unterminated block doc-comment".to_owned()
             } else {
-                ~"unterminated block comment"
+                "unterminated block comment".to_owned()
             };
             fatal_span(rdr, start_bpos, rdr.last_pos, msg);
         } else if rdr.curr_is('/') && nextch_is(rdr, '*') {
@@ -456,7 +456,7 @@ fn scan_exponent(rdr: &mut StringReader, start_bpos: BytePos) -> Option<~str> {
             return Some(rslt.into_owned());
         } else {
             fatal_span(rdr, start_bpos, rdr.last_pos,
-                       ~"scan_exponent: bad fp literal");
+                       "scan_exponent: bad fp literal".to_owned());
         }
     } else { return None::<~str>; }
 }
@@ -480,11 +480,11 @@ fn check_float_base(rdr: &mut StringReader, start_bpos: BytePos, last_bpos: Byte
                     base: uint) {
     match base {
       16u => fatal_span(rdr, start_bpos, last_bpos,
-                      ~"hexadecimal float literal is not supported"),
+                      "hexadecimal float literal is not supported".to_owned()),
       8u => fatal_span(rdr, start_bpos, last_bpos,
-                     ~"octal float literal is not supported"),
+                     "octal float literal is not supported".to_owned()),
       2u => fatal_span(rdr, start_bpos, last_bpos,
-                     ~"binary float literal is not supported"),
+                     "binary float literal is not supported".to_owned()),
       _ => ()
     }
 }
@@ -544,13 +544,13 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
         }
         if num_str.len() == 0u {
             fatal_span(rdr, start_bpos, rdr.last_pos,
-                       ~"no valid digits found for number");
+                       "no valid digits found for number".to_owned());
         }
         let parsed = match from_str_radix::<u64>(num_str.as_slice(),
                                                  base as uint) {
             Some(p) => p,
             None => fatal_span(rdr, start_bpos, rdr.last_pos,
-                               ~"int literal is too large")
+                               "int literal is too large".to_owned())
         };
 
         match tp {
@@ -595,7 +595,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
             back-end.  */
         } else {
             fatal_span(rdr, start_bpos, rdr.last_pos,
-                       ~"expected `f32` or `f64` suffix");
+                       "expected `f32` or `f64` suffix".to_owned());
         }
     }
     if is_float {
@@ -605,13 +605,13 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token {
     } else {
         if num_str.len() == 0u {
             fatal_span(rdr, start_bpos, rdr.last_pos,
-                       ~"no valid digits found for number");
+                       "no valid digits found for number".to_owned());
         }
         let parsed = match from_str_radix::<u64>(num_str.as_slice(),
                                                  base as uint) {
             Some(p) => p,
             None => fatal_span(rdr, start_bpos, rdr.last_pos,
-                               ~"int literal is too large")
+                               "int literal is too large".to_owned())
         };
 
         debug!("lexing {} as an unsuffixed integer literal",
@@ -628,7 +628,7 @@ fn scan_numeric_escape(rdr: &mut StringReader, n_hex_digits: uint) -> char {
         let n = rdr.curr;
         if !is_hex_digit(n) {
             fatal_span_char(rdr, rdr.last_pos, rdr.pos,
-                            ~"illegal character in numeric character escape",
+                            "illegal character in numeric character escape".to_owned(),
                             n.unwrap());
         }
         bump(rdr);
@@ -638,13 +638,13 @@ fn scan_numeric_escape(rdr: &mut StringReader, n_hex_digits: uint) -> char {
     }
     if i != 0 && is_eof(rdr) {
         fatal_span(rdr, start_bpos, rdr.last_pos,
-                   ~"unterminated numeric character escape");
+                   "unterminated numeric character escape".to_owned());
     }
 
     match char::from_u32(accum_int as u32) {
         Some(x) => x,
         None => fatal_span(rdr, start_bpos, rdr.last_pos,
-                           ~"illegal numeric character escape")
+                           "illegal numeric character escape".to_owned())
     }
 }
 
@@ -813,11 +813,12 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
 
             if token::is_keyword(token::keywords::Self, tok) {
                 fatal_span(rdr, start, rdr.last_pos,
-                           ~"invalid lifetime name: 'self is no longer a special lifetime");
+                           "invalid lifetime name: 'self \
+                            is no longer a special lifetime".to_owned());
             } else if token::is_any_keyword(tok) &&
                 !token::is_keyword(token::keywords::Static, tok) {
                 fatal_span(rdr, start, rdr.last_pos,
-                           ~"invalid lifetime name");
+                           "invalid lifetime name".to_owned());
             } else {
                 return token::LIFETIME(ident);
             }
@@ -846,7 +847,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
                             'U' => scan_numeric_escape(rdr, 8u),
                             c2 => {
                                 fatal_span_char(rdr, escaped_pos, rdr.last_pos,
-                                                ~"unknown character escape", c2)
+                                                "unknown character escape".to_owned(), c2)
                             }
                         }
                     }
@@ -854,7 +855,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
             }
             '\t' | '\n' | '\r' | '\'' => {
                 fatal_span_char(rdr, start, rdr.last_pos,
-                                ~"character constant must be escaped", c2);
+                                "character constant must be escaped".to_owned(), c2);
             }
             _ => {}
         }
@@ -865,7 +866,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
                                // ascii single quote.
                                start - BytePos(1),
                                rdr.last_pos,
-                               ~"unterminated character constant");
+                               "unterminated character constant".to_owned());
         }
         bump(rdr); // advance curr past token
         return token::LIT_CHAR(c2 as u32);
@@ -877,7 +878,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
         while !rdr.curr_is('"') {
             if is_eof(rdr) {
                 fatal_span(rdr, start_bpos, rdr.last_pos,
-                           ~"unterminated double quote string");
+                           "unterminated double quote string".to_owned());
             }
 
             let ch = rdr.curr.unwrap();
@@ -886,7 +887,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
               '\\' => {
                 if is_eof(rdr) {
                     fatal_span(rdr, start_bpos, rdr.last_pos,
-                           ~"unterminated double quote string");
+                           "unterminated double quote string".to_owned());
                 }
 
                 let escaped = rdr.curr.unwrap();
@@ -912,7 +913,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
                   }
                   c2 => {
                     fatal_span_char(rdr, escaped_pos, rdr.last_pos,
-                                    ~"unknown string escape", c2);
+                                    "unknown string escape".to_owned(), c2);
                   }
                 }
               }
@@ -933,11 +934,11 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
 
         if is_eof(rdr) {
             fatal_span(rdr, start_bpos, rdr.last_pos,
-                       ~"unterminated raw string");
+                       "unterminated raw string".to_owned());
         } else if !rdr.curr_is('"') {
             fatal_span_char(rdr, start_bpos, rdr.last_pos,
-                            ~"only `#` is allowed in raw string delimitation; \
-                              found illegal character",
+                            "only `#` is allowed in raw string delimitation; \
+                             found illegal character".to_owned(),
                             rdr.curr.unwrap());
         }
         bump(rdr);
@@ -946,7 +947,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
         'outer: loop {
             if is_eof(rdr) {
                 fatal_span(rdr, start_bpos, rdr.last_pos,
-                           ~"unterminated raw string");
+                           "unterminated raw string".to_owned());
             }
             if rdr.curr_is('"') {
                 content_end_bpos = rdr.last_pos;
@@ -994,7 +995,7 @@ fn next_token_inner(rdr: &mut StringReader) -> token::Token {
       '%' => { return binop(rdr, token::PERCENT); }
       c => {
           fatal_span_char(rdr, rdr.last_pos, rdr.pos,
-                          ~"unknown start of token", c);
+                          "unknown start of token".to_owned(), c);
       }
     }
 }
@@ -1022,15 +1023,15 @@ mod test {
     // open a string reader for the given string
     fn setup<'a>(span_handler: &'a diagnostic::SpanHandler,
                  teststr: ~str) -> StringReader<'a> {
-        let fm = span_handler.cm.new_filemap(~"zebra.rs", teststr);
+        let fm = span_handler.cm.new_filemap("zebra.rs".to_owned(), teststr);
         new_string_reader(span_handler, fm)
     }
 
     #[test] fn t1 () {
         let span_handler = mk_sh();
         let mut string_reader = setup(&span_handler,
-            ~"/* my source file */ \
-              fn main() { println!(\"zebra\"); }\n");
+            "/* my source file */ \
+             fn main() { println!(\"zebra\"); }\n".to_owned());
         let id = str_to_ident("fn");
         let tok1 = string_reader.next_token();
         let tok2 = TokenAndSpan{
@@ -1063,54 +1064,54 @@ mod test {
     }
 
     #[test] fn doublecolonparsing () {
-        check_tokenization(setup(&mk_sh(), ~"a b"),
+        check_tokenization(setup(&mk_sh(), "a b".to_owned()),
                            vec!(mk_ident("a",false),
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_2 () {
-        check_tokenization(setup(&mk_sh(), ~"a::b"),
+        check_tokenization(setup(&mk_sh(), "a::b".to_owned()),
                            vec!(mk_ident("a",true),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_3 () {
-        check_tokenization(setup(&mk_sh(), ~"a ::b"),
+        check_tokenization(setup(&mk_sh(), "a ::b".to_owned()),
                            vec!(mk_ident("a",false),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn dcparsing_4 () {
-        check_tokenization(setup(&mk_sh(), ~"a:: b"),
+        check_tokenization(setup(&mk_sh(), "a:: b".to_owned()),
                            vec!(mk_ident("a",true),
                              token::MOD_SEP,
                              mk_ident("b",false)));
     }
 
     #[test] fn character_a() {
-        assert_eq!(setup(&mk_sh(), ~"'a'").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'a'".to_owned()).next_token().tok,
                    token::LIT_CHAR('a' as u32));
     }
 
     #[test] fn character_space() {
-        assert_eq!(setup(&mk_sh(), ~"' '").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "' '".to_owned()).next_token().tok,
                    token::LIT_CHAR(' ' as u32));
     }
 
     #[test] fn character_escaped() {
-        assert_eq!(setup(&mk_sh(), ~"'\\n'").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'\\n'".to_owned()).next_token().tok,
                    token::LIT_CHAR('\n' as u32));
     }
 
     #[test] fn lifetime_name() {
-        assert_eq!(setup(&mk_sh(), ~"'abc").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "'abc".to_owned()).next_token().tok,
                    token::LIFETIME(token::str_to_ident("abc")));
     }
 
     #[test] fn raw_string() {
-        assert_eq!(setup(&mk_sh(), ~"r###\"\"#a\\b\x00c\"\"###").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "r###\"\"#a\\b\x00c\"\"###".to_owned()).next_token().tok,
                    token::LIT_STR_RAW(token::str_to_ident("\"#a\\b\x00c\""), 3));
     }
 
@@ -1121,7 +1122,7 @@ mod test {
     }
 
     #[test] fn nested_block_comments() {
-        assert_eq!(setup(&mk_sh(), ~"/* /* */ */'a'").next_token().tok,
+        assert_eq!(setup(&mk_sh(), "/* /* */ */'a'".to_owned()).next_token().tok,
                    token::LIT_CHAR('a' as u32));
     }
 
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index eca9f955d93..4586980d893 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -302,7 +302,7 @@ mod test {
     }
 
     #[test] fn path_exprs_1() {
-        assert!(string_to_expr(~"a") ==
+        assert!(string_to_expr("a".to_owned()) ==
                    @ast::Expr{
                     id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
@@ -321,7 +321,7 @@ mod test {
     }
 
     #[test] fn path_exprs_2 () {
-        assert!(string_to_expr(~"::a::b") ==
+        assert!(string_to_expr("::a::b".to_owned()) ==
                    @ast::Expr {
                     id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
@@ -346,12 +346,12 @@ mod test {
 
     #[should_fail]
     #[test] fn bad_path_expr_1() {
-        string_to_expr(~"::abc::def::return");
+        string_to_expr("::abc::def::return".to_owned());
     }
 
     // check the token-tree-ization of macros
     #[test] fn string_to_tts_macro () {
-        let tts = string_to_tts(~"macro_rules! zip (($a)=>($a))");
+        let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_owned());
         let tts: &[ast::TokenTree] = tts.as_slice();
         match tts {
             [ast::TTTok(_,_),
@@ -404,9 +404,9 @@ mod test {
     }
 
     #[test] fn string_to_tts_1 () {
-        let tts = string_to_tts(~"fn a (b : int) { b; }");
+        let tts = string_to_tts("fn a (b : int) { b; }".to_owned());
         assert_eq!(to_json_str(&tts),
-        ~"[\
+        "[\
     {\
         \"variant\":\"TTTok\",\
         \"fields\":[\
@@ -528,12 +528,12 @@ mod test {
             ]\
         ]\
     }\
-]"
+]".to_owned()
         );
     }
 
     #[test] fn ret_expr() {
-        assert!(string_to_expr(~"return d") ==
+        assert!(string_to_expr("return d".to_owned()) ==
                    @ast::Expr{
                     id: ast::DUMMY_NODE_ID,
                     node:ast::ExprRet(Some(@ast::Expr{
@@ -556,7 +556,7 @@ mod test {
     }
 
     #[test] fn parse_stmt_1 () {
-        assert!(string_to_stmt(~"b;") ==
+        assert!(string_to_stmt("b;".to_owned()) ==
                    @Spanned{
                        node: ast::StmtExpr(@ast::Expr {
                            id: ast::DUMMY_NODE_ID,
@@ -583,7 +583,7 @@ mod test {
 
     #[test] fn parse_ident_pat () {
         let sess = new_parse_sess();
-        let mut parser = string_to_parser(&sess, ~"b");
+        let mut parser = string_to_parser(&sess, "b".to_owned());
         assert!(parser.parse_pat() ==
                    @ast::Pat{id: ast::DUMMY_NODE_ID,
                              node: ast::PatIdent(
@@ -607,7 +607,7 @@ mod test {
     // check the contents of the tt manually:
     #[test] fn parse_fundecl () {
         // this test depends on the intern order of "fn" and "int"
-        assert!(string_to_item(~"fn a (b : int) { b; }") ==
+        assert!(string_to_item("fn a (b : int) { b; }".to_owned()) ==
                   Some(
                       @ast::Item{ident:str_to_ident("a"),
                             attrs:Vec::new(),
@@ -699,12 +699,12 @@ mod test {
 
     #[test] fn parse_exprs () {
         // just make sure that they parse....
-        string_to_expr(~"3 + 4");
-        string_to_expr(~"a::z.froob(b,@(987+3))");
+        string_to_expr("3 + 4".to_owned());
+        string_to_expr("a::z.froob(b,@(987+3))".to_owned());
     }
 
     #[test] fn attrs_fix_bug () {
-        string_to_item(~"pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
+        string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
                    -> Result<@Writer, ~str> {
     #[cfg(windows)]
     fn wb() -> c_int {
@@ -715,7 +715,7 @@ mod test {
     fn wb() -> c_int { O_WRONLY as c_int }
 
     let mut fflags: c_int = wb();
-}");
+}".to_owned());
     }
 
 }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 379403e5409..58634be1995 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -384,7 +384,7 @@ impl<'a> Parser<'a> {
         fn tokens_to_str(tokens: &[token::Token]) -> ~str {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on Iterator.
-            let b = i.next().map_or(~"", |t| Parser::token_to_str(t));
+            let b = i.next().map_or("".to_owned(), |t| Parser::token_to_str(t));
             i.fold(b, |b,a| b + "`, `" + Parser::token_to_str(a))
         }
         if edible.contains(&self.token) {
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index de6dacbe766..77743cdb9df 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -141,56 +141,56 @@ impl fmt::Show for Nonterminal {
 
 pub fn binop_to_str(o: BinOp) -> ~str {
     match o {
-      PLUS => ~"+",
-      MINUS => ~"-",
-      STAR => ~"*",
-      SLASH => ~"/",
-      PERCENT => ~"%",
-      CARET => ~"^",
-      AND => ~"&",
-      OR => ~"|",
-      SHL => ~"<<",
-      SHR => ~">>"
+      PLUS => "+".to_owned(),
+      MINUS => "-".to_owned(),
+      STAR => "*".to_owned(),
+      SLASH => "/".to_owned(),
+      PERCENT => "%".to_owned(),
+      CARET => "^".to_owned(),
+      AND => "&".to_owned(),
+      OR => "|".to_owned(),
+      SHL => "<<".to_owned(),
+      SHR => ">>".to_owned()
     }
 }
 
 pub fn to_str(t: &Token) -> ~str {
     match *t {
-      EQ => ~"=",
-      LT => ~"<",
-      LE => ~"<=",
-      EQEQ => ~"==",
-      NE => ~"!=",
-      GE => ~">=",
-      GT => ~">",
-      NOT => ~"!",
-      TILDE => ~"~",
-      OROR => ~"||",
-      ANDAND => ~"&&",
+      EQ => "=".to_owned(),
+      LT => "<".to_owned(),
+      LE => "<=".to_owned(),
+      EQEQ => "==".to_owned(),
+      NE => "!=".to_owned(),
+      GE => ">=".to_owned(),
+      GT => ">".to_owned(),
+      NOT => "!".to_owned(),
+      TILDE => "~".to_owned(),
+      OROR => "||".to_owned(),
+      ANDAND => "&&".to_owned(),
       BINOP(op) => binop_to_str(op),
       BINOPEQ(op) => binop_to_str(op) + "=",
 
       /* Structural symbols */
-      AT => ~"@",
-      DOT => ~".",
-      DOTDOT => ~"..",
-      DOTDOTDOT => ~"...",
-      COMMA => ~",",
-      SEMI => ~";",
-      COLON => ~":",
-      MOD_SEP => ~"::",
-      RARROW => ~"->",
-      LARROW => ~"<-",
-      DARROW => ~"<->",
-      FAT_ARROW => ~"=>",
-      LPAREN => ~"(",
-      RPAREN => ~")",
-      LBRACKET => ~"[",
-      RBRACKET => ~"]",
-      LBRACE => ~"{",
-      RBRACE => ~"}",
-      POUND => ~"#",
-      DOLLAR => ~"$",
+      AT => "@".to_owned(),
+      DOT => ".".to_owned(),
+      DOTDOT => "..".to_owned(),
+      DOTDOTDOT => "...".to_owned(),
+      COMMA => ",".to_owned(),
+      SEMI => ";".to_owned(),
+      COLON => ":".to_owned(),
+      MOD_SEP => "::".to_owned(),
+      RARROW => "->".to_owned(),
+      LARROW => "<-".to_owned(),
+      DARROW => "<->".to_owned(),
+      FAT_ARROW => "=>".to_owned(),
+      LPAREN => "(".to_owned(),
+      RPAREN => ")".to_owned(),
+      LBRACKET => "[".to_owned(),
+      RBRACKET => "]".to_owned(),
+      LBRACE => "{".to_owned(),
+      RBRACE => "}".to_owned(),
+      POUND => "#".to_owned(),
+      DOLLAR => "$".to_owned(),
 
       /* Literals */
       LIT_CHAR(c) => {
@@ -232,29 +232,29 @@ pub fn to_str(t: &Token) -> ~str {
       LIFETIME(s) => {
           format!("'{}", get_ident(s))
       }
-      UNDERSCORE => ~"_",
+      UNDERSCORE => "_".to_owned(),
 
       /* Other */
       DOC_COMMENT(s) => get_ident(s).get().to_str(),
-      EOF => ~"<eof>",
+      EOF => "<eof>".to_owned(),
       INTERPOLATED(ref nt) => {
         match nt {
             &NtExpr(e) => ::print::pprust::expr_to_str(e),
             &NtMeta(e) => ::print::pprust::meta_item_to_str(e),
             _ => {
-                ~"an interpolated " +
+                "an interpolated ".to_owned() +
                     match *nt {
-                        NtItem(..) => ~"item",
-                        NtBlock(..) => ~"block",
-                        NtStmt(..) => ~"statement",
-                        NtPat(..) => ~"pattern",
+                        NtItem(..) => "item".to_owned(),
+                        NtBlock(..) => "block".to_owned(),
+                        NtStmt(..) => "statement".to_owned(),
+                        NtPat(..) => "pattern".to_owned(),
                         NtMeta(..) => fail!("should have been handled"),
                         NtExpr(..) => fail!("should have been handled above"),
-                        NtTy(..) => ~"type",
-                        NtIdent(..) => ~"identifier",
-                        NtPath(..) => ~"path",
-                        NtTT(..) => ~"tt",
-                        NtMatchers(..) => ~"matcher sequence"
+                        NtTy(..) => "type".to_owned(),
+                        NtIdent(..) => "identifier".to_owned(),
+                        NtPath(..) => "path".to_owned(),
+                        NtTT(..) => "tt".to_owned(),
+                        NtMatchers(..) => "matcher sequence".to_owned()
                     }
             }
         }
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index 6cd72cb58f1..21215748fb4 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -112,10 +112,10 @@ impl Token {
 pub fn tok_str(t: Token) -> ~str {
     match t {
         String(s, len) => return format!("STR({},{})", s, len),
-        Break(_) => return ~"BREAK",
-        Begin(_) => return ~"BEGIN",
-        End => return ~"END",
-        Eof => return ~"EOF"
+        Break(_) => return "BREAK".to_owned(),
+        Begin(_) => return "BEGIN".to_owned(),
+        End => return "END".to_owned(),
+        Eof => return "EOF".to_owned()
     }
 }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 429540efd37..7041a6585a0 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -2409,7 +2409,7 @@ mod test {
         let generics = ast_util::empty_generics();
         assert_eq!(&fun_to_str(&decl, ast::NormalFn, abba_ident,
                                None, &generics),
-                   &~"fn abba()");
+                   &"fn abba()".to_owned());
     }
 
     #[test]
@@ -2427,6 +2427,6 @@ mod test {
         });
 
         let varstr = variant_to_str(&var);
-        assert_eq!(&varstr,&~"pub principal_skinner");
+        assert_eq!(&varstr,&"pub principal_skinner".to_owned());
     }
 }
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index eb7b3162b52..cdf7455b1bc 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -18,12 +18,12 @@ use parse::token;
 // map a string to tts, using a made-up filename:
 pub fn string_to_tts(source_str: ~str) -> Vec<ast::TokenTree> {
     let ps = new_parse_sess();
-    filemap_to_tts(&ps, string_to_filemap(&ps, source_str,~"bogofile"))
+    filemap_to_tts(&ps, string_to_filemap(&ps, source_str,"bogofile".to_owned()))
 }
 
 // map string to parser (via tts)
 pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: ~str) -> Parser<'a> {
-    new_parser_from_source_str(ps, Vec::new(), ~"bogofile", source_str)
+    new_parser_from_source_str(ps, Vec::new(), "bogofile".to_owned(), source_str)
 }
 
 fn with_error_checking_parse<T>(s: ~str, f: |&mut Parser| -> T) -> T {