Add ty::Visibility::is_public()
This commit is contained in:
parent
8b09ba6a5d
commit
9a987b0466
12 changed files with 23 additions and 24 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue