Skip to content

Automatically activate a dependency if its used elsewhere in dependency graph #1555

@cgaebel

Description

@cgaebel

Cargo should be able to express the idea of: "I want to depend on this package iff whoever depends on me is already depending on that package." This is especially useful because rust doesn't have orphan instances.

Specifically, I want to add a quickcheck Arbitrary instance to Iobuf. However, I don't want to add the dependency on Quickcheck for people not using it (non-test executables, for most people). It would be nice if it "just worked", perhaps in a new section:

[optional-dependencies]
quickcheck = "*"

And then anyone that depends on iobuf can have the quickcheck instances built for tests by including quickcheck in their dev-dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crate-dependenciesArea: [dependencies] of any kindA-featuresArea: features — conditional compilationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    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