-
Notifications
You must be signed in to change notification settings - Fork 402
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
include_rustc_srcs creates many configured targets #833
Comments
So I read this as:
So I took a look, and yes, rust src has a lot of files! :) It goes down to 12K if you remove tests, and leave only rs and toml files. I guess pruning the sources in the repository rule makes sense (ideally we could download already pruned rust-src, so we don't pay the price of extracting + deleting, but I don't know if there is such archive available). Alternatively, as you suggested, we could tell Bazel/rust-analyzer to look somewhere for the rust-srcs checkout. This has a small disadvantage because the version of the checked out sources may get out of sync with the version of the toolchain used by Bazel. To do that, we would first remove the check here and add a check + flag here What do you think? If you have the capacity, would you be interested in pursuing this? |
Sure, I've submitted #844 which uses the pruned rust-src distribution (the component used by rustup for this purpose). What I was proposing for "looking elsewhere" was not to not have rules_rust download the necessary files (that makes sense to me), but rather just that the filegroup itself might not be necessary. As far as I can tell, its only purpose is to create a label that _rust_analyzer_impl can use to write the path in rust-project.json. |
Setting include_rustc_srcs=True creates a configured target for every rust source file. This greatly increases the number of targets in the external dependency.
With include_rustc_srcs=True:
Without:
This has a significant effect on analysis time in my small workspace. Here is a profile of a clean build for a hello world rust binary.
With include_rustc_srcs=True:
Without:
It appears the filegroup created by include_rustc_srcs=True is only used to support the rust_analyzer rule. Is it possible to point the rust_analyzer rule at the source root without creating all these bazel targets?
The text was updated successfully, but these errors were encountered: