Confusing error message when wildcard importing two same-named traits #54156
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-trait-system
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Discovered this when using
tokio-async-await
andfutures
. Both defineFutureExt
andStreamExt
traits in theirpreludes
. Both traits are meant to be used at the same time (from what I understand).After doing both this imports rust proceeds to act like neither of the traits got imported and give error help on any method usage something like "trait not in scope; use
tokio::async_await::stream::StreamExt
".Here is a Rust playground illustrating the bug: https://play.rust-lang.org/?gist=c8ebd2f79eca354ecb2dd6c828d73ad0&version=nightly&mode=debug&edition=2015
And here is a work-around for it (in nightly): https://play.rust-lang.org/?gist=f28928ef69a1985ee79d321cb58ae7e1&version=nightly&mode=debug&edition=2015
I think the way forward here is a good warning (or error) message when a duplicate trait item import happens between two wildcard imports.
The text was updated successfully, but these errors were encountered: