avoid suggesting traits from private dependencies by Qelxiros · Pull Request #143038 · rust-lang/rust (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to add it here. As a side note, visible_traits above uses TyCtxt::is_user_visible_dep, which allows imports from direct private dependencies. Using that instead of is_private_dep still removes the erroneous suggestions, is more in line with my mental model of what I'm trying to do here, and aligns with the documentation of is_user_visible_dep:
| /// dependency, or a [direct] private dependency. This is used to decide whether the crate can |
|---|
| /// be shown in `impl` suggestions. |
I also think that this will preserve the compiler's ability to make suggestions like these for library developers. Am I missing anything here?