-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow cargo rustc -- ...
for crates with both libs and binaries without needing to "filter"
#2642
Comments
|
Yes, that's what I consider to be the issue. Why can't the default behavior not be "build everything" instead of fail? If you want to filter you could still use |
Right, but that's precisely what |
Could you give a compelling reason behind this limitation? :) The only reason I can see currently for not implementing this is because it would make Cargo more complex. But as As I see it currently it wouldn't break anything to expand And this could be useful for better cargo integration in other tools (build tools, IDEs, ...) |
Cargo doesn't know what's getting passed to the compiler, so it has no idea if the compiler actually generates an appropriate output. As a result it can't know whether the binary in this case can actually depend on the library because the library may not be generated with a special set of flags. |
Ok, now I see. Thanks for the reply :) I guess I will have to wait for a native |
Ok, in that case I'll close in favor of that, thanks for the report though! |
At the moment you can't run cargo with specific rustc arguments, like
cargo rustc -- -Z no-trans
on a crate that contains both a library and a binary. Cargo responds that you should filter the target by using--lib
or--bin
Why does this limitation exist?
When creating binary crates I often tend to write the core logic in a library in the same crate. This limitation prevents me from running
cargo-check
on my crates using the linter-rust plugin in Atom for example.A better way to handle this is would be to have the same behavior as
cargo build
The text was updated successfully, but these errors were encountered: