Trait rustc_const_eval::interpret::ValueVisitor[][src]

pub trait ValueVisitor<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized {
    type V: Value<'mir, 'tcx, M>;
    fn ecx(&self) -> &InterpCx<'mir, 'tcx, M>;

    fn read_discriminant(
        &mut self,
        op: &OpTy<'tcx, M::PointerTag>
    ) -> InterpResult<'tcx, VariantIdx> { ... }
fn visit_value(&mut self, v: &Self::V) -> InterpResult<'tcx> { ... }
fn visit_union(
        &mut self,
        _v: &Self::V,
        _fields: NonZeroUsize
    ) -> InterpResult<'tcx> { ... }
fn visit_aggregate(
        &mut self,
        v: &Self::V,
        fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
    ) -> InterpResult<'tcx> { ... }
fn visit_field(
        &mut self,
        _old_val: &Self::V,
        _field: usize,
        new_val: &Self::V
    ) -> InterpResult<'tcx> { ... }
fn visit_variant(
        &mut self,
        _old_val: &Self::V,
        _variant: VariantIdx,
        new_val: &Self::V
    ) -> InterpResult<'tcx> { ... }
fn walk_aggregate(
        &mut self,
        v: &Self::V,
        fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
    ) -> InterpResult<'tcx> { ... }
fn walk_value(&mut self, v: &Self::V) -> InterpResult<'tcx> { ... } }

Associated Types

Required methods

The visitor must have an InterpCx in it.

Provided methods

read_discriminant can be hooked for better error messages.

Visits the given value, dispatching as appropriate to more specialized visitors.

Visits the given value as a union. No automatic recursion can happen here.

Visits this value as an aggregate, you are getting an iterator yielding all the fields (still in an InterpResult, you have to do error handling yourself). Recurses into the fields.

Called each time we recurse down to a field of a “product-like” aggregate (structs, tuples, arrays and the like, but not enums), passing in old (outer) and new (inner) value. This gives the visitor the chance to track the stack of nested fields that we are descending through.

Called when recursing into an enum variant. This gives the visitor the chance to track the stack of nested fields that we are descending through.

Implementors