Skip to content

Incorrect documentation for default-features in workspace dependencies #14841

Open
@konstin

Description

@konstin

The cargo docs on workspace packages say (https://doc.rust-lang.org/nightly/cargo/reference/specifying-dependencies.html#inheriting-a-dependency-from-a-workspace):

Along with the workspace key, dependencies can also include these keys:

  • optional: Note that the[workspace.dependencies] table is not allowed to specify optional.
  • features: These are additive with the features declared in the [workspace.dependencies]

Other than optional and features, inherited dependencies cannot use any other dependency key (such as version or default-features).

Trying this out however, cargo does not seem to mind the default-features key:

[workspace]
members = ["workspace-member"]
resolver = "2"

[workspace.dependencies]
flate2 = { version = "1.0.35", default-features = false }
url = { version = "2.5.3", features = ["serde"] }
[package]
name = "workspace-member"
version = "0.1.0"
edition = "2021"

[dependencies]
flate2 = { workspace = true, default-features = true }
url = { workspace = true, default-features = false }

It's unfortunately not clear to me from the docs if default-features are inherited.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationA-featuresArea: features — conditional compilationA-manifestArea: Cargo.toml issuesA-workspace-inheritanceArea: workspace inheritance RFC 2906S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions