Skip to content

Binary dependencies are not listed in metadata.packages or metadata.resolve #10607

@Alexendoo

Description

@Alexendoo

Problem

An artifact = "bin" dependency that doesn't specifiy lib = true will not appear in the packages or resolve properties of cargo metadata

It is listed in the dependencies of the dependant package

Steps

cargo new binary
cargo new --lib library

echo 'binary = { path = "../binary", artifact = "bin" }' >> library/Cargo.toml

cargo +nightly metadata -Zbindeps --manifest-path=library/Cargo.toml

Gives

{
    "packages": [
        {
            "name": "library",
            "version": "0.1.0",
            "id": "library 0.1.0 (path+file:///.../library)",
            "license": null,
            "license_file": null,
            "description": null,
            "source": null,
            "dependencies": [
                {
                    "name": "binary",
                    "source": null,
                    "req": "*",
                    "kind": null,
                    "rename": null,
                    "optional": false,
                    "uses_default_features": true,
                    "features": [],
                    "artifact": {
                        "kinds": [
                            "bin"
                        ],
                        "lib": false,
                        "target": null
                    },
                    "target": null,
                    "registry": null,
                    "path": "...\\binary"
                }
            ],
            "targets": [
                {
                    "kind": [
                        "lib"
                    ],
                    "crate_types": [
                        "lib"
                    ],
                    "name": "library",
                    "src_path": "...\\library\\src\\lib.rs",
                    "edition": "2021",
                    "doc": true,
                    "doctest": true,
                    "test": true
                }
            ],
            "features": {},
            "manifest_path": "...\\library\\Cargo.toml",
            "metadata": null,
            "publish": null,
            "authors": [],
            "categories": [],
            "keywords": [],
            "readme": null,
            "repository": null,
            "homepage": null,
            "documentation": null,
            "edition": "2021",
            "links": null,
            "default_run": null,
            "rust_version": null
        }
    ],
    "workspace_members": [
        "library 0.1.0 (path+file:///.../library)"
    ],
    "resolve": {
        "nodes": [
            {
                "id": "library 0.1.0 (path+file:///.../library)",
                "dependencies": [],
                "deps": [],
                "features": []
            }
        ],
        "root": "library 0.1.0 (path+file:///.../library)"
    },
    "target_directory": "...\\library\\target",
    "version": 1,
    "workspace_root": "...\\library",
    "metadata": null
}

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.62.0-nightly (edffc4ada 2022-04-19)
release: 1.62.0-nightly
commit-hash: edffc4ada3d77799e5a04eeafd9b2f843d29fc23
commit-date: 2022-04-19
host: x86_64-pc-windows-msvc
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:Schannel)
os: Windows 10.0.19044 (Windows 10 Pro) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugZ-bindepsNightly: binary artifact dependencies

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions