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.
This commit is contained in:
Huon Wilson 2013-06-13 03:02:55 +10:00
parent 641910dc13
commit 096f6f56a8
94 changed files with 1259 additions and 1283 deletions

View file

@ -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)