Deny invalid dependency warnings

Hello, is there a way for such warnings to fail in CI:

warning: xxx v0.1.0 (...) ignoring invalid dependency "dependency-name" which is missing a lib target

I think this is a cargo warning, I tried with "cargo clippy -- -D warnings" and "cargo rustc --bin xxx -- -D warnings" but it doesn't throw an error on this warning.

I don't think I've ever seen that warning before. Can you paste the full output from cargo so we can see the context?

It might also be that a custom build script is emitting the warning based on some checks it makes at build time, and has nothing to do with cargo or rustc.

$ cd /tmp
$ cargo new --bin foo
$ cd foo
$ cargo new --bin bar
$ echo 'bar = { path = "bar" }' >> Cargo.toml
$ cargo build
warning: foo v0.1.0 (/tmp/foo) ignoring invalid dependency `bar` which is missing a lib target
   Compiling foo v0.1.0 (/tmp/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 2.88s
2 Likes

If I understand it correctly OP wants to turn the warning into an error on CI to ensure CI catches this kind of mistake.

1 Like

Yeah exactly, that's what I mean.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.