Struct rustc_const_eval::interpret::validity::ValidityVisitor [−][src]
struct ValidityVisitor<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> {
path: Vec<PathElem>,
ref_tracking: Option<&'rt mut RefTracking<MPlaceTy<'tcx, M::PointerTag>, 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::PointerTag>, Vec<PathElem>>>
ctfe_mode: Option<CtfeValidationMode>
None
indicates this is not validating for CTFE (but for runtime).
ecx: &'rt InterpCx<'mir, 'tcx, M>
Implementations
fn with_elem<R>(
&mut self,
elem: PathElem,
f: impl FnOnce(&mut Self) -> InterpResult<'tcx, R>
) -> InterpResult<'tcx, R>
fn check_wide_ptr_meta(
&mut self,
meta: MemPlaceMeta<M::PointerTag>,
pointee: TyAndLayout<'tcx>
) -> InterpResult<'tcx>
fn check_safe_pointer(
&mut self,
value: &OpTy<'tcx, M::PointerTag>,
kind: &str
) -> InterpResult<'tcx>
fn check_safe_pointer(
&mut self,
value: &OpTy<'tcx, M::PointerTag>,
kind: &str
) -> InterpResult<'tcx>
Check a reference or Box
.
fn read_scalar(
&self,
op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx, ScalarMaybeUninit<M::PointerTag>>
fn try_visit_primitive(
&mut self,
value: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx, bool>
fn try_visit_primitive(
&mut self,
value: &OpTy<'tcx, M::PointerTag>
) -> 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.
fn visit_scalar(
&mut self,
op: &OpTy<'tcx, M::PointerTag>,
scalar_layout: ScalarAbi
) -> InterpResult<'tcx>
Trait Implementations
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::PointerTag>
fn read_discriminant(
&mut self,
op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx, VariantIdx>
fn read_discriminant(
&mut self,
op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx, VariantIdx>
read_discriminant
can be hooked for better error messages.
fn visit_field(
&mut self,
old_op: &OpTy<'tcx, M::PointerTag>,
field: usize,
new_op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx>
fn visit_field(
&mut self,
old_op: &OpTy<'tcx, M::PointerTag>,
field: usize,
new_op: &OpTy<'tcx, M::PointerTag>
) -> 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. Read more
fn visit_variant(
&mut self,
old_op: &OpTy<'tcx, M::PointerTag>,
variant_id: VariantIdx,
new_op: &OpTy<'tcx, M::PointerTag>
) -> InterpResult<'tcx>
fn visit_variant(
&mut self,
old_op: &OpTy<'tcx, M::PointerTag>,
variant_id: VariantIdx,
new_op: &OpTy<'tcx, M::PointerTag>
) -> 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. Read more
fn visit_union(
&mut self,
_op: &OpTy<'tcx, M::PointerTag>,
_fields: NonZeroUsize
) -> InterpResult<'tcx>
fn visit_union(
&mut self,
_op: &OpTy<'tcx, M::PointerTag>,
_fields: NonZeroUsize
) -> InterpResult<'tcx>
Visits the given value as a union. No automatic recursion can happen here.
Visits the given value, dispatching as appropriate to more specialized visitors.
fn visit_aggregate(
&mut self,
op: &OpTy<'tcx, M::PointerTag>,
fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
) -> InterpResult<'tcx>
fn visit_aggregate(
&mut self,
op: &OpTy<'tcx, M::PointerTag>,
fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
) -> InterpResult<'tcx>
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 walk_aggregate(
&mut self,
v: &Self::V,
fields: impl Iterator<Item = InterpResult<'tcx, Self::V>>
) -> InterpResult<'tcx>
Auto Trait Implementations
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> where
'mir: 'rt,
'tcx: 'rt,
impl<'rt, 'mir, 'tcx, M> !UnwindSafe for ValidityVisitor<'rt, 'mir, 'tcx, M>
Blanket Implementations
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