Skip to content

cargo rustc broken for tests in project with bins #5502

@ehuss

Description

@ehuss

If you have a project with a binary and an integration test, then cargo rustc --test test1 -- -C opt-level=3 will fail with the following error:

error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing e.g. `--lib` or `--bin NAME` to specify a single target

The reason is that I changed it to add the implicit bin targets earlier (into generate_targets when it was previously in compute_deps) in order to avoid some code duplication.

I think it should be fine just to move it back to compute_deps, the code duplication was very minor.

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