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

@@ -18,50 +18,50 @@ use parse::token;
// map a string to tts, using a made-up filename: return both the token_trees
// and the ParseSess
pub fn string_to_tts_and_sess (source_str : @~str) -> (~[ast::token_tree],@mut ParseSess) {
pub fn string_to_tts_and_sess (source_str : @str) -> (~[ast::token_tree],@mut ParseSess) {
let ps = new_parse_sess(None);
(filemap_to_tts(ps,string_to_filemap(ps,source_str,~"bogofile")),ps)
(filemap_to_tts(ps,string_to_filemap(ps,source_str,@"bogofile")),ps)
}
pub fn string_to_parser_and_sess(source_str: @~str) -> (Parser,@mut ParseSess) {
pub fn string_to_parser_and_sess(source_str: @str) -> (Parser,@mut ParseSess) {
let ps = new_parse_sess(None);
(new_parser_from_source_str(ps,~[],~"bogofile",source_str),ps)
(new_parser_from_source_str(ps,~[],@"bogofile",source_str),ps)
}
// map string to parser (via tts)
pub fn string_to_parser(source_str: @~str) -> Parser {
pub fn string_to_parser(source_str: @str) -> Parser {
let (p,_) = string_to_parser_and_sess(source_str);
p
}
pub fn string_to_crate (source_str : @~str) -> @ast::crate {
pub fn string_to_crate (source_str : @str) -> @ast::crate {
string_to_parser(source_str).parse_crate_mod()
}
// parse a string, return an expr
pub fn string_to_expr (source_str : @~str) -> @ast::expr {
pub fn string_to_expr (source_str : @str) -> @ast::expr {
string_to_parser(source_str).parse_expr()
}
// parse a string, return an item
pub fn string_to_item (source_str : @~str) -> Option<@ast::item> {
pub fn string_to_item (source_str : @str) -> Option<@ast::item> {
string_to_parser(source_str).parse_item(~[])
}
// parse a string, return an item and the ParseSess
pub fn string_to_item_and_sess (source_str : @~str) -> (Option<@ast::item>,@mut ParseSess) {
pub fn string_to_item_and_sess (source_str : @str) -> (Option<@ast::item>,@mut ParseSess) {
let (p,ps) = string_to_parser_and_sess(source_str);
(p.parse_item(~[]),ps)
}
// parse a string, return a stmt
pub fn string_to_stmt(source_str : @~str) -> @ast::stmt {
pub fn string_to_stmt(source_str : @str) -> @ast::stmt {
string_to_parser(source_str).parse_stmt(~[])
}
// parse a string, return a pat. Uses "irrefutable"... which doesn't
// (currently) affect parsing.
pub fn string_to_pat(source_str : @~str) -> @ast::pat {
pub fn string_to_pat(source_str : @str) -> @ast::pat {
string_to_parser(source_str).parse_pat()
}