Skip to content

Add support for the workspace.metadata key in Cargo.toml files #8309

@naerbnic

Description

@naerbnic
Contributor

Describe the problem you are trying to solve
External tools that work with Rust repositories often need metadata in order to apply user-configurable settings to different parts of that repository. For packages, the Cargo.toml key package.metadata has already been set aside for this purpose. The cargo project has promised to not use its contents to make any decisions for the base cargo tool, and has ensured that the tool will not report a warning for an unknown key for it.

When the Cargo.toml file in question is used to define a package, this is sufficient. However, in the case that the Cargo.toml file is used as a workspace root, there is no equivalent key. It is common for a Rust repository to have a single Cargo.toml file at its root that does not itself declare a package. Thus external tools that operate on a workspace as a whole do not have any specified location to place their configuration data within this Cargo.toml file.

Describe the solution you'd like
We should support the workspace.metadata Cargo.toml key that mirrors the existing package.metadata key. To my understanding, this means the following must hold.

  • The cargo tool must not use the workspace.metadata key in any semantically meaningful way.
  • The cargo tool must not impose any kind of explicit schema on the contents of that key.
  • The cargo tool should not warn about the existence of that key.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @naerbnic

        Issue actions

          Add support for the `workspace.metadata` key in Cargo.toml files · Issue #8309 · rust-lang/cargo