Struct rustc_const_eval::interpret::validity::ValidityVisitor
source · struct ValidityVisitor<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> {
path: Vec<PathElem>,
ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Vec<PathElem>>>,
ctfe_mode: Option<CtfeValidationMode>,
ecx: &'rt InterpCx<'mir, 'tcx, M>,
}
Fields§
§path: Vec<PathElem>
The path
may be pushed to, but the part that is present when a function
starts must not be changed! visit_fields
and visit_array
rely on
this stack discipline.
ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::Provenance>, Vec<PathElem>>>
§ctfe_mode: Option<CtfeValidationMode>
None
indicates this is not validating for CTFE (but for runtime).
ecx: &'rt InterpCx<'mir, 'tcx, M>
Implementations§
source§impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M>
fn aggregate_field_path_elem( &mut self, layout: TyAndLayout<'tcx>, field: usize ) -> PathElem
fn with_elem<R>( &mut self, elem: PathElem, f: impl FnOnce(&mut Self) -> InterpResult<'tcx, R> ) -> InterpResult<'tcx, R>
fn read_immediate( &self, op: &OpTy<'tcx, M::Provenance>, expected: ExpectedKind ) -> InterpResult<'tcx, ImmTy<'tcx, M::Provenance>>
fn read_scalar( &self, op: &OpTy<'tcx, M::Provenance>, expected: ExpectedKind ) -> InterpResult<'tcx, Scalar<M::Provenance>>
fn check_wide_ptr_meta( &mut self, meta: MemPlaceMeta<M::Provenance>, pointee: TyAndLayout<'tcx> ) -> InterpResult<'tcx>
sourcefn check_safe_pointer(
&mut self,
value: &OpTy<'tcx, M::Provenance>,
ptr_kind: PointerKind
) -> InterpResult<'tcx>
fn check_safe_pointer( &mut self, value: &OpTy<'tcx, M::Provenance>, ptr_kind: PointerKind ) -> InterpResult<'tcx>
Check a reference or Box
.
sourcefn try_visit_primitive(
&mut self,
value: &OpTy<'tcx, M::Provenance>
) -> InterpResult<'tcx, bool>
fn try_visit_primitive( &mut self, value: &OpTy<'tcx, M::Provenance> ) -> InterpResult<'tcx, bool>
Check if this is a value of primitive type, and if yes check the validity of the value
at that type. Return true
if the type is indeed primitive.
Note that not all of these have FieldsShape::Primitive
, e.g. wide references.
fn visit_scalar( &mut self, scalar: Scalar<M::Provenance>, scalar_layout: ScalarAbi ) -> InterpResult<'tcx>
fn in_mutable_memory(&self, op: &OpTy<'tcx, M::Provenance>) -> bool
Trait Implementations§
source§impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> for ValidityVisitor<'rt, 'mir, 'tcx, M>
type V = OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>
source§fn read_discriminant(
&mut self,
op: &OpTy<'tcx, M::Provenance>
) -> InterpResult<'tcx, VariantIdx>
fn read_discriminant( &mut self, op: &OpTy<'tcx, M::Provenance> ) -> InterpResult<'tcx, VariantIdx>
read_discriminant
can be hooked for better error messages.source§fn visit_field(
&mut self,
old_op: &OpTy<'tcx, M::Provenance>,
field: usize,
new_op: &OpTy<'tcx, M::Provenance>
) -> InterpResult<'tcx>
fn visit_field( &mut self, old_op: &OpTy<'tcx, M::Provenance>, field: usize, new_op: &OpTy<'tcx, M::Provenance> ) -> 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_op: &OpTy<'tcx, M::Provenance>,
variant_id: VariantIdx,
new_op: &OpTy<'tcx, M::Provenance>
) -> InterpResult<'tcx>
fn visit_variant( &mut self, old_op: &OpTy<'tcx, M::Provenance>, variant_id: VariantIdx, new_op: &OpTy<'tcx, M::Provenance> ) -> 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 visit_union(
&mut self,
op: &OpTy<'tcx, M::Provenance>,
_fields: NonZero<usize>
) -> InterpResult<'tcx>
fn visit_union( &mut self, op: &OpTy<'tcx, M::Provenance>, _fields: NonZero<usize> ) -> InterpResult<'tcx>
Visits the given value as a union. No automatic recursion can happen here.
source§fn visit_box(
&mut self,
_box_ty: Ty<'tcx>,
op: &OpTy<'tcx, M::Provenance>
) -> InterpResult<'tcx>
fn visit_box( &mut self, _box_ty: Ty<'tcx>, op: &OpTy<'tcx, M::Provenance> ) -> 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 to T
, but this is a field of Box<T>
and the
pointee type is the actual T
. box_ty
provides the full type of the Box
itself.source§fn visit_value(&mut self, op: &OpTy<'tcx, M::Provenance>) -> InterpResult<'tcx>
fn visit_value(&mut self, op: &OpTy<'tcx, M::Provenance>) -> InterpResult<'tcx>
Visits the given value, dispatching as appropriate to more specialized visitors.
source§fn aggregate_field_order(
_memory_index: &IndexVec<FieldIdx, u32>,
idx: usize
) -> usize
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 morefn walk_value(&mut self, v: &Self::V) -> InterpResult<'tcx>
Auto Trait Implementations§
impl<'rt, 'mir, 'tcx, M> !DynSend for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> !DynSync for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> Freeze for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> !RefUnwindSafe for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> !Send for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> !Sync for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> Unpin for ValidityVisitor<'rt, 'mir, 'tcx, M>
impl<'rt, 'mir, 'tcx, M> !UnwindSafe for ValidityVisitor<'rt, 'mir, 'tcx, M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Filterable for T
impl<T> Filterable for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
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: 48 bytes