Skip to content

Cargo uses .cargo/config of workspace from which it is excluded #7620

@stevenroose

Description

@stevenroose

So we have a big cargo workspace, let's say in /workspace/. We have /workspace/vendor and /workspace/.cargo/config which points crates-io to this vendor directory. In /workspace/Cargo.toml we exclude one directory from the workspace:

exclude = [
    "excluded"
]

So, when I go into /workspace/excluded and I try to run cargo build, I'm getting these kind of errors:

error: failed to select a version for the requirement `libc = "^0.2.62"`
  candidate versions found which didn't match: 0.2.50
  location searched: directory source `/workspace/vendor` (which is replacing registry `https://github.com/rust-lang/crates.io-index`)
required by package `excluded v0.1.0 (/workspace/excluded)`
perhaps a crate was updated and forgotten to be re-vendored?

So it seems that the source replacement from .cargo/config is seen as totally separate from the workspace concept. This if of course very annoying and I would consider it a bug. A directory excluded from the workspace should not use configs that are set in the workspace directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions