rustc_type_ir::visit

Trait TypeVisitable

Source
pub trait TypeVisitable<I: Interner>: Debug + Clone {
    // Required method
    fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result;
}
Expand description

This trait is implemented for every type that can be visited, providing the skeleton of the traversal.

To implement this conveniently, use the derive macro located in rustc_macros.

Required Methods§

Source

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v).

For most types, this just traverses the value, calling visit_with on each field/element.

For types of interest (such as Ty), the implementation of this method that calls a visitor method specifically for that type (such as V::visit_ty). This is where control transfers from TypeVisitable to TypeVisitor.

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.

Implementations on Foreign Types§

Source§

impl<I: Interner> TypeVisitable<I> for bool

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for u16

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for u32

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for u64

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for ()

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for usize

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for String

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for Movability

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner> TypeVisitable<I> for Mutability

Source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

Source§

impl<I: Interner, A: TypeVisitable<I>, B: TypeVisitable<I>, C: TypeVisitable<I>> TypeVisitable<I> for (A, B, C)

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T]

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Option<T>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<[T]>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<T>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Vec<T>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for ThinVec<T>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>, E: TypeVisitable<I>> TypeVisitable<I> for Result<T, E>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>, Ix: Idx> TypeVisitable<I> for IndexVec<Ix, T>

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Source§

impl<I: Interner, T: TypeVisitable<I>, U: TypeVisitable<I>> TypeVisitable<I> for (T, U)

Source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Implementors§

Source§

impl<I> TypeVisitable<I> for CanonicalTyVarKind
where I: Interner,

Source§

impl<I> TypeVisitable<I> for CanonicalVarKind<I>

Source§

impl<I> TypeVisitable<I> for TypeError<I>

Source§

impl<I> TypeVisitable<I> for ExistentialPredicate<I>

Source§

impl<I> TypeVisitable<I> for ClauseKind<I>

Source§

impl<I> TypeVisitable<I> for PredicateKind<I>

Source§

impl<I> TypeVisitable<I> for ProbeKind<I>

Source§

impl<I> TypeVisitable<I> for CanonicalVarInfo<I>

Source§

impl<I> TypeVisitable<I> for CanonicalVarValues<I>

Source§

impl<I> TypeVisitable<I> for UnevaluatedConst<I>

Source§

impl<I> TypeVisitable<I> for OpaqueTypeKey<I>

Source§

impl<I> TypeVisitable<I> for AliasTerm<I>

Source§

impl<I> TypeVisitable<I> for CoercePredicate<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for ExistentialProjection<I>

Source§

impl<I> TypeVisitable<I> for ExistentialTraitRef<I>

Source§

impl<I> TypeVisitable<I> for HostEffectPredicate<I>
where I: Interner, TraitRef<I>: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for NormalizesTo<I>

Source§

impl<I> TypeVisitable<I> for ProjectionPredicate<I>

Source§

impl<I> TypeVisitable<I> for SubtypePredicate<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for TraitPredicate<I>
where I: Interner, TraitRef<I>: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for TraitRef<I>

Source§

impl<I> TypeVisitable<I> for ExternalConstraintsData<I>

Source§

impl<I> TypeVisitable<I> for NestedNormalizationGoals<I>

Source§

impl<I> TypeVisitable<I> for PredefinedOpaquesData<I>
where I: Interner, Vec<(OpaqueTypeKey<I>, I::Ty)>: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for Response<I>

Source§

impl<I> TypeVisitable<I> for ClosureArgs<I>

Source§

impl<I> TypeVisitable<I> for CoroutineArgs<I>

Source§

impl<I> TypeVisitable<I> for CoroutineClosureArgs<I>

Source§

impl<I> TypeVisitable<I> for CoroutineClosureSignature<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for GenSig<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for AliasTy<I>

Source§

impl<I> TypeVisitable<I> for FnHeader<I>
where I: Interner, I::Safety: TypeVisitable<I>, I::Abi: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for FnSig<I>
where I: Interner, I::Tys: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for FnSigTys<I>
where I: Interner, I::Tys: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for TypeAndMut<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

impl<I, A> TypeVisitable<I> for OutlivesPredicate<I, A>
where I: Interner, A: TypeVisitable<I>, I::Region: TypeVisitable<I>,

Source§

impl<I, P> TypeVisitable<I> for Goal<I, P>
where I: Interner, I::ParamEnv: TypeVisitable<I>, P: TypeVisitable<I>,

Source§

impl<I, P> TypeVisitable<I> for QueryInput<I, P>

Source§

impl<I, T> TypeVisitable<I> for State<I, T>

Source§

impl<I, V> TypeVisitable<I> for Canonical<I, V>

Source§

impl<I: Interner> TypeVisitable<I> for Variance

Source§

impl<I: Interner> TypeVisitable<I> for BoundConstness

Source§

impl<I: Interner> TypeVisitable<I> for PredicatePolarity

Source§

impl<I: Interner> TypeVisitable<I> for AliasRelationDirection

Source§

impl<I: Interner> TypeVisitable<I> for BuiltinImplSource

Source§

impl<I: Interner> TypeVisitable<I> for Certainty

Source§

impl<I: Interner> TypeVisitable<I> for GoalSource

Source§

impl<I: Interner> TypeVisitable<I> for MaybeCause

Source§

impl<I: Interner> TypeVisitable<I> for AliasTyKind

Source§

impl<I: Interner> TypeVisitable<I> for FloatTy

Source§

impl<I: Interner> TypeVisitable<I> for InferTy

Source§

impl<I: Interner> TypeVisitable<I> for IntVarValue

Source§

impl<I: Interner> TypeVisitable<I> for RegionVid

Source§

impl<I: Interner> TypeVisitable<I> for NoSolution

Source§

impl<I: Interner> TypeVisitable<I> for DebruijnIndex

Source§

impl<I: Interner> TypeVisitable<I> for UniverseIndex

Source§

impl<I: Interner, T> !TypeVisitable<I> for EarlyBinder<I, T>

For early binders, you should first call instantiate before using any visitors.

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Binder<I, T>

Source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Lrc<T>

Source§

impl<T, I> TypeVisitable<I> for ExpectedFound<T>
where I: Interner, T: TypeVisitable<I>,