Open
Description
I ran into this in a crate that depends directly on anyhow
, and depends very indirectly on quick-error
. When trying to use the context
method, in a case that wouldn't work with anyhow
because the error type didn't implement Error, rustc said:
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
1 | use quick_error::ResultExt;
|
However, since the crate doesn't directly depend on quick-error
, it can't add such a use
.
Rough steps to reproduce:
- Have a top-level binary crate that depends on library crates
c1
andc2
- Have crate
c1
provide an extension trait with some requirements (such an extension trait onResult
that places requirements on the error type). - Have crate
c2
depend on cratec3
. - Have crate
c3
provide an extension trait that works on any type. - Have the top-level binary crate import the extension trait from
c1
, and attempt to use it, but not satisfy the required trait bounds.
This should result in rustc suggesting use c3::ExtensionTrait
for use in the top-level binary crate, even though the top-level binary crate doesn't depend on c3
.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Diagnostics: A structured suggestion resulting in incorrect code.Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.