Skip to content

Teach cargo that crates.io has two equivalent indexes. #10722

@Eh2406

Description

@Eh2406

So I think the next piece of code for helping with stabilization has to do with teaching cargo that the two URLs registry+https://github.com/rust-lang/crates.io-index and sparse+https://index.crates.io/ are equivalent. Specifically making sure that lock files only show one even if both are available, and that you can successfully publish with either configured.

Testing with a .cargo/config.toml of:

[source.crates-io]
replace-with = "crates-io-http"

[source.crates-io-http]
registry = "sparse+https://index.crates.io/"

and it generates a lock file that has:

[[package]]
name = "serde"
version = "1.0.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"

So I don't think this is going to be super difficult. What I want is for cargo to act as if that override was set if -Z http-registry is passed (and no explicit override was set).

We may end up fixing the issue with publishing where there's a replacement as we work on this, but I think this will end up being implemented through a somewhat different code path. It will do the same thing as having a replacement, but it will not be implemented as literally a replacement. (Or if it is, cargo will know this one special and to treat it differently.)

cc: #9069

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions