about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-01-15 16:26:20 -0800
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-02 01:44:48 +1100
commite68108b3e8b8eaef62bb7b7340a77b96fcfc51cd (patch)
tree1c39cd392414e5db5505c05ce8f3abbd170f068a /src/libsyntax/parse
parentf152be7a425e7d66f717ffe8b210bcacf82539cc (diff)
downloadrust-e68108b3e8b8eaef62bb7b7340a77b96fcfc51cd.tar.gz
rust-e68108b3e8b8eaef62bb7b7340a77b96fcfc51cd.zip
librustc: Stop using `@str` for source.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/comments.rs2
-rw-r--r--src/libsyntax/parse/mod.rs88
2 files changed, 42 insertions, 48 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 21a34ab5e1e..bbd0e00f4dd 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -350,7 +350,7 @@ pub fn gather_comments_and_literals(span_diagnostic:
                                     path: @str,
                                     srdr: &mut io::Reader)
                                  -> (~[Comment], ~[Literal]) {
-    let src = str::from_utf8_owned(srdr.read_to_end()).unwrap().to_managed();
+    let src = str::from_utf8_owned(srdr.read_to_end()).unwrap();
     let cm = CodeMap::new();
     let filemap = cm.new_filemap(path, src);
     let rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap);
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index e026a11cafe..e7bc5ff3df3 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -89,12 +89,11 @@ pub fn parse_crate_attrs_from_file(
     return inner;
 }
 
-pub fn parse_crate_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> ast::Crate {
+pub fn parse_crate_from_source_str(name: @str,
+                                   source: ~str,
+                                   cfg: ast::CrateConfig,
+                                   sess: @ParseSess)
+                                   -> ast::Crate {
     let mut p = new_parser_from_source_str(sess,
                                            /*bad*/ cfg.clone(),
                                            name,
@@ -102,12 +101,11 @@ pub fn parse_crate_from_source_str(
     maybe_aborted(p.parse_crate_mod(),p)
 }
 
-pub fn parse_crate_attrs_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> ~[ast::Attribute] {
+pub fn parse_crate_attrs_from_source_str(name: @str,
+                                         source: ~str,
+                                         cfg: ast::CrateConfig,
+                                         sess: @ParseSess)
+                                         -> ~[ast::Attribute] {
     let mut p = new_parser_from_source_str(sess,
                                            /*bad*/ cfg.clone(),
                                            name,
@@ -116,44 +114,40 @@ pub fn parse_crate_attrs_from_source_str(
     return inner;
 }
 
-pub fn parse_expr_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> @ast::Expr {
+pub fn parse_expr_from_source_str(name: @str,
+                                  source: ~str,
+                                  cfg: ast::CrateConfig,
+                                  sess: @ParseSess)
+                                  -> @ast::Expr {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_expr(), p)
 }
 
-pub fn parse_item_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> Option<@ast::Item> {
+pub fn parse_item_from_source_str(name: @str,
+                                  source: ~str,
+                                  cfg: ast::CrateConfig,
+                                  sess: @ParseSess)
+                                  -> Option<@ast::Item> {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     let attrs = p.parse_outer_attributes();
     maybe_aborted(p.parse_item(attrs),p)
 }
 
-pub fn parse_meta_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> @ast::MetaItem {
+pub fn parse_meta_from_source_str(name: @str,
+                                  source: ~str,
+                                  cfg: ast::CrateConfig,
+                                  sess: @ParseSess)
+                                  -> @ast::MetaItem {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_meta_item(),p)
 }
 
-pub fn parse_stmt_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    attrs: ~[ast::Attribute],
-    sess: @ParseSess
-) -> @ast::Stmt {
+pub fn parse_stmt_from_source_str(name: @str,
+                                  source: ~str,
+                                  cfg: ast::CrateConfig,
+                                  attrs: ~[ast::Attribute],
+                                  sess: @ParseSess)
+                                  -> @ast::Stmt {
     let mut p = new_parser_from_source_str(
         sess,
         cfg,
@@ -163,12 +157,11 @@ pub fn parse_stmt_from_source_str(
     maybe_aborted(p.parse_stmt(attrs),p)
 }
 
-pub fn parse_tts_from_source_str(
-    name: @str,
-    source: @str,
-    cfg: ast::CrateConfig,
-    sess: @ParseSess
-) -> ~[ast::TokenTree] {
+pub fn parse_tts_from_source_str(name: @str,
+                                 source: ~str,
+                                 cfg: ast::CrateConfig,
+                                 sess: @ParseSess)
+                                 -> ~[ast::TokenTree] {
     let mut p = new_parser_from_source_str(
         sess,
         cfg,
@@ -184,8 +177,8 @@ pub fn parse_tts_from_source_str(
 pub fn new_parser_from_source_str(sess: @ParseSess,
                                   cfg: ast::CrateConfig,
                                   name: @str,
-                                  source: @str)
-                               -> Parser {
+                                  source: ~str)
+                                  -> Parser {
     filemap_to_parser(sess,string_to_filemap(sess,source,name),cfg)
 }
 
@@ -248,7 +241,8 @@ pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
     };
     match str::from_utf8_owned(bytes) {
         Some(s) => {
-            return string_to_filemap(sess, s.to_managed(),
+            return string_to_filemap(sess,
+                                     s,
                                      path.as_str().unwrap().to_managed());
         }
         None => {
@@ -260,7 +254,7 @@ pub fn file_to_filemap(sess: @ParseSess, path: &Path, spanopt: Option<Span>)
 
 // given a session and a string, add the string to
 // the session's codemap and return the new filemap
-pub fn string_to_filemap(sess: @ParseSess, source: @str, path: @str)
+pub fn string_to_filemap(sess: @ParseSess, source: ~str, path: @str)
     -> @FileMap {
     sess.cm.new_filemap(path, source)
 }