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.
This commit is contained in:
parent
dc117fecde
commit
2bb3b63ec4
15 changed files with 88 additions and 43 deletions
|
@ -289,7 +289,7 @@ fn should_extract_tys() {
|
|||
mod test {
|
||||
|
||||
fn mk_doc(source: str) -> doc::doc {
|
||||
let ast = parse::from_str(source);
|
||||
let ast = parse::from_str(~source);
|
||||
extract(ast, "")
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn extract_should_use_default_crate_name() {
|
||||
let source = "";
|
||||
let source = ~"";
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract(ast, "burp");
|
||||
assert doc.cratemod().name() == "burp";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue