Description
Excerpt taken (and slight adjusted) from rust-lang/rfcs#3344:
Add a flag --compile-time-deps
to cargo build
that will cause cargo to only build proc-macros and build-scripts (and their required dependencies) of the package graph well as running the build-scripts.
In case of the ecosystem introducing more compile time (executable) artifacts that are required to fully build a project, these artifacts should be included by this flag accordingly.
- Package Selection will limit the built artifacts to the selected packages and their dependencies.
- Target Selection will limit the built artifacts to the selected targets and their dependencies. This only has a noticeable effect for proc-macro packages, where not selecting their lib target will skip building it.
- Feature Selection apply the selected features to the build as usual.
- Compilation Options have no effect on the compiled artifacts. This is the same as a plain
cargo build
where build scripts and proc-macros are always built for host platform. - Output Options affect the locations of the generated artifacts as usual.
- Display Options affect the build as usual.
- Manifest Options affect the build as usual.
- Miscellaneous Options affect the build as usual.
Note "as usual" here refers to the behavior of a cargo build
invocation without the proposed flag.
The main reasoning behind this is that rust-analyzer (and likely RustRover) want to get rid of their buggy, incorrect, and cargo breaking RUSTC_WRAPPER
asap. Though as this flag requires a lot of use case collecting (outside of the IDE space) and general design iterations stabilizing it (especially in the proposed form) will take quite a long time either way so we mainly want to introduce this in some unstable form for these tools to consume for now. That does mean the IDE will likely have to employ some shenanigans to make use of this flag on stable (via RUSTC_BOOTSTRAP=1
for example) and then keeping a RUSTC_WRAPPER
that will strip that flag again before building (as to not break cursed build scripts probes).
Created this as per rust-lang/rfcs#3344 (comment).