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 MUST 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 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.
Returns 2
if the result is unknown.
Returns 1
if the pointers are guaranteed equal.
Returns 0
if the pointers are guaranteed inequal.
Note that this intrinsic is exposed on stable for comparison with null. In other words, any change to this function that affects comparison with null is insta-stable!
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