Skip to content

Add PackageId to "dependencies" in cargo metadataΒ #7289

Open
@jsgf

Description

@jsgf

Problem
In cargo metadata, the name field in deps has - transformed to _, which means you need to normalize -/_ in order to compare it with the name field in dependencies.

For example:

      "dependencies": [
        {
          "name": "proc-macro2",
          "source": "registry+https://github.com/rust-lang/crates.io-index",
          "req": "^0.4",
          "kind": null,
[...]
        "deps": [
          {
            "name": "proc_macro2",
            "pkg": "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)"
          },

Steps

  1. Have a Cargo.toml with proc-macro2 as a dependency
  2. Run cargo metadata and compare the dependency and deps fields

Possible Solution(s)
The deps entries should have some field which directly corresponds to a field in dependencies.

Notes

Output of cargo version:
cargo 1.38.0-nightly (e853aa9 2019-08-09)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: enhancementCommand-metadataS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions