[−][src]Trait rustc_privacy::DefIdVisitor
Generic infrastructure used to implement specific visitors below.
Implemented to visit all DefIds in a type.
Visiting DefIds is useful because visibilities and reachabilities are attached to them.
The idea is to visit "all components of a type", as documented in
https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md#how-to-determine-visibility-of-a-type.
The default type visitor (TypeVisitor) does most of the job, but it has some shortcomings.
First, it doesn't have overridable fn visit_trait_ref, so we have to catch trait DefIds
manually. Second, it doesn't visit some type components like signatures of fn types, or traits
in impl Trait, see individual comments in DefIdVisitorSkeleton::visit_ty.
Associated Types
Loading content...Required methods
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn visit_def_id(
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>
Provided methods
pub(crate) fn shallow(&self) -> bool[src]
pub(crate) fn skip_assoc_tys(&self) -> bool[src]
pub(crate) fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'tcx, Self>[src]
Not overridden, but used to actually visit types and traits.
pub(crate) fn visit(
&mut self,
ty_fragment: impl TypeFoldable<'tcx>
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
ty_fragment: impl TypeFoldable<'tcx>
) -> ControlFlow<Self::BreakTy>
pub(crate) fn visit_trait(
&mut self,
trait_ref: TraitRef<'tcx>
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
trait_ref: TraitRef<'tcx>
) -> ControlFlow<Self::BreakTy>
pub(crate) fn visit_predicates(
&mut self,
predicates: GenericPredicates<'tcx>
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
predicates: GenericPredicates<'tcx>
) -> ControlFlow<Self::BreakTy>
Implementors
impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL>[src]
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn shallow(&self) -> bool[src]
pub(crate) fn skip_assoc_tys(&self) -> bool[src]
pub(crate) fn visit_def_id(
&mut self,
def_id: DefId,
_kind: &str,
_descr: &dyn Display
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
def_id: DefId,
_kind: &str,
_descr: &dyn Display
) -> ControlFlow<Self::BreakTy>
impl<'tcx> DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx>[src]
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn visit_def_id(
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>
impl<'tcx> DefIdVisitor<'tcx> for TypePrivacyVisitor<'tcx>[src]
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn visit_def_id(
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
def_id: DefId,
kind: &str,
descr: &dyn Display
) -> ControlFlow<Self::BreakTy>
impl<'tcx, '_> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>[src]
pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]
pub(crate) fn visit_def_id(
&mut self,
def_id: DefId,
_kind: &str,
_descr: &dyn Display
) -> ControlFlow<Self::BreakTy>[src]
&mut self,
def_id: DefId,
_kind: &str,
_descr: &dyn Display
) -> ControlFlow<Self::BreakTy>