Skip to content

Add the ability to rename a crate inherited from the workspace #12546

Open
@fluiderson

Description

@fluiderson

Problem

Consider the following part with workspace dependencies from root Cargo.toml:

[workspace.dependencies]
itoa = "1"
itoa-old = { version = "0.4", package = "itoa" }

And parts with dependencies from 2 workspace members:

# member-1/Cargo.toml
[dependencies]
itoa.workspace = true
# member-2/Cargo.toml
[dependencies]
itoa = { workspace = true, package = "itoa-old" }

Before checking/compiling member-2, Cargo prints this warning:

warning: /home/user/ws/member-2/Cargo.toml: unused manifest key: dependencies.itoa.package

And hence ignores the package key from member-2's Cargo.toml.

So, unless I missed something in the documentation, Cargo can't rename dependencies inherited from the workspace.

Proposed Solution

Make Cargo read the package key in inherited dependencies, and rename them as it does with usual dependencies.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-workspace-inheritanceArea: workspace inheritance RFC 2906C-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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions