Skip to content

Allow path-specific dependencies in [dev-dependencies] #3745

@lukaslueg

Description

@lukaslueg

Cargo currently refuses any Cargo.toml that includes a path-specific dependency. This is overly zealous, as crates.io could allow dev-dependencies to be path-specific: These never get touched while cargo builds something from crates.io.

A use case for a path-specific dev-dependency is a test-crate for integration tests, breaking a dependency cycle where the main crate dev-depends on a test-crate (as a path-specific dev-dependency) and the test-crate depends on the main-crate (as a normal dependency). Cargo actually does that right thing on cargo test and

  1. compiles the main crate first (satisfying the test-crate's dependency)
  2. the test-crate second (satisfying the dev-dependency) and
  3. executing the tests

On a normal cargo build, the path-specific dev-dependency will be ignored.

CC @alexcrichton

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dev-dependenciesArea: [dev-dependencies]C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-publish

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions