-
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
--all-targets
ignores specific targets
#14542
Comments
Generally, CLI parsers are position-independent. If you say The code for where this is handled is at cargo/src/cargo/ops/cargo_compile/compile_filter.rs Lines 101 to 128 in 7984efa
This can work well for situations like an alias that you want to override a flag from. I had considered changing clap to prefer the "override" approach over "conflict", in terms of the exact same argument ( That doesn't mean that a conflict in this situation is the most correct approach. Also, if we did change it to an error, we'd need a case to be made for why it is safe and not a breaking change. #13629 does some analysis in that direction. A softer approach could be a warning. We would have to update the Whether we document or warn for this, it would help to better understand the situation that led to this issue. Why did you combine these arguments? What did you expect from it? |
That is what you asked for, so... why do you think this is not intuitive? You said "please build everything" and "please build the I would find it quite non-intuitive if cargo had not built |
Thanks for your input. One could think about explaining this bevahior in the help message, but I don't think that it is required. |
Problem
When both
--all-targets
and a specific target like--bin BIN_NAME
are specified, Cargo ignores the specific target. This is not intuitive and not documented.Steps
bin1
andbin2
.cargo check --all-targets --keep-going --bin bin1
. (--keep-going
to make sure that it runs until the end)bin1
andbin2
are checked.Possible Solution(s)
There are two solutions:
--all-targets
ignores any specific targets specified before or after it.Notes
See related issue in Rust-Analyzer: rust-lang/rust-analyzer#18110
Version
The text was updated successfully, but these errors were encountered: