-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
The issue is that specifying a bench target like this in Cargo.toml:
[[bench]]
name = "mybench"And you place the file in bench/mybench.rs, that it returns a confusing error message. The expected location is benches/mybench.rs.
I think there are two parts to improve the message here:
- If
pathis not specified, the error message could include the implicit path in the message, maybe something like this:
Caused by:
can't find `mybench` bench at `benches/mybench.rs`, specify bench.path if you want to use a non-default path
2. If path is not specified, but there is a file found at a "commonly wrong location" like bench/<name>.rs, there could be a note attached suggesting renaming the directory as another option to fix it.
It would be nice if these better error messages worked for all of the target types (test → tests and example → examples and maybe src/bins → src/bin).
Originally posted by @ehuss in #9014 (comment)
Point 1. and the final suggestion of extending the behavior to all the target types was addressed in #9116.
This issue is specifically focused in 2.s suggestion of checking "commonly wrong location" to improve the error output.