-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move collection of items accessible directly or through reexports from rustc_privacy
to rustc_resolve
#82064
Comments
cc @jyn514 More precise |
Is this meant to fix #64762? That would let me simplify parts of the |
…, r=petrochenkov Fixes wrong unreachable_pub lints on nested and glob public reexport Linked issues: rust-lang#64762 & rust-lang#82064
Partially closed by #87487 |
@lambinoo |
Directly accessible item
AccessLevel::Public
is an item with a fully public path from a crate root making it nameable from other crates.AccessLevel::Exported
item is an item with a fully public chain of reexports or modules making it nameable from other crates.All such items can be found either by visiting the crate repeatedly and marking new and new items as
Public
/Exported
until no items can be marked anymore, or doing the same thing by maintaining an item queue and pushing/popping things to/from it for processing until the queue is empty.Sets of directly accessible and reexported items are build in
rustc_privacy
(EmbargoVisitor
).The problem is that information about reexport chains is lost at that point, so the produced sets do not contain all the necessary items.
fn update_visibility_of_intermediate_use_statements
hack tries to mitigate that issue a bit, but it doesn't work correctly in presence of glob imports (see PR #57922 for more details).What we need to do is to move the logic for determining
AccessLevel::{Public,Exported}
s torustc_resolve
where all the information about reexport chains is still available.That logic should run either as a part of
fn finalize_imports
or after it.It should build a table
NodeId
->AccessLevel
inResolver
, and that table should later move tostruct ResolverOutputs
and then toGlobalCtxt
like all otherResolverOutputs
fields.Later in
rustc_privacy
the resolver-based table should be used as a seed forEmbargoVisitor
which will then assign type-based accessibility levels likeAccessLevel::Reachable
etc.fn update_visibility_of_intermediate_use_statements
will need to be removed.The text was updated successfully, but these errors were encountered: