about summary refs log tree commit diff
path: root/src/rustdoc/parse.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-04-27 14:21:17 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-04-30 10:44:31 -0700
commit2bb3b63ec4379b812aeceb690d78763ec55d3cbb (patch)
treef189a83d88971f52d155fb91438a4d8ad81033a4 /src/rustdoc/parse.rs
parentdc117fecde14706b3ab5fbcd64f743dba6de9e1b (diff)
downloadrust-2bb3b63ec4379b812aeceb690d78763ec55d3cbb.tar.gz
rust-2bb3b63ec4379b812aeceb690d78763ec55d3cbb.zip
Eliminate a copy in syntax::parse::new_parser_from_file
Fixing a FIXME turned out to be pretty involved. I added an io function
that returns a unique boxed string (for the contents of a file) rather than
a string, and went from there. Also made the src field of codemap a unique
boxed string. This doesn't seem to make that much difference in amount of
allocation according to valgrind (disappointingly), but I also had to introduce
a copy somewhere else pending a new snapshot, so maybe that's it.
Diffstat (limited to 'src/rustdoc/parse.rs')
-rw-r--r--src/rustdoc/parse.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rustdoc/parse.rs b/src/rustdoc/parse.rs
index 3ad8f51e8db..8c4c385c55b 100644
--- a/src/rustdoc/parse.rs
+++ b/src/rustdoc/parse.rs
@@ -27,18 +27,18 @@ fn from_file(file: str) -> @ast::crate {
         file, [], new_parse_sess())
 }
 
-fn from_str(source: str) -> @ast::crate {
+fn from_str(source: ~str) -> @ast::crate {
     parse::parse_crate_from_source_str(
-        "-", @source, [], new_parse_sess())
+        "-", source, [], new_parse_sess())
 }
 
-fn from_file_sess(sess: session::session, file: str) -> @ast::crate {
+fn from_file_sess(sess: session::session, &&file: str) -> @ast::crate {
     parse::parse_crate_from_file(file, cfg(sess), sess.parse_sess)
 }
 
-fn from_str_sess(sess: session::session, source: str) -> @ast::crate {
+fn from_str_sess(sess: session::session, &&source: ~str) -> @ast::crate {
     parse::parse_crate_from_source_str(
-        "-", @source, cfg(sess), sess.parse_sess)
+        "-", source, cfg(sess), sess.parse_sess)
 }
 
 fn cfg(sess: session::session) -> ast::crate_cfg {