Make the rustc driver and interface demand driven#56732
Make the rustc driver and interface demand driven#56732bors merged 1 commit intorust-lang:masterfrom
Conversation
|
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6a75222 to
32b4fb5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Since this will impact rls, clippy and miri quite strongly, could you open PRs against them showing how those changes will impact them? I would assume rls and miri to be easy (since they don't change compilation and just need access to the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors r=oli-obk |
|
📌 Commit 51938c6 has been approved by |
Make the rustc driver and interface demand driven This introduces a new crate `rustc_interface` which is the canonical interface for creating and using the compiler. It allows you to access a `Compiler` type in a closure and that types have methods to run passes on demand. The interesting parts are found [here (defining the queries)](https://github.com/Zoxc/rust/blob/rustc-interface/src/librustc_interface/queries.rs#L78) and [here (methods to create a `Compiler`)](https://github.com/Zoxc/rust/blob/rustc-interface/src/librustc_interface/interface.rs). cc @rust-lang/compiler @rust-lang/dev-tools @rust-lang/rustdoc
|
☀️ Test successful - checks-travis, status-appveyor |
|
📣 Toolstate changed by #56732! Tested on commit 913ad6d. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). |
|
I'm not entirely clear on how this changes the driver -- mind patching clippy's driver to work again? Use I think what we need to do is invoke parsing, attach the lints, and then continue with compilation. But I'm not sure. Overall it seems like this makes the driver API more brittle since driver consumers need to know what steps to invoke (as opposed to running the driver with some callbacks, where any change in the compilation process can still be picked up by clippy). There aren't many consumers of the driver interface, but this was supposed to be the path forward for things like clippy. Perhaps an interface which is "does the rustc compilation steps, but with callbacks" can still be exposed? |
|
Oh, I didn't notice that, thanks so much! While trying to implement this I didn't realize Callbacks existed now, I retract my objection about the driver api being more brittle 😄 |
This introduces a new crate
rustc_interfacewhich is the canonical interface for creating and using the compiler. It allows you to access aCompilertype in a closure and that types have methods to run passes on demand. The interesting parts are found here (defining the queries) and here (methods to create aCompiler).cc @rust-lang/compiler @rust-lang/dev-tools @rust-lang/rustdoc