Skip to content

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

Closed
@infinity0

Description

@infinity0
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions