Trait rustc_middle::ty::fold::TypeVisitor[][src]

pub trait TypeVisitor<'tcx>: Sized {
    type BreakTy = !;
    fn tcx_for_anon_const_substs(&self) -> Option<TyCtxt<'tcx>>;

    fn visit_binder<T: TypeFoldable<'tcx>>(
        &mut self,
        t: &Binder<'tcx, T>
    ) -> ControlFlow<Self::BreakTy> { ... }
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> { ... }
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> { ... }
fn visit_const(
        &mut self,
        c: &'tcx Const<'tcx>
    ) -> ControlFlow<Self::BreakTy> { ... }
fn visit_unevaluated_const(
        &mut self,
        uv: Unevaluated<'tcx>
    ) -> ControlFlow<Self::BreakTy> { ... }
fn visit_predicate(
        &mut self,
        p: Predicate<'tcx>
    ) -> ControlFlow<Self::BreakTy> { ... } }

Associated Types

Required methods

Supplies the tcx for an unevaluated anonymous constant in case its default substs are not yet supplied.

Returning None for this method is only recommended if the TypeVisitor does not care about default anon const substs, as it ignores generic parameters, and fetching the default substs would cause a query cycle.

For visitors which return None we completely skip the default substs in ty::Unevaluated::super_visit_with. This means that incorrectly returning None can very quickly lead to ICE or other critical bugs, so be careful and try to return an actual tcx if possible.

Provided methods

Implementors