Any workaround to having examples in a workspace with the same name?

⚓ Rust    📅 2025-09-05    👤 surdeus    👁️ 2      

surdeus

I have a workspace crate that collects together a few crates that have examples named example.rs. Crates also typically have examples (and binaries) with common names like client, server, or app, etc. However if there exist multiple workspace members with examples that have the same name, the following command:

$ cargo test --workspace

Will generate:

warning: output filename collision.
...
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.

I looked through the related issues but I didn't really see a workaround besides ensuring that every member of a workspace has unique names for every example.

3 posts - 3 participants

Read full topic

🏷️ Rust_feed