Skip to content

Cargo bench can't find file where it does exist. #15703

@hkBst

Description

@hkBst

Valid Cargo.toml that includes:

[[bench]]
name = "benches.rs"
harness = false

cause cargo bench to say:

error: failed to parse manifest at `Cargo.toml`

Caused by:
  can't find `benches.rs` bench at `benches/benches.rs` or `benches/benches.rs/main.rs`. Please specify bench.path if you want to use a non-default path.

But:

$ ls benches/
benches.rs

Fix is to use name = "benches", which would have been obvious if the error has used ".rs.rs", so better would probably have been:

error: failed to parse manifest at `Cargo.toml`

Caused by:
  can't find `benches.rs` bench at `benches/benches.rs.rs` or `benches/benches.rs/main.rs`. Please specify bench.path if you want to use a non-default path.

Tested on: cargo 1.90.0-nightly (84709f0 2025-06-22)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions