Skip to content

cargo index add ignores cargo config source replacement config #14

@leighmcculloch

Description

@leighmcculloch

It appears like the cargo index add command ignores the .cargo/config.toml source replacement config.

I have this config:

[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'local-registry'

[source.local-registry]
local-registry = '/Users/leighmcculloch/Code/registry'

I've added a crate to my local registry successfully.

When I add another crate that is dependent on the first, cargo index add appears to keep going to crates.io to check if the dependency is published there, even though the source replacement is instructing it to use the local registry. Example of error:

Caused by: `cargo metadata` exited with an error:     Updating crates.io index
error: failed to select a version for the requirement `mycratea = "^0.0.5"`
candidate versions found which didn't match: 0.0.4, 0.0.3, 0.0.2, ...
location searched: crates.io index
required by package `mycrateb v0.0.5 (/private/var/folders/75/wqcxsy716bq0qht_8jtvw85h0000gn/T/.tmpC35uNV/my-crate-b-0.0.5)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions