Auto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakis

This allows compiling entire crates from memory or preprocessing source files before they are tokenized.

Minor API refactoring included, which is a [breaking-change] for libsyntax users:
* `ParseSess::{next_node_id, reserve_node_ids}` moved to rustc's `Session`
* `new_parse_sess` -> `ParseSess::new`
* `new_parse_sess_special_handler` -> `ParseSess::with_span_handler`
* `mk_span_handler` -> `SpanHandler::new`
* `default_handler` -> `Handler::new`
* `mk_handler` -> `Handler::with_emitter`
* `string_to_filemap(sess source, path)` -> `sess.codemap().new_filemap(path, source)`
This commit is contained in:
bors
2015-05-17 00:05:34 +00:00
23 changed files with 149 additions and 142 deletions

View File

@@ -1412,8 +1412,8 @@ mod tests {
fn mk_sh() -> diagnostic::SpanHandler {
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let emitter = diagnostic::EmitterWriter::new(Box::new(io::sink()), None);
let handler = diagnostic::mk_handler(true, Box::new(emitter));
diagnostic::mk_span_handler(handler, CodeMap::new())
let handler = diagnostic::Handler::with_emitter(true, Box::new(emitter));
diagnostic::SpanHandler::new(handler, CodeMap::new())
}
// open a string reader for the given string