Closed
Description
Suggested lint name: rustc::pub_reexport
.
When given something like the following, reject it (as a lint):
pub use syntax_pos::symbol;
cc #49509
Me and @Mark-Simulacrum were discussing library-ification and I mentioned to them how re-exports like this (specifically of syntax_pos::hygiene
in the case of a refactoring I'm working on) was detrimental because it encourages relying on wider dependencies than strictly necessary. We want to fix the situation in #65031 and having this lint could help with that.
@Mark-Simulacrum had the idea of introducing an internal lint to ban it. This will cause some large diffs for syntax_pos::symbol::
in particular but that should be gradually fixable on a crate-by-crate basis through #![allow(...)]
and it is mostly mechanical.