TypeVisitable in rustc_type_ir::visit - Rust
Description: This trait is implemented for every type that can be visited, providing the skeleton of the traversal.

Skip to main content

## TypeVisitable

# Trait TypeVisitable

Source

    pub trait TypeVisitable<I: Interner>: Debug {
        // 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 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".

## 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, 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 Arc<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>, S> TypeVisitable<I> for IndexSet<T, S>

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

Source§

### impl<I: Interner, T: TypeVisitable<I>, const N: usize> TypeVisitable<I> for SmallVec<[T; N]>

Source§

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

## Implementors§

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> TypeVisitable<I> for BoundVarIndexKind
where I: Interner,

Source§

### impl<I> TypeVisitable<I> for ClauseKind<I>
where I: Interner, TraitPredicate<I>: TypeVisitable<I>, OutlivesPredicate<I, I::Region>: TypeVisitable<I>, OutlivesPredicate<I, I::Ty>: TypeVisitable<I>, ProjectionPredicate<I>: TypeVisitable<I>, I::Const: TypeVisitable<I>, I::Ty: TypeVisitable<I>, I::Term: TypeVisitable<I>, HostEffectPredicate<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ExistentialPredicate<I>
where I: Interner, ExistentialTraitRef<I>: TypeVisitable<I>, ExistentialProjection<I>: TypeVisitable<I>, I::TraitId: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for PatternKind<I>
where I: Interner, I::Const: TypeVisitable<I>, I::PatList: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for PredicateKind<I>
where I: Interner, ClauseKind<I>: TypeVisitable<I>, I::TraitId: TypeVisitable<I>, SubtypePredicate<I>: TypeVisitable<I>, CoercePredicate<I>: TypeVisitable<I>, I::Const: TypeVisitable<I>, NormalizesTo<I>: TypeVisitable<I>, I::Term: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for rustc_type_ir::RegionConstraint<I>
where I: Interner, OutlivesPredicate<I, I::GenericArg>: TypeVisitable<I>, RegionEqPredicate<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ValTreeKind<I>
where I: Interner, I::ScalarInt: TypeVisitable<I>, I::Consts: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for TypeError<I>
where I: Interner, ExpectedFound<I::Const>: TypeVisitable<I>, I::Region: TypeVisitable<I>, BoundRegion<I>: TypeVisitable<I>, ExpectedFound<I::Ty>: TypeVisitable<I>, ExpectedFound<I::TraitId>: TypeVisitable<I>, I::Ty: TypeVisitable<I>, I::Const: TypeVisitable<I>, ExpectedFound<I::DefId>: TypeVisitable<I>, ExpectedFound<I::BoundExistentialPredicates>: TypeVisitable<I>, I::DefId: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for AliasBoundKind
where I: Interner,

Source§

### impl<I> TypeVisitable<I> for ExternalRegionConstraints<I>
where I: Interner, Vec<(RegionConstraint<I>, VisibleForLeakCheck)>: TypeVisitable<I>, RegionConstraint<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for RerunCondition<I>
where I: Interner, SmallCopyList<I::LocalDefId>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for RerunReason
where I: Interner,

Source§

### impl<I> TypeVisitable<I> for ProbeKind<I>
where I: Interner, QueryResult<I>: TypeVisitable<I>, CandidateSource<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for AccessedOpaques<I>
where I: Interner, RerunCondition<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ExternalConstraintsData<I>
where I: Interner, ExternalRegionConstraints<I>: TypeVisitable<I>, Vec<(OpaqueTypeKey<I>, I::Ty)>: TypeVisitable<I>, NestedNormalizationGoals<I>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for NestedNormalizationGoals<I>
where I: Interner, Vec<(GoalSource, Goal<I, I::Predicate>)>: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for Response<I>
where I: Interner, CanonicalVarValues<I>: TypeVisitable<I>, I::ExternalConstraints: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for AliasTerm<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for AliasTy<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for CanonicalVarValues<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ClosureArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

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

Source§

### impl<I> TypeVisitable<I> for CoroutineArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for CoroutineClosureArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

Source§

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

Source§

### impl<I> TypeVisitable<I> for CoroutineWitnessTypes<I>
where I: Interner, I::Tys: TypeVisitable<I>, I::RegionAssumptions: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ExistentialProjection<I>
where I: Interner, I::TraitAssocTermId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>, I::Term: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ExistentialTraitRef<I>
where I: Interner, I::TraitId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for FnHeader<I>
where I: Interner,

Source§

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

Source§

### impl<I> TypeVisitable<I> for FnSigKind<I>
where I: Interner,

Source§

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

Source§

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

Source§

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

Source§

### impl<I> TypeVisitable<I> for NormalizesTo<I>
where I: Interner, AliasTerm<I>: TypeVisitable<I>, I::Term: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for OpaqueTypeKey<I>
where I: Interner, I::LocalOpaqueTyId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for ProjectionPredicate<I>
where I: Interner, AliasTerm<I>: TypeVisitable<I>, I::Term: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for RegionEqPredicate<I>
where I: Interner, I::Region: TypeVisitable<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>
where I: Interner, I::TraitId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

Source§

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

Source§

### impl<I> TypeVisitable<I> for UnevaluatedConst<I>
where I: Interner, I::UnevaluatedConstId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

Source§

### impl<I> TypeVisitable<I> for UnsafeBinderInner<I>
where I: Interner, Binder<I, 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>
where I: Interner, Goal<I, P>: TypeVisitable<I>, I::PredefinedOpaques: TypeVisitable<I>,

Source§

### impl<I, T> TypeVisitable<I> for State<I, T>
where I: Interner, CanonicalVarValues<I>: TypeVisitable<I>, T: TypeVisitable<I>,

Source§

### impl<I, T> TypeVisitable<I> for Placeholder<I, T>
where I: Interner, T: TypeVisitable<I>,

Source§

### impl<I, T> TypeVisitable<I> for Unnormalized<I, T>
where I: Interner, T: TypeVisitable<I>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

### impl<I: Interner> TypeVisitable<I> for rustc_type_ir::region_constraint::RegionConstraint<I>

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 VisibleForLeakCheck

Source§

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

Source§

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

Source§

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

Source§

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

Source§

### impl<T: Copy + Debug + Hash + Eq, I> TypeVisitable<I> for SmallCopyList<T>
where I: Interner, [T; 1]: TypeVisitable<I>, [T; 2]: TypeVisitable<I>, [T; 3]: TypeVisitable<I>,