rustc_middle::ty::visit

Trait TypeVisitor

pub trait TypeVisitor<I>: Sized
where I: Interner,
{ type Result: VisitorResult = (); // Provided methods fn visit_binder<T>(&mut self, t: &Binder<I, T>) -> Self::Result where T: TypeVisitable<I> { ... } fn visit_ty(&mut self, t: <I as Interner>::Ty) -> Self::Result { ... } fn visit_region(&mut self, r: <I as Interner>::Region) -> Self::Result { ... } fn visit_const(&mut self, c: <I as Interner>::Const) -> Self::Result { ... } fn visit_predicate(&mut self, p: <I as Interner>::Predicate) -> Self::Result { ... } fn visit_clauses(&mut self, p: <I as Interner>::Clauses) -> Self::Result { ... } fn visit_error( &mut self, _guar: <I as Interner>::ErrorGuaranteed, ) -> Self::Result { ... } }
Expand description

This trait is implemented for every visiting traversal. There is a visit method defined for every type of interest. Each such method has a default that recurses into the type’s fields in a non-custom fashion.

Provided Associated Types§

type Result: VisitorResult = ()

Provided Methods§

fn visit_binder<T>(&mut self, t: &Binder<I, T>) -> Self::Result
where T: TypeVisitable<I>,

fn visit_ty(&mut self, t: <I as Interner>::Ty) -> Self::Result

fn visit_region(&mut self, r: <I as Interner>::Region) -> Self::Result

fn visit_const(&mut self, c: <I as Interner>::Const) -> Self::Result

fn visit_predicate(&mut self, p: <I as Interner>::Predicate) -> Self::Result

fn visit_clauses(&mut self, p: <I as Interner>::Clauses) -> Self::Result

fn visit_error( &mut self, _guar: <I as Interner>::ErrorGuaranteed, ) -> Self::Result

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsSuggestableVisitor<'tcx>

Source§

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for LateBoundRegionsCollector

Source§

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for MaxUniverse

§

impl<I> TypeVisitor<I> for ValidateBoundVars<I>
where I: Interner,

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GATArgsCollector<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for HasErrorDeep<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IsProbablyCyclical<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for UncoveredTyParamCollector<'_, 'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ParameterCollector

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GenericParamAndBoundVarCollector<'_, 'tcx>

impl<'tcx, OP> TypeVisitor<TyCtxt<'tcx>> for ConstrainOpaqueTypeRegionVisitor<'tcx, OP>
where OP: FnMut(Region<'tcx>),

impl<'tcx, OP> TypeVisitor<TyCtxt<'tcx>> for FreeRegionsVisitor<'tcx, OP>
where OP: FnMut(Region<'tcx>),

impl<'tcx, VarFn, OutlivesFn> TypeVisitor<TyCtxt<'tcx>> for VisitOpaqueTypes<'tcx, VarFn, OutlivesFn>
where VarFn: FnOnce() -> FxHashMap<DefId, Variance>, OutlivesFn: FnOnce() -> OutlivesEnvironment<'tcx>,

impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for MarkUsedGenericParams<'a, 'tcx>

impl<'a, Infcx, I, F, E> TypeVisitor<I> for OrphanChecker<'a, Infcx, I, F>
where Infcx: InferCtxtLike<Interner = I>, I: Interner, F: FnMut(I::Ty) -> Result<I::Ty, E>,

impl<'tcx, V> TypeVisitor<TyCtxt<'tcx>> for DefIdVisitorSkeleton<'_, 'tcx, V>
where V: DefIdVisitor<'tcx> + ?Sized,

impl<'a, 'tcx> TypeVisitor<TyCtxt<'tcx>> for WfPredicates<'a, 'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for TraitObjectVisitor

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IllegalSelfTypeVisitor<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx>

impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx>