Skip to content
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 doesn't work and contradicts the documentation #5134

Closed
infinity0 opened this issue Mar 6, 2018 · 2 comments
Closed

--all-targets doesn't work and contradicts the documentation #5134

infinity0 opened this issue Mar 6, 2018 · 2 comments

Comments

@infinity0
Copy link
Contributor

infinity0 commented Mar 6, 2018

cargo$ git grep all-targets
src/bin/bench.rs:    --all-targets                Benchmark all targets (default)
src/bin/build.rs:    --all-targets                Build all targets (lib and bin targets by default)
src/bin/check.rs:    --all-targets                Check all targets (lib and bin targets by default)
src/bin/rustc.rs:    --all-targets            Build all targets (lib and bin targets by default)
src/bin/rustdoc.rs:    --all-targets            Build all targets (default)
src/bin/test.rs:    --all-targets                Test all targets (default)

These were originally added in #4400, the problem is it currently doesn't work, "all targets" is in effect no matter what and the flag is totally redundant. This is because CompileFilter has a Default enum which matches all targets (see CompileFilter::matches) and this Default enum is used in most cases (see CompileFilter::new).

I suggest updating CompileFilter::matches to match only lib/bin targets for CompileFilter::Default and updating the documentation to match.

Note that doing nothing is not an option, the documentation is currently incorrect and at the very least needs to be fixed so every instance above says "X all targets (default)" i.e. all the flags are redundant.

@infinity0
Copy link
Contributor Author

The current architecture of CompileFilter makes it very hard to have different defaults of --all-targets for different commands. I suggest defaulting to lib+bin for all commands, this would make the flags not redundant, and is in line with this comment.

@infinity0
Copy link
Contributor Author

Closing, invalid.

infinity0 added a commit to infinity0/cargo that referenced this issue Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant