struct InternVisitor<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, MemoryKind>> {
    ecx: &'rt mut InterpCx<'mir, 'tcx, M>,
    ref_tracking: &'rt mut RefTracking<(MPlaceTy<'tcx>, InternMode)>,
    leftover_allocations: &'rt mut FxIndexSet<AllocId>,
    mode: InternMode,
    inside_unsafe_cell: bool,
}

Fields§

§ecx: &'rt mut InterpCx<'mir, 'tcx, M>

The ectx from which we intern.

§ref_tracking: &'rt mut RefTracking<(MPlaceTy<'tcx>, InternMode)>

Previously encountered safe references.

§leftover_allocations: &'rt mut FxIndexSet<AllocId>

A list of all encountered allocations. After type-based interning, we traverse this list to also intern allocations that are only referenced by a raw pointer or inside a union.

§mode: InternMode

The root kind of the value that we’re looking at. This field is never mutated for a particular allocation. It is primarily used to make as many allocations as possible read-only so LLVM can place them in const memory.

§inside_unsafe_cell: bool

This field stores whether we are currently inside an UnsafeCell. This can affect the intern mode of references we encounter.

Implementations§

source§

impl<'rt, 'mir, 'tcx, M: CompileTimeMachine<'mir, 'tcx, MemoryKind>> InternVisitor<'rt, 'mir, 'tcx, M>

source

fn intern_shallow( &mut self, alloc_id: AllocId, mode: InternMode, ty: Option<Ty<'tcx>> ) -> Option<IsStaticOrFn>

Trait Implementations§

source§

impl<'rt, 'mir, 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, MemoryKind>> ValueVisitor<'mir, 'tcx, M> for InternVisitor<'rt, 'mir, 'tcx, M>

§

type V = MPlaceTy<'tcx, AllocId>

source§

fn ecx(&self) -> &InterpCx<'mir, 'tcx, M>

The visitor must have an InterpCx in it.
source§

fn visit_value(&mut self, mplace: &MPlaceTy<'tcx>) -> InterpResult<'tcx>

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

fn read_discriminant(&mut self, v: &Self::V) -> InterpResult<'tcx, VariantIdx>

read_discriminant can be hooked for better error messages.
source§

fn aggregate_field_order( _memory_index: &IndexVec<FieldIdx, u32>, idx: usize ) -> usize

This function provides the chance to reorder the order in which fields are visited for FieldsShape::Aggregate: The order of fields will be (0..num_fields).map(aggregate_field_order). Read more
source§

fn visit_union( &mut self, _v: &Self::V, _fields: NonZeroUsize ) -> InterpResult<'tcx>

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

fn visit_box(&mut self, _v: &Self::V) -> InterpResult<'tcx>

Visits the given value as the pointer of a Box. There is nothing to recurse into. The type of v will be a raw pointer, but this is a field of Box<T> and the pointee type is the actual T.
source§

fn visit_field( &mut self, _old_val: &Self::V, _field: usize, new_val: &Self::V ) -> InterpResult<'tcx>

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.
source§

fn visit_variant( &mut self, _old_val: &Self::V, _variant: VariantIdx, new_val: &Self::V ) -> InterpResult<'tcx>

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.
source§

fn walk_value(&mut self, v: &Self::V) -> InterpResult<'tcx>

Auto Trait Implementations§

§

impl<'rt, 'mir, 'tcx, M> !RefUnwindSafe for InternVisitor<'rt, 'mir, 'tcx, M>

§

impl<'rt, 'mir, 'tcx, M> !Send for InternVisitor<'rt, 'mir, 'tcx, M>

§

impl<'rt, 'mir, 'tcx, M> !Sync for InternVisitor<'rt, 'mir, 'tcx, M>

§

impl<'rt, 'mir, 'tcx, M> Unpin for InternVisitor<'rt, 'mir, 'tcx, M>

§

impl<'rt, 'mir, 'tcx, M> !UnwindSafe for InternVisitor<'rt, 'mir, 'tcx, M>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 32 bytes