summary refs log tree commit diff
path: root/src/libsyntax/ext/source_util.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-06-13 03:02:55 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-06-13 10:20:52 +1000
commit096f6f56a8178bd7f4b69a2ea909838e782766fb (patch)
tree37513f0d39fdfb4d5a702a72abd7423c93c51cdf /src/libsyntax/ext/source_util.rs
parent641910dc1340b7786fd758282bac88639a58ddcd (diff)
downloadrust-096f6f56a8178bd7f4b69a2ea909838e782766fb.tar.gz
rust-096f6f56a8178bd7f4b69a2ea909838e782766fb.zip
Use @str instead of @~str in libsyntax and librustc. Fixes #5048.
This almost removes the StringRef wrapper, since all strings are
Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts
several things to be &'static str (the lint table and the intrinsics
table).

There are many instances of .to_managed(), unfortunately.
Diffstat (limited to 'src/libsyntax/ext/source_util.rs')
-rw-r--r--src/libsyntax/ext/source_util.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 79018ebd1ea..d92f4e8458b 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -59,21 +59,21 @@ pub fn expand_file(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
 
     let topmost = topmost_expn_info(cx.backtrace().get());
     let loc = cx.codemap().lookup_char_pos(topmost.call_site.lo);
-    let filename = copy loc.file.name;
+    let filename = loc.file.name;
     base::MRExpr(cx.expr_str(topmost.call_site, filename))
 }
 
 pub fn expand_stringify(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     let s = pprust::tts_to_str(tts, get_ident_interner());
-    base::MRExpr(cx.expr_str(sp, s))
+    base::MRExpr(cx.expr_str(sp, s.to_managed()))
 }
 
 pub fn expand_mod(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
     -> base::MacResult {
     base::check_zero_tts(cx, sp, tts, "module_path!");
     base::MRExpr(cx.expr_str(sp,
-                             cx.mod_path().map(|x| cx.str_of(*x)).connect("::")))
+                             cx.mod_path().map(|x| cx.str_of(*x)).connect("::").to_managed()))
 }
 
 // include! : parse the given file as an expr
@@ -94,13 +94,13 @@ pub fn expand_include_str(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
     let file = get_single_str_from_tts(cx, sp, tts, "include_str!");
     let res = io::read_whole_file_str(&res_rel_file(cx, sp, &Path(file)));
     match res {
-      result::Ok(_) => { /* Continue. */ }
-      result::Err(ref e) => {
-        cx.parse_sess().span_diagnostic.handler().fatal((*e));
+      result::Ok(res) => {
+          base::MRExpr(cx.expr_str(sp, res.to_managed()))
+      }
+      result::Err(e) => {
+        cx.span_fatal(sp, e);
       }
     }
-
-    base::MRExpr(cx.expr_str(sp, result::unwrap(res)))
 }
 
 pub fn expand_include_bin(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
@@ -131,7 +131,7 @@ fn topmost_expn_info(expn_info: @codemap::ExpnInfo) -> @codemap::ExpnInfo {
                             _
                         }) => {
                             // Don't recurse into file using "include!"
-                            if *name == ~"include" {
+                            if "include" == *name  {
                                 expn_info
                             } else {
                                 topmost_expn_info(next_expn_info)