diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-13 03:02:55 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-13 10:20:52 +1000 |
| commit | 096f6f56a8178bd7f4b69a2ea909838e782766fb (patch) | |
| tree | 37513f0d39fdfb4d5a702a72abd7423c93c51cdf /src/libsyntax/util/parser_testing.rs | |
| parent | 641910dc1340b7786fd758282bac88639a58ddcd (diff) | |
| download | rust-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/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 76055ca7914..d0961ddbc70 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -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() } |
