Skip to content

cargo allows pulling non-library dependencies #8382

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

Closed
ignatenkobrain opened this issue Jun 19, 2020 · 1 comment
Closed

cargo allows pulling non-library dependencies #8382

ignatenkobrain opened this issue Jun 19, 2020 · 1 comment
Labels
C-bug Category: bug

Comments

@ignatenkobrain
Copy link
Contributor

Problem

I am not sure if this is bug or a feature (if so, I would appreciate explanation of it)..

The question is about https://crates.io/crates/cargo-insta. From what I see (and what cargo tells me), it has only binary target, no lib / proc or anything like that.

Downloads/rust-cargo-insta/cargo-insta-0.16.0 is 📦 v0.16.0 via 🦀 v1.44.0 
❯ cargo metadata --no-deps | jq '.packages[0].targets[]'
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
{
  "kind": [
    "bin"
  ],
  "crate_types": [
    "bin"
  ],
  "name": "cargo-insta",
  "src_path": "/home/brain/Downloads/rust-cargo-insta/cargo-insta-0.16.0/src/main.rs",
  "edition": "2018",
  "doctest": false
}

Apparently specifying it in a dependencies section in Cargo.toml pulls it in and even compiles it, but I don't see any final binary (in target/) produced from that crate.

Steps

  1. Add cargo-insta = "0.16" into the [dependencies]
  2. Try to compile a project

Possible Solution(s)

  • Show warning
  • Abort with an error

Notes

Output of cargo version: cargo 1.44.0

This is happening on Fedora 33 (x86_64) with rust/cargo provided by a distribution.

@ignatenkobrain ignatenkobrain added the C-bug Category: bug label Jun 19, 2020
@ehuss
Copy link
Contributor

ehuss commented Jun 25, 2020

It should probably be a warning at least. Closing as a duplicate of #4226. There are also some vague ideas of making it a valid use-case (like #4316).

@ehuss ehuss closed this as completed Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants