Add proc-macro mark to index? #9605
Labels
A-registries
Area: registries
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Describe the problem you are trying to solve
For the new feature resolver (and cross-compilation), we need to consider build-time dependencies (build-dependencies and proc-macros) and other normal dependencies differently. But we cannot know if a crate is a proc-macro crate unless download and parse
Cargo.toml
. This information is not exposed in crates.io index or any crates.io public API.I found there is an attempt #8003 but related code is reverted in #8028 with the solution of "resolving features after downloading all sources". I'm not satisfied with this solution, since it assumes that we ALWAYS need to download all sources and it costs nothing.
That's NOT true for binary caching or distribution of crates, which I'm recently working on. To check if the binary artifacts of a specific dependency crate is available in cache, we need to determine its features, because it affects the compiled result. On the other hand, features of the crate can only be resolved if we know proc-macro information of all dependency crates, which requires downloading all sources. But it's clear that if the expected artifacts are in cache, we don't need to fetch these sources at all.
Yes I know that cargo don't ship binary distribution and instead always build everything from source. This feature request is kind of "open more future possibilities and benefit build systems other than cargo".
Describe the solution you'd like
Add a field to crates.io index indicates whether or not a package is a proc-macro library, as what we've done in #8003 .
Notes
cc @ehuss @alexcrichton
The text was updated successfully, but these errors were encountered: