Struct rustc_mir::interpret::intern::InternVisitor[−][src]

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 FxHashSet<AllocId>,
    mode: InternMode,
    inside_unsafe_cell: bool,
}

Fields

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

The ectx from which we intern.

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

Previously encountered safe references.

leftover_allocations: &'rt mut FxHashSet<AllocId>
Expand description

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
Expand description

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
Expand description

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

Implementations

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

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

Trait Implementations

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

type V = MPlaceTy<'tcx>

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

The visitor must have an InterpCx in it.

fn visit_aggregate(
    &mut self,
    mplace: &MPlaceTy<'tcx>,
    fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
) -> InterpResult<'tcx>
[src]

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. Read more

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

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

fn read_discriminant(
    &mut self,
    op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx, VariantIdx>
[src]

read_discriminant can be hooked for better error messages.

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

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

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

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. Read more

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

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. Read more

fn walk_aggregate(
    &mut self,
    v: &Self::V,
    fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
) -> InterpResult<'tcx>
[src]

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

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> where
    'mir: 'rt,
    'tcx: 'rt, 

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]