Skip to content
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

Tracking issue for RFC #2145: Type privacy and private-in-public lints #48054

Open
aturon opened this Issue Feb 7, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@aturon
Copy link
Member

aturon commented Feb 7, 2018

This is a tracking issue for the RFC "Type privacy and private-in-public lints " (rust-lang/rfcs#2145).

Steps:

Unresolved questions:

  • It's not fully clear if the restriction for associated type definitions required for
    type privacy soundness, or it's just a workaround for a technical difficulty.

  • Interactions between macros 2.0 and the notions of reachability / effective
    visibility used for the lints are unclear.

bors added a commit that referenced this issue Dec 31, 2018

Auto merge of #56878 - petrochenkov:privdyn, r=arielb1
privacy: Use common `DefId` visiting infrastructure for all privacy visitors

One repeating pattern in privacy checking is going through a type, visiting all `DefId`s inside it and doing something with them.
This is the case because visibilities and reachabilities are attached to `DefId`s.

Previously various privacy visitors visited types slightly differently using their own methods, with most recently written `TypePrivacyVisitor` being the "gold standard".
This mostly worked okay, but differences could manifest in overly conservative reachability analysis, some errors being reported twice, some private-in-public lints (not errors) being wrongly reported or not reported.

This PR does something that I wanted to do since #32674 (comment) - factoring out the common visiting logic!
Now all the common logic is contained in `struct DefIdVisitorSkeleton`, with specific privacy visitors deciding only what to do with visited `DefId`s (via `trait DefIdVisitor`).

A bunch of cleanups is also applied in the process.
This area is somewhat tricky due to lots of easily miss-able details, but thankfully it's was well covered by tests in #46083 and previous PRs, so I'm relatively sure in the refactoring correctness.

Fixes #56837 (comment) in particular.
Also this will help with implementing #48054.

@petrochenkov petrochenkov self-assigned this Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.