Add ty::Visibility::is_public()
This commit is contained in:
parent
8b09ba6a5d
commit
9a987b0466
12 changed files with 23 additions and 24 deletions
|
@ -543,7 +543,7 @@ impl EmbargoVisitor<'tcx> {
|
|||
module: LocalDefId,
|
||||
) {
|
||||
let level = Some(AccessLevel::Reachable);
|
||||
if let ty::Visibility::Public = vis {
|
||||
if vis.is_public() {
|
||||
self.update(def_id, level);
|
||||
}
|
||||
match def_kind {
|
||||
|
@ -580,7 +580,7 @@ impl EmbargoVisitor<'tcx> {
|
|||
|
||||
DefKind::Struct | DefKind::Union => {
|
||||
// While structs and unions have type privacy, their fields do not.
|
||||
if let ty::Visibility::Public = vis {
|
||||
if vis.is_public() {
|
||||
let item =
|
||||
self.tcx.hir().expect_item(self.tcx.hir().local_def_id_to_hir_id(def_id));
|
||||
if let hir::ItemKind::Struct(ref struct_def, _)
|
||||
|
@ -933,7 +933,7 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
|||
let def_id = self.tcx.hir().local_def_id(id);
|
||||
if let Some(exports) = self.tcx.module_exports(def_id) {
|
||||
for export in exports.iter() {
|
||||
if export.vis == ty::Visibility::Public {
|
||||
if export.vis.is_public() {
|
||||
if let Some(def_id) = export.res.opt_def_id() {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
self.update(def_id, Some(AccessLevel::Exported));
|
||||
|
@ -1918,8 +1918,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'tcx> {
|
|||
/// 1. It's contained within a public type
|
||||
/// 2. It comes from a private crate
|
||||
fn leaks_private_dep(&self, item_id: DefId) -> bool {
|
||||
let ret = self.required_visibility == ty::Visibility::Public
|
||||
&& self.tcx.is_private_dep(item_id.krate);
|
||||
let ret = self.required_visibility.is_public() && self.tcx.is_private_dep(item_id.krate);
|
||||
|
||||
tracing::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
|
||||
ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue