1
Fork 0

Add ty::Visibility::is_public()

This commit is contained in:
inquisitivecrystal 2021-11-07 19:53:26 -08:00
parent 8b09ba6a5d
commit 9a987b0466
12 changed files with 23 additions and 24 deletions

View file

@ -333,6 +333,10 @@ impl Visibility {
Visibility::Invisible => false,
}
}
pub fn is_public(self) -> bool {
matches!(self, Visibility::Public)
}
}
/// The crate variances map is computed during typeck and contains the

View file

@ -2404,7 +2404,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N
// Iterate external crate defs but be mindful about visibility
while let Some(def) = queue.pop() {
for child in tcx.item_children(def).iter() {
if child.vis != ty::Visibility::Public {
if !child.vis.is_public() {
continue;
}