]> git.proxmox.com Git - cargo.git/commit - src/bin/cargo/commands/search.rs
Auto merge of #10090 - weihanglo:issue-9014, r=alexcrichton
authorbors <bors@rust-lang.org>
Wed, 17 Nov 2021 14:31:16 +0000 (14:31 +0000)
committerbors <bors@rust-lang.org>
Wed, 17 Nov 2021 14:31:16 +0000 (14:31 +0000)
commitaed972396c7e346ceb86ef29cc92e6b953bb2718
tree8dbc7e30d88cc5cbf039be3fe6b8215f29ce9c59
parente475fe4a1780dafb771b39cddf8097ec206b0028
parent2698bc6a42b7212a2549a8b05b536c1a49e53ced
Auto merge of #10090 - weihanglo:issue-9014, r=alexcrichton

Enhance error message for target auto-discovery

resolves #9014
resolves #9117

Enhance for following scenarios:

1. Target without `path` specified and cannot be found.
2. Target without `path` specified and cannot be found, but a file
   exists at the commonly wrong path, e.g. `example/a.rs`, `bench/b.rs`.
3. Found multiple candidate files and cannot infer which to use.

For the suggestion in [the thread in #9116], I can't see any feasible way to list potential candidates without addditional I/O checking file existences. This PR is the best effort I can think of at this time. Feel free to comment. Thanks!

[the thread in #9116]: https://github.com/rust-lang/cargo/pull/9116#discussion_r575712762