pub type CompileTimeInterpCx<'tcx> = InterpCx<'tcx, CompileTimeMachine<'tcx>>;
Aliased Type§
struct CompileTimeInterpCx<'tcx> {
pub machine: CompileTimeMachine<'tcx>,
pub tcx: TyCtxtAt<'tcx>,
pub(crate) param_env: ParamEnv<'tcx>,
pub memory: Memory<'tcx, CompileTimeMachine<'tcx>>,
pub recursion_limit: Limit,
}
Fields§
§machine: CompileTimeMachine<'tcx>
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>
Bounds in scope for polymorphic evaluations.
memory: Memory<'tcx, CompileTimeMachine<'tcx>>
The virtual memory system.
recursion_limit: Limit
The recursion limit (cached from tcx.recursion_limit(())
)
Implementations§
source§impl<'tcx> CompileTimeInterpCx<'tcx>
impl<'tcx> CompileTimeInterpCx<'tcx>
fn location_triple_for_span(&self, span: Span) -> (Symbol, u32, u32)
sourcefn hook_special_const_fn(
&mut self,
instance: Instance<'tcx>,
args: &[FnArg<'tcx>],
dest: &MPlaceTy<'tcx>,
ret: Option<BasicBlock>,
) -> InterpResult<'tcx, Option<Instance<'tcx>>>
fn hook_special_const_fn( &mut self, instance: Instance<'tcx>, args: &[FnArg<'tcx>], dest: &MPlaceTy<'tcx>, ret: Option<BasicBlock>, ) -> InterpResult<'tcx, Option<Instance<'tcx>>>
“Intercept” a function call, because we have something special to do for it.
All #[rustc_do_not_const_check]
functions should be hooked here.
If this returns Some
function, which may be instance
or a different function with
compatible arguments, then evaluation should continue with that function.
If this returns None
, the function call has been handled and the function has returned.
sourcefn align_offset(
&mut self,
instance: Instance<'tcx>,
args: &[OpTy<'tcx>],
dest: &MPlaceTy<'tcx>,
ret: Option<BasicBlock>,
) -> InterpResult<'tcx, ControlFlow<()>>
fn align_offset( &mut self, instance: Instance<'tcx>, args: &[OpTy<'tcx>], dest: &MPlaceTy<'tcx>, ret: Option<BasicBlock>, ) -> InterpResult<'tcx, ControlFlow<()>>
align_offset(ptr, target_align)
needs special handling in const eval, because the pointer
may not have an address.
If ptr
does have a known address, then we return Continue(())
and the function call should
proceed as normal.
If ptr
doesn’t have an address, but its underlying allocation’s alignment is at most
target_align
, then we call the function again with an dummy address relative to the
allocation.
If ptr
doesn’t have an address and target_align
is stricter than the underlying
allocation’s alignment, then we return usize::MAX
immediately.
sourcefn guaranteed_cmp(&mut self, a: Scalar, b: Scalar) -> InterpResult<'tcx, u8>
fn guaranteed_cmp(&mut self, a: Scalar, b: Scalar) -> InterpResult<'tcx, u8>
See documentation on the ptr_guaranteed_cmp
intrinsic.
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: 296 bytes