Skip to content

Cargo silently ignores patch crates with a missing feature. #6444

@bjorn3

Description

@bjorn3

Steps

  1. Create a package my_package with a feature my_funky_feature:
    # my_package/Cargo.toml
    [package]
    name = "my_package
    [features]
    my_funky_feature = []
  2. Create a copy of my_package without the feature my_funky_feature:
    # my_package_copy/Cargo.toml
    [package]
    name = "my_package
    [features]
  3. Create yet another package my_bin, which depends on my_package, activates the feature my_funky_feature of it.
    # my_bin/Cargo.toml
    [package]
    name = "my_bin"
    [dependencies]
    my_package = { git = "github.com/aiofwiewof/vioe", features = ["my_funky_feature"] }
  4. Set the copy of my_package which doesn't have my_funky_feature as patch for my_package.
    # my_bin/Cargo.toml
    # [...]
    [patch."github.com/aiofwiewof/vioe"]
    my_package = { path = "../my_package_copy" }
  5. Cargo silently uses the original my_package without warning.

Possible Solution(s)
Give a warning when a patch is ignored, because there is a missing feature.

Notes

Output of cargo version:

cargo 1.33.0-nightly (2cf1f5dda 2018-12-11)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dependency-resolutionArea: dependency resolution and the resolverA-patchArea: [patch] table overrideC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions