Skip to main content

Module const_eval

Module const_eval 

Source

Re-exportsΒ§

use rustc_abi::FieldIdx; πŸ”’
use rustc_abi::VariantIdx; πŸ”’
use rustc_middle::mir; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_span::DUMMY_SP; πŸ”’
use rustc_span::bug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use crate::interpret::InterpCx; πŸ”’
pub(crate) use self::valtrees::eval_to_valtree; πŸ”’
pub(crate) use self::valtrees::valtree_to_const_value; πŸ”’

ModulesΒ§

dummy_machine πŸ”’
dyn_trait πŸ”’
error πŸ”’
eval_queries πŸ”’
fn_queries πŸ”’
machine πŸ”’
type_info πŸ”’
valtrees πŸ”’

MacrosΒ§

throw_machine_stop_str
Macro for machine-specific InterpError without allocation. (These will never be shown to the user, but they help diagnose ICEs.)

StructsΒ§

CompileTimeMachine
Extra machine state for CTFE, and the Machine instance.
DummyMachine

EnumsΒ§

CanAccessMutGlobal
CheckAlignment
ConstEvalErrKind
The CTFE machine has some custom error kinds.
MemoryKind

ConstantsΒ§

LINT_TERMINATOR_LIMIT
When hitting this many interpreted terminators we emit a deny by default lint that notfies the user that their constant takes a long time to evaluate. If that’s what they intended, they can just allow the lint.
PROGRESS_INDICATOR_START
After this many interpreted terminators, we start emitting progress indicators at every power of two of interpreted terminators.
TINY_LINT_TERMINATOR_LIMIT
The limit used by -Z tiny-const-eval-limit. This smaller limit is useful for internal tests not needing to run 30s or more to show some behaviour.
VALTREE_MAX_NODES πŸ”’

TraitsΒ§

InterpretationResult

FunctionsΒ§

const_validate_mplace
constness
Checks whether a function-like definition is considered to be const. Also stores constness of inherent impls.
eval_body_using_ecx
eval_in_interpreter
eval_static_initializer_provider
eval_to_allocation_raw_provider
eval_to_const_value_raw_provider
eval_trivial_const_using_ecx
get_span_and_frames
intern_and_validate
is_promotable_const_fn
lint
Emit a lint from a const-eval situation, with a backtrace.
mk_eval_cx_for_const_val
Create an interpreter context to inspect the given ConstValue. Returns both the context and an OpTy that represents the constant.
mk_eval_cx_to_read_const_val
The InterpCx is only meant to be used to do field and index projections into constants for simd_shuffle and const patterns in match arms.
op_to_const
This function converts an interpreter value into a MIR constant.
provide
report
Create a diagnostic for a const eval error.
report_eval_error
report_validation_error
retry_codegen_mode_with_postanalysis
setup_for_eval
tag_for_variant_provider
Computes the tag (if any) for a given type and variant.
try_destructure_mir_constant_for_user_output πŸ”’
turn_into_const_value

Type AliasesΒ§

CompileTimeInterpCx