effective visibilities: Count types leaked through trivial type aliases as reexported #120146
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-visibility
Area: Visibility / privacy
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
L-unnameable_types
Lint: unnameable_types
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In the example above
struct A
will be marked as reexported, butstruct 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 ause
item and a trivial type alias.This will remove some part of false positives from the
unnameable_types
lint in particular, becauseB
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 toB
exists.(Need to implement the change and see what breaks.)
This is a follow up to #48054.
The text was updated successfully, but these errors were encountered: