Skip to content

Workspaces: Add a way to disable transitive inclusion of path dependencies #3192

@phil-opp

Description

@phil-opp

Right now, a workspace root automatically includes all of its path dependencies as workspace members. It would be nice if we could disable this somehow.

This is a follow-up to #3156.

Use case:

Assume that we have a local library crate that we don't want to publish (yet). We include it in multiple executable crates through path = "../our_library" dependencies:

├── our_library
│   ├── Cargo.toml
│   └── src
├── executable_1
│   ├── Cargo.toml
│   └── src
└── executable_2
    ├── Cargo.toml
    └── src

Now we want to make the executables workspace roots. This leads to the following errors:

error: workspace member /home/…/our_library/Cargo.toml is not hierarchically below the workspace root /home/…/executable_{1,2}/Cargo.toml

So each executable requires that we make our_library a workspace member of its own workspace. But a crate can't be part of multiple workspaces.

Right now, there is no way to resolve this problem, since there is no way to disable the automatic inclusion of path dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions