-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make the rustc driver and interface demand driven #56732
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.
📣 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). |
Tested on commit rust-lang/rust@913ad6d. Direct link to PR: <rust-lang/rust#56732> 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra). 💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 rls on windows: test-pass → build-fail (cc @nrc @Xanewok, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @nrc @Xanewok, @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 😄 |
Updates clippy to work with new driver stuff from rust-lang/rust#56732 See #3733
Use the new rustc interface Shows the changes required to compile with rust-lang/rust#56732
Which was done as a part of rust-lang/rust#56732.
Use the new rustc interface Shows the changes required to compile with rust-lang/rust#56732
Which was done as a part of rust-lang/rust#56732.
Which was done as a part of rust-lang/rust#56732.
Update RLS and Clippy due to #56732 (rustc_interface crate) Closes #59060. In addition to plain submodule bumps, this also contains update to rls-rustc. The in-tree, from the RLS monorepo, version is used instead of the crates.io one (@nrc I think we might stop publishing `rls-rustc` altogether, right? It's only there to work around passing `-Zsave-analysis` to stable `rustc` and meant to be used only by RLS, IIRC). @Zoxc also due to how we need to access the expanded AST still from the RLS side in order to pass save analysis data in-memory, I delayed the AST drop after the `after_analysis` callback if the `-Zsave-analysis` is passed. It'd be also good if you could take a look at the changes inside the `rls` and `rls-rustc`: rust-lang/rls@6a1b5a9...6840dd6. The `rls-rustc` is based on your [PR](rust-dev-tools/rls-rustc#11) but I also had to change some bits in the RLS itself. r? @Zoxc / @Manishearth
This introduces a new crate
rustc_interface
which is the canonical interface for creating and using the compiler. It allows you to access aCompiler
type 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