[][src]Module rustc_mir::interpret

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

An interpreter for MIR used in CTFE and by miri

Modules

castInternal
eval_contextInternal
internInternal

This module specifies the type based interner for constants.

intrinsicsInternal

Intrinsics and other functions that the miri engine executes without looking at their MIR. Intrinsics/functions supported here are shared by CTFE and miri.

machineInternal

This module contains everything needed to instantiate an interpreter. This separation exists to ensure that no fancy miri features like interpreting common C functions leak into CTFE.

memoryInternal

The memory subsystem.

operandInternal

Functions concerning immediate values and operands, and reading from operands. All high-level functions to read from memory work on operands as sources.

operatorInternal
placeInternal

Computations on places -- field projections, going from mir::Place, and writing into a place. All high-level functions to write to memory work on places as destinations.

stepInternal

This module contains the InterpCx methods for executing a single step of the interpreter.

terminatorInternal
traitsInternal
validityInternal

Check the validity invariant of a given value, and tell the user where in the value it got violated. In const context, this goes even further and tries to approximate const safety. That's useful because it means other passes (e.g. promotion) can rely on consts to be const-safe.

visitorInternal

Visitor for a run-time value with a given layout: Traverse enums, structs and other compound types until we arrive at the leaves, with custom handling for primitive types.

Macros

compile_time_machineInternal

Structs

AllocDecodingSessionInternal
AllocDecodingStateInternal
AllocIdInternal
AllocationInternal
ConstEvalErrInternal
FrameInternal

A stack frame.

FrameInfoInternal
GlobalIdInternal

Uniquely identifies one of the following:

ImmTyInternal
InitMaskInternal

A bitmask where each bit refers to the byte with the same index. If the bit is true, the byte is initialized. If it is false the byte is uninitialized.

InterpCxInternal
InterpErrorInfoInternal

Packages the kind of error we got from the const code interpreter up with a Rust-level backtrace of where the error occurred. Thsese should always be constructed by calling .into() on a InterpError. In librustc_mir::interpret, we have throw_err_* macros for this.

LitToConstInputInternal

Input argument for tcx.lit_to_const.

LocalStateInternal

State of a local variable including a memoized layout

MPlaceTyInternal

A MemPlace with its layout. Constructing it is only possible in this module.

MemPlaceInternal
MemoryInternal
OpTyInternal
PlaceTyInternal
PointerInternal

Represents a pointer in the Miri engine.

RawConstInternal

Represents the result of a raw const operation, pre-validation.

RefTrackingInternal

State for tracking recursive validation of references

RelocationsInternal

Relocations.

UninitBytesAccessInternal

Details of an access to uninitialized bytes where it is not allowed.

Enums

AllocCheckInternal

Used by get_size_and_align to indicate whether the allocation needs to be live.

CheckInAllocMsgInternal

Details of why a pointer had to be in-bounds.

ConstValueInternal

Represents a constant value in Rust. Scalar and Slice are optimizations for array length computations, enum discriminants and the pattern matching logic.

ErrorHandledInternal
FnValInternal

The value of a function pointer.

GlobalAllocInternal

An allocation in the global (tcx-managed) memory can be either a function pointer, a static, or a "real" allocation with some data in it.

ImmediateInternal

An Immediate represents a single immediate self-contained Rust value.

InternKindInternal
InterpErrorInternal
InvalidProgramInfoInternal

Error information for when the program we executed turned out not to actually be a valid program. This cannot happen in stand-alone Miri, but it can happen during CTFE/ConstProp where we work on generic code or execution does not have all information available.

LitToConstErrorInternal

Error type for tcx.lit_to_const.

LocalValueInternal

Current value of a local variable

MemPlaceMetaInternal

Information required for the sound usage of a MemPlace.

MemoryKindInternal
OperandInternal

An Operand is the result of computing a mir::Operand. It can be immediate, or still in memory. The latter is an optimization, to delay reading that chunk of memory and to avoid having to store arbitrary-sized data here.

PlaceInternal
ResourceExhaustionInfoInternal

Error information for when the program exhausted the resources granted to it by the interpreter.

ScalarInternal

A Scalar represents an immediate, primitive value existing outside of a memory::Allocation. It is in many ways like a small chunk of a Allocation, up to 8 bytes in size. Like a range of bytes in an Allocation, a Scalar can either represent the raw bytes of a simple value or a pointer into another Allocation

ScalarMaybeUninitInternal
StackPopCleanupInternal
StackPopJumpInternal

Data returned by Machine::stack_pop, to provide further control over the popping of the stack frame

UndefinedBehaviorInfoInternal

Error information for when the program caused Undefined Behavior.

UnsupportedOpInfoInternal

Error information for when the program did something that might (or might not) be correct to do according to the Rust spec, but due to limitations in the interpreter, the operation could not be carried out. These limitations can differ between CTFE and the Miri engine, e.g., CTFE does not support dereferencing pointers at integral addresses.

Traits

AllocMapInternal

The functionality needed by memory to manage its allocations

AllocationExtraInternal
MachineInternal

Methods of this trait signifies a point where CTFE evaluation would fail and some use case dependent behaviour can instead be applied.

MachineStopTypeInternal

A trait for machine-specific errors (or other "machine stop" conditions).

MayLeakInternal

Whether this kind of memory is allowed to leak

MutValueVisitorInternal
PointerArithmeticInternal
ValueVisitorInternal

Functions

get_slice_bytesInternal

Gets the bytes of a constant slice value.

intern_const_alloc_recursiveInternal

Intern ret and everything it references.

read_target_uintInternal
sign_extendInternal

Truncates value to size bits and then sign-extend it to 128 bits (i.e., if it is negative, fill with 1's on the left).

specialized_encode_alloc_idInternal
struct_errorInternal
truncateInternal

Truncates value to size bits.

uabsInternal

Computes the unsigned absolute value without wrapping or panicking.

write_target_uintInternal

Type Definitions

ConstEvalRawResultInternal
ConstEvalResultInternal
InterpResultInternal