Skip to content

Add proc-macro mark to index? #9605

Open

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-registriesArea: registriesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions