Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-metadata's dep_kinds field can have duplicate entries #7752

Closed
sfackler opened this issue Dec 29, 2019 · 1 comment · Fixed by #7756
Closed

cargo-metadata's dep_kinds field can have duplicate entries #7752

sfackler opened this issue Dec 29, 2019 · 1 comment · Fixed by #7756
Labels

Comments

@sfackler
Copy link
Member

Using rustc 1.41.0-beta.1 (eb3f7c2d3 2019-12-17) and rustc 1.42.0-nightly (3a3f4a7cb 2019-12-28) the new dep_kinds field of cargo-metadata's output seems to behave weirdly in some cases.

For example, here's the resolve node for syn:

{
  "id": "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "dependencies": [
    "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
    "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
    "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)"
  ],
  "deps": [
    {
      "name": "proc_macro2",
      "pkg": "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
      "dep_kinds": [
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        }
      ]
    },
    {
      "name": "quote",
      "pkg": "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
      "dep_kinds": [
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        }
      ]
    },
    {
      "name": "unicode_xid",
      "pkg": "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
      "dep_kinds": [
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        },
        {
          "kind": null,
          "target": null
        }
      ]
    }
  ],
  "features": [
    "clone-impls",
    "default",
    "derive",
    "full",
    "parsing",
    "printing",
    "proc-macro",
    "quote",
    "visit"
  ]
}

Note how the dependencies each have three dep_kinds entries, even though each dependency is only listed once in syn's Cargo.toml:

[package]
name = "syn"
version = "1.0.11" # don't forget to update html_root_url and syn.json
authors = ["David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
description = "Parser for Rust source code"
repository = "https://github.com/dtolnay/syn"
documentation = "https://docs.rs/syn"
categories = ["development-tools::procedural-macro-helpers"]
readme = "README.md"
include = [
    "/benches/**",
    "/build.rs",
    "/Cargo.toml",
    "/LICENSE-APACHE",
    "/LICENSE-MIT",
    "/README.md",
    "/src/**",
    "/tests/**",
]
edition = "2018"

[features]
default = ["derive", "parsing", "printing", "clone-impls", "proc-macro"]
derive = []
full = []
parsing = []
printing = ["quote"]
visit = []
visit-mut = []
fold = []
clone-impls = []
extra-traits = []
proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"]

[dependencies]
proc-macro2 = { version = "1.0", default-features = false }
quote = { version = "1.0", optional = true, default-features = false }
unicode-xid = "0.2"

[dev-dependencies]
anyhow = "1.0"
flate2 = "1.0"
insta = "0.12"
rayon = "1.0"
ref-cast = "1.0"
regex = "1.0"
reqwest = { version = "0.10.0-alpha.2", features = ["blocking"] }
tar = "0.4"
termcolor = "1.0"
walkdir = "2.1"

[[bench]]
name = "rust"
harness = false
required-features = ["full", "parsing"]

[[bench]]
name = "file"
required-features = ["full", "parsing"]

[package.metadata.docs.rs]
all-features = true

[package.metadata.playground]
all-features = true

[badges]
travis-ci = { repository = "dtolnay/syn" }

[workspace]
members = ["dev", "json"]
@sfackler sfackler added the C-bug Category: bug label Dec 29, 2019
@sfackler sfackler changed the title cargo-metadata's dep_kinds field can have multiple entries with all null values cargo-metadata's dep_kinds field can have duplicate entries Dec 29, 2019
@ehuss
Copy link
Contributor

ehuss commented Dec 30, 2019

Ah, a bit of an unexpected interaction in a workspace. Fix posted at #7756.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants