Struct miri::InterpCx

source ·
pub struct InterpCx<'mir, 'tcx, M>
where M: Machine<'mir, 'tcx>,
{ pub machine: M, pub tcx: TyCtxtAt<'tcx>, pub(crate) param_env: ParamEnv<'tcx>, pub memory: Memory<'mir, 'tcx, M>, pub recursion_limit: Limit, }

Fields§

§machine: M

Stores the Machine instance.

Note: the stack is provided by the machine.

§tcx: TyCtxtAt<'tcx>

The results of the type checker, from rustc. The span in this is the “root” of the evaluation, i.e., the const we are evaluating (if this is CTFE).

§param_env: ParamEnv<'tcx>§memory: Memory<'mir, 'tcx, M>

The virtual memory system.

§recursion_limit: Limit

The recursion limit (cached from tcx.recursion_limit(()))

Implementations§

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn cast( &mut self, src: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_kind: CastKind, cast_ty: Ty<'tcx>, dest: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn int_to_int_or_float( &self, src: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_to: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Handles ‘IntToInt’ and ‘IntToFloat’ casts.

source

pub fn float_to_float_or_int( &self, src: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_to: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Handles ‘FloatToFloat’ and ‘FloatToInt’ casts.

source

pub fn ptr_to_ptr( &self, src: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_to: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Handles ‘FnPtrToPtr’ and ‘PtrToPtr’ casts.

source

pub fn pointer_expose_provenance_cast( &mut self, src: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_to: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn pointer_with_exposed_provenance_cast( &self, src: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_to: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn unsize_into( &mut self, src: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, cast_ty: TyAndLayout<'tcx, Ty<'tcx>>, dest: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn write_discriminant( &mut self, variant_index: VariantIdx, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Writes the discriminant of the given variant.

If the variant is uninhabited, this is UB.

source

pub fn read_discriminant( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<VariantIdx, InterpErrorInfo<'tcx>>

Read discriminant, return the runtime value as well as the variant index. Can also legally be called on non-enums (e.g. through the discriminant_value intrinsic)!

Will never return an uninhabited variant.

source

pub fn discriminant_for_variant( &self, ty: Ty<'tcx>, variant: VariantIdx ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn new( tcx: TyCtxt<'tcx>, root_span: Span, param_env: ParamEnv<'tcx>, machine: M ) -> InterpCx<'mir, 'tcx, M>

source

pub fn cur_span(&self) -> Span

source

pub fn best_lint_scope(&self) -> HirId

Find the first stack frame that is within the current crate, if any, otherwise return the crate’s HirId

source

pub fn frame_idx(&self) -> usize

source

pub fn frame( &self ) -> &Frame<'mir, 'tcx, <M as Machine<'mir, 'tcx>>::Provenance, <M as Machine<'mir, 'tcx>>::FrameExtra>

source

pub fn frame_mut( &mut self ) -> &mut Frame<'mir, 'tcx, <M as Machine<'mir, 'tcx>>::Provenance, <M as Machine<'mir, 'tcx>>::FrameExtra>

source

pub fn body(&self) -> &'mir Body<'tcx>

source

pub fn sign_extend(&self, value: u128, ty: TyAndLayout<'_, Ty<'_>>) -> u128

source

pub fn truncate(&self, value: u128, ty: TyAndLayout<'_, Ty<'_>>) -> u128

source

pub fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool

source

pub fn load_mir( &self, instance: InstanceDef<'tcx>, promoted: Option<Promoted> ) -> Result<&'tcx Body<'tcx>, InterpErrorInfo<'tcx>>

source

pub fn size_and_align_of_mplace( &self, mplace: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<Option<(Size, Align)>, InterpErrorInfo<'tcx>>

source

pub fn push_stack_frame( &mut self, instance: Instance<'tcx>, body: &'mir Body<'tcx>, return_place: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, return_to_block: StackPopCleanup ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn go_to_block(&mut self, target: BasicBlock)

Jump to the given block.

source

pub fn return_to_block( &mut self, target: Option<BasicBlock> ) -> Result<(), InterpErrorInfo<'tcx>>

Return to the given target basic block. Do not use for unwinding! Use unwind_to_block instead.

If target is None, that indicates the function cannot return, so we raise UB.

source

pub fn unwind_to_block( &mut self, target: UnwindAction ) -> Result<(), InterpErrorInfo<'tcx>>

Unwind to the given target basic block. Do not use for returning! Use return_to_block instead.

If target is UnwindAction::Continue, that indicates the function does not need cleanup during unwinding, and we will just keep propagating that upwards.

If target is UnwindAction::Unreachable, that indicates the function does not allow unwinding, and doing so is UB.

source

pub fn storage_live_for_always_live_locals( &mut self ) -> Result<(), InterpErrorInfo<'tcx>>

In the current stack frame, mark all locals as live that are not arguments and don’t have Storage* annotations (this includes the return place).

source

pub fn storage_live_dyn( &mut self, local: Local, meta: MemPlaceMeta<<M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn storage_live( &mut self, local: Local ) -> Result<(), InterpErrorInfo<'tcx>>

Mark a storage as live, killing the previous content.

source

pub fn storage_dead( &mut self, local: Local ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn ctfe_query<T>( &self, query: impl FnOnce(TyCtxtAt<'tcx>) -> Result<T, ErrorHandled> ) -> Result<T, ErrorHandled>

Call a query that can return ErrorHandled. Should be used for statics and other globals. (mir::Const/ty::Const have eval methods that can be used directly instead.)

source

pub fn eval_global( &self, instance: Instance<'tcx> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn eval_mir_constant( &self, val: &Const<'tcx>, span: Span, layout: Option<TyAndLayout<'tcx, Ty<'tcx>>> ) -> Result<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn dump_place( &self, place: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> PlacePrinter<'_, 'mir, 'tcx, M>

source

pub fn generate_stacktrace(&self) -> Vec<FrameInfo<'tcx>>

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: CompileTimeMachine<'mir, 'tcx, !>,

source

pub fn intern_with_temp_alloc( &mut self, layout: TyAndLayout<'tcx, Ty<'tcx>>, f: impl FnOnce(&mut InterpCx<'mir, 'tcx, M>, &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>) -> Result<(), InterpErrorInfo<'tcx>> ) -> Result<AllocId, InterpErrorInfo<'tcx>>

A helper function that allocates memory for the layout given and gives you access to mutate it. Once your own mutation code is done, the backing Allocation is removed from the current Memory and interned as read-only into the global memory.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn emulate_intrinsic( &mut self, instance: Instance<'tcx>, args: &[OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>], dest: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, ret: Option<BasicBlock> ) -> Result<bool, InterpErrorInfo<'tcx>>

Returns true if emulation happened. Here we implement the intrinsics that are common to all Miri instances; individual machines can add their own intrinsic handling.

source

pub fn numeric_intrinsic( &self, name: Symbol, val: Scalar<<M as Machine<'mir, 'tcx>>::Provenance>, layout: TyAndLayout<'tcx, Ty<'tcx>> ) -> Result<Scalar<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn exact_div( &mut self, a: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, b: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, dest: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn saturating_arith( &self, mir_op: BinOp, l: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, r: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<Scalar<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn ptr_offset_inbounds( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, offset_bytes: i64 ) -> Result<Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, InterpErrorInfo<'tcx>>

Offsets a pointer by some multiple of its type, returning an error if the pointer leaves its allocation. For integer pointers, we consider each of them their own tiny allocation of size 0, so offset-by-0 (and only 0) is okay – except that null cannot be offset by any value.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn global_root_pointer( &self, ptr: Pointer ) -> Result<Pointer<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Call this to turn untagged “global” pointers (obtained via tcx) into the machine pointer to the allocation. Must never be used for any other pointers, nor for TLS statics.

Using the resulting pointer represents a direct access to that memory (e.g. by directly using a static), as opposed to access through a pointer that was created by the program.

This function can fail only if ptr points to an extern static.

source

pub fn fn_ptr( &mut self, fn_val: FnVal<'tcx, <M as Machine<'mir, 'tcx>>::ExtraFnVal> ) -> Pointer<<M as Machine<'mir, 'tcx>>::Provenance>

source

pub fn allocate_ptr( &mut self, size: Size, align: Align, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind> ) -> Result<Pointer<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn allocate_bytes_ptr( &mut self, bytes: &[u8], align: Align, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind>, mutability: Mutability ) -> Result<Pointer<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn allocate_raw_ptr( &mut self, alloc: Allocation, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind> ) -> Result<Pointer<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn reallocate_ptr( &mut self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, old_size_and_align: Option<(Size, Align)>, new_size: Size, new_align: Align, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind> ) -> Result<Pointer<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn deallocate_ptr( &mut self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, old_size_and_align: Option<(Size, Align)>, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind> ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn check_ptr_access( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size, msg: CheckInAllocMsg ) -> Result<(), InterpErrorInfo<'tcx>>

Check if the given pointer points to live memory of the given size. The caller can control the error message for the out-of-bounds case.

source

pub fn check_ptr_align( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, align: Align ) -> Result<(), InterpErrorInfo<'tcx>>

Checks a pointer for misalignment.

The error assumes this is checking the pointer used directly for an access.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn remove_unreachable_allocs( &mut self, reachable_allocs: &HashSet<AllocId, BuildHasherDefault<FxHasher>> )

This function is used by Miri’s provenance GC to remove unreachable entries from the dead_alloc_map.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

Allocation accessors

source

pub fn get_ptr_alloc<'a>( &'a self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size ) -> Result<Option<AllocRef<'a, 'tcx, <M as Machine<'mir, 'tcx>>::Provenance, <M as Machine<'mir, 'tcx>>::AllocExtra, <M as Machine<'mir, 'tcx>>::Bytes>>, InterpErrorInfo<'tcx>>

Bounds-checked but not align-checked allocation access.

source

pub fn get_alloc_extra<'a>( &'a self, id: AllocId ) -> Result<&'a <M as Machine<'mir, 'tcx>>::AllocExtra, InterpErrorInfo<'tcx>>

Return the extra field of the given allocation.

source

pub fn get_alloc_mutability<'a>( &'a self, id: AllocId ) -> Result<Mutability, InterpErrorInfo<'tcx>>

Return the mutability field of the given allocation.

source

pub fn get_ptr_alloc_mut<'a>( &'a mut self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size ) -> Result<Option<AllocRefMut<'a, 'tcx, <M as Machine<'mir, 'tcx>>::Provenance, <M as Machine<'mir, 'tcx>>::AllocExtra, <M as Machine<'mir, 'tcx>>::Bytes>>, InterpErrorInfo<'tcx>>

Bounds-checked but not align-checked allocation access.

source

pub fn get_alloc_extra_mut<'a>( &'a mut self, id: AllocId ) -> Result<(&'a mut <M as Machine<'mir, 'tcx>>::AllocExtra, &'a mut M), InterpErrorInfo<'tcx>>

Return the extra field of the given allocation.

source

pub fn is_alloc_live(&self, id: AllocId) -> bool

Check whether an allocation is live. This is faster than calling InterpCx::get_alloc_info if all you need to check is whether the kind is AllocKind::Dead because it doesn’t have to look up the type and layout of statics.

source

pub fn get_alloc_info(&self, id: AllocId) -> (Size, Align, AllocKind)

Obtain the size and alignment of an allocation, even if that allocation has been deallocated.

source

pub fn get_ptr_fn( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<FnVal<'tcx, <M as Machine<'mir, 'tcx>>::ExtraFnVal>, InterpErrorInfo<'tcx>>

source

pub fn get_ptr_vtable( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<(Ty<'tcx>, Option<Binder<'tcx, ExistentialTraitRef<'tcx>>>), InterpErrorInfo<'tcx>>

source

pub fn alloc_mark_immutable( &mut self, id: AllocId ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn dump_alloc<'a>(&'a self, id: AllocId) -> DumpAllocs<'a, 'mir, 'tcx, M>

Create a lazy debug printer that prints the given allocation and all allocations it points to, recursively.

source

pub fn dump_allocs<'a>( &'a self, allocs: Vec<AllocId> ) -> DumpAllocs<'a, 'mir, 'tcx, M>

Create a lazy debug printer for a list of allocations and all allocations they point to, recursively.

source

pub fn print_alloc_bytes_for_diagnostics(&self, id: AllocId) -> String

Print the allocation’s bytes, without any nested allocations.

source

pub fn find_leaked_allocations( &self, static_roots: &[AllocId] ) -> Vec<(AllocId, MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind>, Allocation<<M as Machine<'mir, 'tcx>>::Provenance, <M as Machine<'mir, 'tcx>>::AllocExtra, <M as Machine<'mir, 'tcx>>::Bytes>)>

Find leaked allocations. Allocations reachable from static_roots or a Global allocation are not considered leaked, as well as leaks whose kind’s may_leak() returns true.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn read_bytes_ptr_strip_provenance( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size ) -> Result<&[u8], InterpErrorInfo<'tcx>>

Reads the given number of bytes from memory, and strips their provenance if possible. Returns them as a slice.

Performs appropriate bounds checks.

source

pub fn write_bytes_ptr( &mut self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, src: impl IntoIterator<Item = u8> ) -> Result<(), InterpErrorInfo<'tcx>>

Writes the given stream of bytes into memory.

Performs appropriate bounds checks.

source

pub fn mem_copy( &mut self, src: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, dest: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size, nonoverlapping: bool ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn mem_copy_repeatedly( &mut self, src: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, dest: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, size: Size, num_copies: u64, nonoverlapping: bool ) -> Result<(), InterpErrorInfo<'tcx>>

Performs num_copies many copies of size many bytes from src to dest + i*size (where i is the index of the copy).

Either nonoverlapping must be true or num_copies must be 1; doing repeated copies that may overlap is not supported.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

Machine pointer introspection.

source

pub fn scalar_may_be_null( &self, scalar: Scalar<<M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<bool, InterpErrorInfo<'tcx>>

Test if this value might be null. If the machine does not support ptr-to-int casts, this is conservative.

source

pub fn ptr_try_get_alloc_id( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<(AllocId, Size, <M as Machine<'mir, 'tcx>>::ProvenanceExtra), u64>

Turning a “maybe pointer” into a proper pointer (and some information about where it points), or an absolute address.

The result must be used immediately; it is not allowed to convert the returned data back into a Pointer and store that in machine state. (In fact that’s not even possible since M::ProvenanceExtra is generic and we don’t have an operation to turn it back into M::Provenance.)

source

pub fn ptr_get_alloc_id( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<(AllocId, Size, <M as Machine<'mir, 'tcx>>::ProvenanceExtra), InterpErrorInfo<'tcx>>

Turning a “maybe pointer” into a proper pointer (and some information about where it points).

The result must be used immediately; it is not allowed to convert the returned data back into a Pointer and store that in machine state. (In fact that’s not even possible since M::ProvenanceExtra is generic and we don’t have an operation to turn it back into M::Provenance.)

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn read_immediate_raw( &self, src: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<Either<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>>, InterpErrorInfo<'tcx>>

Try returning an immediate for the operand. If the layout does not permit loading this as an immediate, return where in memory we can find the data. Note that for a given layout, this operation will either always return Left or Right! succeed! Whether it returns Left depends on whether the layout can be represented in an Immediate, not on which data is stored there currently.

This is an internal function that should not usually be used; call read_immediate instead. ConstProp needs it, though.

source

pub fn read_immediate( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Read an immediate from a place, asserting that that is possible with the given layout.

If this succeeds, the ImmTy is never Uninit.

source

pub fn read_scalar( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<Scalar<<M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Read a scalar from a place

source

pub fn read_pointer( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, InterpErrorInfo<'tcx>>

Read a pointer from a place.

source

pub fn read_target_usize( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<u64, InterpErrorInfo<'tcx>>

Read a pointer-sized unsigned integer from a place.

source

pub fn read_target_isize( &self, op: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<i64, InterpErrorInfo<'tcx>>

Read a pointer-sized signed integer from a place.

source

pub fn read_str( &self, mplace: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<&str, InterpErrorInfo<'tcx>>

Turn the wide MPlace into a string (must already be dereferenced!)

source

pub fn operand_to_simd( &self, op: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, u64), InterpErrorInfo<'tcx>>

Converts a repr(simd) operand into an operand where place_index accesses the SIMD elements. Also returns the number of elements.

Can (but does not always) trigger UB if op is uninitialized.

source

pub fn local_to_op( &self, local: Local, layout: Option<TyAndLayout<'tcx, Ty<'tcx>>> ) -> Result<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Read from a local of the current frame. Will not access memory, instead an indirect Operand is returned.

This is public because it is used by priroda to get an OpTy from a local.

source

pub fn place_to_op( &self, place: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Every place can be read from, so we can turn them into an operand. This will definitely return Indirect if the place is a Ptr, i.e., this will never actually read from memory.

source

pub fn eval_place_to_op( &self, mir_place: Place<'tcx>, layout: Option<TyAndLayout<'tcx, Ty<'tcx>>> ) -> Result<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Evaluate a place with the goal of reading from it. This lets us sometimes avoid allocations.

source

pub fn eval_operand( &self, mir_op: &Operand<'tcx>, layout: Option<TyAndLayout<'tcx, Ty<'tcx>>> ) -> Result<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Evaluate the operand, returning a place where you can then find the data. If you already know the layout, you can save two table lookups by passing it in here.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn binop_with_overflow( &mut self, op: BinOp, left: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, right: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, dest: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Applies the binary operation op to the two operands and writes a tuple of the result and a boolean signifying the potential overflow to the destination.

source

pub fn binop_ignore_overflow( &mut self, op: BinOp, left: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, right: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, dest: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Applies the binary operation op to the arguments and writes the result to the destination.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn overflowing_binary_op( &self, bin_op: BinOp, left: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, right: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, bool), InterpErrorInfo<'tcx>>

Returns the result of the specified operation, and whether it overflowed.

source

pub fn wrapping_binary_op( &self, bin_op: BinOp, left: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, right: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn overflowing_unary_op( &self, un_op: UnOp, val: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, bool), InterpErrorInfo<'tcx>>

Returns the result of the specified operation, whether it overflowed, and the result type.

source

pub fn wrapping_unary_op( &self, un_op: UnOp, val: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, Prov, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, Prov: Provenance, M: Machine<'mir, 'tcx, Provenance = Prov>,

source

pub fn ptr_with_meta_to_mplace( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, meta: MemPlaceMeta<<M as Machine<'mir, 'tcx>>::Provenance>, layout: TyAndLayout<'tcx, Ty<'tcx>> ) -> MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>

source

pub fn ptr_to_mplace( &self, ptr: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, layout: TyAndLayout<'tcx, Ty<'tcx>> ) -> MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>

source

pub fn ref_to_mplace( &self, val: &ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Take a value, which represents a (thin or wide) reference, and make it a place. Alignment is just based on the type. This is the inverse of mplace_to_ref().

Only call this if you are sure the place is “valid” (aligned and inbounds), or do not want to ever use the place for memory access! Generally prefer deref_pointer.

source

pub fn mplace_to_ref( &self, mplace: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<ImmTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Turn a mplace into a (thin or wide) mutable raw pointer, pointing to the same space. align information is lost! This is the inverse of ref_to_mplace.

source

pub fn deref_pointer( &self, src: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Take an operand, representing a pointer, and dereference it to a place. Corresponds to the * operator in Rust.

source

pub fn mplace_to_simd( &self, mplace: &MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, u64), InterpErrorInfo<'tcx>>

Converts a repr(simd) place into a place where place_index accesses the SIMD elements. Also returns the number of elements.

source

pub fn local_to_place( &self, local: Local ) -> Result<PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Turn a local in the current frame into a place.

source

pub fn eval_place( &self, mir_place: Place<'tcx> ) -> Result<PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Computes a place. You should only use this if you intend to write into this place; for reading, a more efficient alternative is eval_place_to_op.

source

pub fn write_immediate( &mut self, src: Immediate<<M as Machine<'mir, 'tcx>>::Provenance>, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Write an immediate to a place

source

pub fn write_scalar( &mut self, val: impl Into<Scalar<<M as Machine<'mir, 'tcx>>::Provenance>>, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Write a scalar to a place

source

pub fn write_pointer( &mut self, ptr: impl Into<Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>>, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Write a pointer to a place

source

pub fn write_uninit( &mut self, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

source

pub fn copy_op_allow_transmute( &mut self, src: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Copies the data from an operand to a place. The layouts of the src and dest may disagree.

source

pub fn copy_op( &mut self, src: &impl Readable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, dest: &impl Writeable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

Copies the data from an operand to a place. src and dest must have the same layout and the copied value will be validated.

source

pub fn force_allocation( &mut self, place: &PlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Ensures that a place is in memory, and returns where it is. If the place currently refers to a local that doesn’t yet have a matching allocation, create such an allocation. This is essentially force_to_memplace.

source

pub fn allocate_dyn( &mut self, layout: TyAndLayout<'tcx, Ty<'tcx>>, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind>, meta: MemPlaceMeta<<M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn allocate( &mut self, layout: TyAndLayout<'tcx, Ty<'tcx>>, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source

pub fn allocate_str( &mut self, str: &str, kind: MemoryKind<<M as Machine<'mir, 'tcx>>::MemoryKind>, mutbl: Mutability ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

Returns a wide MPlace of type str to a new 1-aligned allocation.

source

pub fn raw_const_to_mplace( &self, raw: ConstAlloc<'tcx> ) -> Result<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, Prov, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, Prov: Provenance, M: Machine<'mir, 'tcx, Provenance = Prov>,

source

pub fn project_field<P>( &self, base: &P, field: usize ) -> Result<P, InterpErrorInfo<'tcx>>
where P: Projectable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>,

Offset a pointer to project to a field of a struct/union. Unlike place_field, this is always possible without allocating, so it can take &self. Also return the field’s layout. This supports both struct and array fields, but not slices!

This also works for arrays, but then the usize index type is restricting. For indexing into arrays, use mplace_index.

source

pub fn project_downcast<P>( &self, base: &P, variant: VariantIdx ) -> Result<P, InterpErrorInfo<'tcx>>
where P: Projectable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>,

Downcasting to an enum variant.

source

pub fn project_index<P>( &self, base: &P, index: u64 ) -> Result<P, InterpErrorInfo<'tcx>>
where P: Projectable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>,

Compute the offset and field layout for accessing the given index.

source

pub fn project_array_fields<'a, P>( &self, base: &'a P ) -> Result<ArrayIterator<'tcx, 'a, <M as Machine<'mir, 'tcx>>::Provenance, P>, InterpErrorInfo<'tcx>>
where P: Projectable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>,

Iterates over all fields of an array. Much more efficient than doing the same by repeatedly calling project_index.

source

pub fn project<P>( &self, base: &P, proj_elem: ProjectionElem<Local, Ty<'tcx>> ) -> Result<P, InterpErrorInfo<'tcx>>
where P: Projectable<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> + From<MPlaceTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>> + Debug,

Applying a general projection

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn step(&mut self) -> Result<bool, InterpErrorInfo<'tcx>>

Returns true as long as there are more things to do.

This is used by priroda

This is marked #inline(always) to work around adversarial codegen when opt-level = 3

source

pub fn statement( &mut self, stmt: &Statement<'tcx> ) -> Result<(), InterpErrorInfo<'tcx>>

Runs the interpretation logic for the given mir::Statement at the current frame and statement counter.

This does NOT move the statement counter forward, the caller has to do that!

source

pub fn eval_rvalue_into_place( &mut self, rvalue: &Rvalue<'tcx>, place: Place<'tcx> ) -> Result<(), InterpErrorInfo<'tcx>>

Evaluate an assignment statement.

There is no separate eval_rvalue function. Instead, the code for handling each rvalue type writes its results directly into the memory specified by the place.

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn copy_fn_arg( &self, arg: &FnArg<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>

Make a copy of the given fn_arg. Any InPlace are degenerated to copies, no protection of the original memory occurs.

source

pub fn copy_fn_args( &self, args: &[FnArg<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>] ) -> Vec<OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>>

Make a copy of the given fn_args. Any InPlace are degenerated to copies, no protection of the original memory occurs.

source

pub fn fn_arg_field( &self, arg: &FnArg<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, field: usize ) -> Result<FnArg<'tcx, <M as Machine<'mir, 'tcx>>::Provenance>, InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn get_vtable_ptr( &self, ty: Ty<'tcx>, poly_trait_ref: Option<Binder<'tcx, ExistentialTraitRef<'tcx>>> ) -> Result<Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>>, InterpErrorInfo<'tcx>>

Creates a dynamic vtable for the given type and vtable origin. This is used only for objects.

The trait_ref encodes the erased self type. Hence, if we are making an object Foo<Trait> from a value of type Foo<T>, then trait_ref would map T: Trait. None here means that this is an auto trait without any methods, so we only need the basic vtable (drop, size, align).

source

pub fn get_vtable_entries( &self, vtable: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<&'tcx [VtblEntry<'tcx>], InterpErrorInfo<'tcx>>

Returns a high-level representation of the entries of the given vtable.

source

pub fn get_vtable_size_and_align( &self, vtable: Pointer<Option<<M as Machine<'mir, 'tcx>>::Provenance>> ) -> Result<(Size, Align), InterpErrorInfo<'tcx>>

source§

impl<'mir, 'tcx, M> InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

source

pub fn validate_operand( &self, op: &OpTy<'tcx, <M as Machine<'mir, 'tcx>>::Provenance> ) -> Result<(), InterpErrorInfo<'tcx>>

This function checks the data at op to be runtime-valid. op is assumed to cover valid memory if it is an indirect operand. It will error if the bits at the destination do not match the ones described by the layout.

Trait Implementations§

source§

impl<'mir, 'tcx, M> FnAbiOfHelpers<'tcx> for InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

§

type FnAbiOfResult = Result<&'tcx FnAbi<'tcx, Ty<'tcx>>, InterpErrorInfo<'tcx>>

The &FnAbi-wrapping type (or &FnAbi itself), which will be returned from fn_abi_of_* (see also handle_fn_abi_err).
source§

fn handle_fn_abi_err( &self, err: FnAbiError<'tcx>, _span: Span, _fn_abi_request: FnAbiRequest<'tcx> ) -> InterpErrorInfo<'tcx>

Helper used for fn_abi_of_*, to adapt tcx.fn_abi_of_*(...) into a Self::FnAbiOfResult (which does not need to be a Result<...>). Read more
source§

impl<'mir, 'tcx, M> HasDataLayout for InterpCx<'mir, 'tcx, M>
where M: Machine<'mir, 'tcx>,

source§

impl<'mir, 'tcx, M> HasParamEnv<'tcx> for InterpCx<'mir, 'tcx, M>
where M: Machine<'mir, 'tcx>,

source§

fn param_env(&self) -> ParamEnv<'tcx>

source§

impl<'mir, 'tcx, M> HasTyCtxt<'tcx> for InterpCx<'mir, 'tcx, M>
where M: Machine<'mir, 'tcx>,

source§

fn tcx(&self) -> TyCtxt<'tcx>

source§

impl<'mir, 'tcx, M> LayoutOfHelpers<'tcx> for InterpCx<'mir, 'tcx, M>
where 'tcx: 'mir, M: Machine<'mir, 'tcx>,

§

type LayoutOfResult = Result<TyAndLayout<'tcx, Ty<'tcx>>, InterpErrorInfo<'tcx>>

The TyAndLayout-wrapping type (or TyAndLayout itself), which will be returned from layout_of (see also handle_layout_err).
source§

fn layout_tcx_at_span(&self) -> Span

Span to use for tcx.at(span), from layout_of.
source§

fn handle_layout_err( &self, err: LayoutError<'tcx>, _: Span, _: Ty<'tcx> ) -> InterpErrorInfo<'tcx>

Helper used for layout_of, to adapt tcx.layout_of(...) into a Self::LayoutOfResult (which does not need to be a Result<...>). Read more

Auto Trait Implementations§

§

impl<'mir, 'tcx, M> DynSend for InterpCx<'mir, 'tcx, M>
where M: DynSend, <M as Machine<'mir, 'tcx>>::MemoryMap: DynSend, <M as Machine<'mir, 'tcx>>::ExtraFnVal: DynSend,

§

impl<'mir, 'tcx, M> !DynSync for InterpCx<'mir, 'tcx, M>

§

impl<'mir, 'tcx, M> !Freeze for InterpCx<'mir, 'tcx, M>

§

impl<'mir, 'tcx, M> !RefUnwindSafe for InterpCx<'mir, 'tcx, M>

§

impl<'mir, 'tcx, M> !Send for InterpCx<'mir, 'tcx, M>

§

impl<'mir, 'tcx, M> !Sync for InterpCx<'mir, 'tcx, M>

§

impl<'mir, 'tcx, M> Unpin for InterpCx<'mir, 'tcx, M>
where M: Unpin, <M as Machine<'mir, 'tcx>>::MemoryMap: Unpin, <M as Machine<'mir, 'tcx>>::ExtraFnVal: Unpin,

§

impl<'mir, 'tcx, M> !UnwindSafe for InterpCx<'mir, 'tcx, M>

Blanket Implementations§

source§

impl<T> Aligned for T

source§

const ALIGN: Alignment = _

Alignment of Self.
source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T, R> CollectAndApply<T, R> for T

source§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

§

impl<T> Filterable for T

§

fn filterable( self, filter_name: &'static str ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<'tcx, C> FnAbiOf<'tcx> for C
where C: FnAbiOfHelpers<'tcx>,

source§

fn fn_abi_of_fn_ptr( &self, sig: Binder<'tcx, FnSig<'tcx>>, extra_args: &'tcx RawList<(), Ty<'tcx>> ) -> Self::FnAbiOfResult

Compute a FnAbi suitable for indirect calls, i.e. to fn pointers. Read more
source§

fn fn_abi_of_instance( &self, instance: Instance<'tcx>, extra_args: &'tcx RawList<(), Ty<'tcx>> ) -> Self::FnAbiOfResult

Compute a FnAbi suitable for declaring/defining an fn instance, and for direct calls to an fn. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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<P> IntoQueryParam<P> for P

source§

impl<'tcx, C> LayoutOf<'tcx> for C
where C: LayoutOfHelpers<'tcx>,

source§

fn layout_of(&self, ty: Ty<'tcx>) -> Self::LayoutOfResult

Computes the layout of a type. Note that this implicitly executes in “reveal all” mode, and will normalize the input type.
source§

fn spanned_layout_of(&self, ty: Ty<'tcx>, span: Span) -> Self::LayoutOfResult

Computes the layout of a type, at span. Note that this implicitly executes in “reveal all” mode, and will normalize the input type.
source§

impl<T> MaybeResult<T> for T

§

type Error = !

source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> PointerArithmetic for T
where T: HasDataLayout,

source§

fn pointer_size(&self) -> Size

source§

fn max_size_of_val(&self) -> Size

source§

fn target_usize_max(&self) -> u64

source§

fn target_isize_min(&self) -> i64

source§

fn target_isize_max(&self) -> i64

source§

fn target_usize_to_isize(&self, val: u64) -> i64

source§

fn truncate_to_ptr(&self, _: (u64, bool)) -> (u64, bool)

Helper function: truncate given value-“overflowed flag” pair to pointer size and update “overflowed flag” if there was an overflow. This should be called by all the other methods before returning!
source§

fn overflowing_offset(&self, val: u64, i: u64) -> (u64, bool)

source§

fn overflowing_signed_offset(&self, val: u64, i: i64) -> (u64, bool)

source§

fn offset<'tcx>(&self, val: u64, i: u64) -> Result<u64, InterpErrorInfo<'tcx>>

source§

fn signed_offset<'tcx>( &self, val: u64, i: i64 ) -> Result<u64, InterpErrorInfo<'tcx>>

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<'tcx, T> ToPredicate<'tcx, T> for T

source§

fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T

source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<Tcx, T> Value<Tcx> for T
where Tcx: DepContext,

source§

default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.