Skip to content

cargo test shouldn't build crates that don't contain tests #15183

Open
@oriongonza

Description

@oriongonza

Problem

If in my workspace I have the following crate graph:
A - B - C
But only A and B have tests, C will also build even when it has no reachable tests.

Proposed Solution

Don't build C if it doesn't have tests (or all are #[ignore]d, though this is a stretch).

Realistically this will require some basic level of compiling to check whether there are tests but noting past the macro expasion step.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions