about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-31 23:30:57 +0000
committerbors <bors@rust-lang.org>2018-12-31 23:30:57 +0000
commitfe6a54d2207c9ab2c5eb5aa3c9488d92c7c86bfb (patch)
tree6679295c9f2d8390701a58a66e0124bd647dc9dc /src/rustllvm/RustWrapper.cpp
parent9eac386342c601b14311b435f2b6d314fc817bb5 (diff)
parent60d1fa70bbb017632f43c206e5f16b0b5bbd0149 (diff)
downloadrust-fe6a54d2207c9ab2c5eb5aa3c9488d92c7c86bfb.tar.gz
rust-fe6a54d2207c9ab2c5eb5aa3c9488d92c7c86bfb.zip
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 https://github.com/rust-lang/rust/pull/32674#discussion_r58291608 - 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 https://github.com/rust-lang/rust/pull/46083 and previous PRs, so I'm relatively sure in the refactoring correctness.

Fixes https://github.com/rust-lang/rust/pull/56837#discussion_r241962239 in particular.
Also this will help with implementing https://github.com/rust-lang/rust/issues/48054.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions