Skip to content

Commit

Permalink
Auto merge of #103496 - petrochenkov:effvisdoc2, r=lqd
Browse files Browse the repository at this point in the history
rustc_metadata: Encode even less doc comments

The fact that `def_id` is in the `tcx.privacy_access_levels(())` table is not very meaningful, especially after #102026, `is_exported` (or `is_reachable` in the worst case) is what you need.

Follow up to #98450.
r? `@GuillaumeGomez` `@lqd`
  • Loading branch information
bors committed Nov 1, 2022
2 parents e70cbef + d080532 commit 4c736a2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,7 @@ fn should_encode_attr(
} else if attr.doc_str().is_some() {
// We keep all public doc comments because they might be "imported" into downstream crates
// if they use `#[doc(inline)]` to copy an item's documentation into their own.
*is_def_id_public
.get_or_insert_with(|| tcx.effective_visibilities(()).effective_vis(def_id).is_some())
*is_def_id_public.get_or_insert_with(|| tcx.effective_visibilities(()).is_exported(def_id))
} else if attr.has_name(sym::doc) {
// If this is a `doc` attribute, and it's marked `inline` (as in `#[doc(inline)]`), we can
// remove it. It won't be inlinable in downstream crates.
Expand Down

0 comments on commit 4c736a2

Please sign in to comment.