-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract over the file loading mechanism in libsyntax's Parser. #25387
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
cc @nikomatsakis This is the custom file-loading API I was telling you about. |
@bors r+ lgtm |
📌 Commit 07d4f77 has been approved by |
⌛ Testing commit 07d4f77 with merge f171456... |
💔 Test failed - auto-mac-64-opt |
My bad, I've missed the error message change for loading non-UTF8 files. |
@bors r=nikomatsakis |
📌 Commit 8cc9878 has been approved by |
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 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'sSession
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)