Skip to content

check --tests always succeeds if you have test = false in Cargo.toml #9536

Closed
@davidpdrsn

Description

@davidpdrsn

Problem
If a crate has

[lib]
test = false

in its Cargo.toml and you run cargo check --tests the crate always compiles regardless of what errors might actually be there.

I would expect --tests to still fail to compile or at least emit a clear warning.

Steps

  1. Made a little reproduction repo: git clone https://github.com/davidpdrsn/cargo-bug
  2. cd cargo-bug
  3. cargo check --tests compiles
  4. cargo check does not compile

Notes

Output of cargo version: cargo 1.52.0 (69767412a 2021-04-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugE-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions