Description
mod m {
pub struct A {}
pub struct B {}
}
pub use m::A as U;
pub type V = m::B;
In the example above struct A
will be marked as reexported, but struct B
will only be marked as reachable.
(This can be tested with #[rustc_effective_visibility]
attribute.)
It may make sense to consider B
reexported too, because there's not much difference between a use
item and a trivial type alias.
This will remove some part of false positives from the unnameable_types
lint in particular, because B
is clearly nameable here.
The "promotion" to reexported should only happen when the alias is trivial - no generic parameters/where-clauses/bounds/etc, the RHS should also be a module-relative path without any generic arguments, including implicit ones.
There may be some unexpected consequences from doing this change.
For example, some import inlining code in rustdoc may assume that if B
is reexported, then a reexport chain leading to B
exists.
(Need to implement the change and see what breaks.)
This is a follow up to #48054.