Skip to main content

Module constant_utils

Module constant_utils 

Source

Re-exports§

use crate::frontend::prelude::*; 🔒

Modules§

uneval 🔒
Translate constants to the frontend: type-system constants, and the values read by rustc_const_uneval.

Structs§

ConstantExpr
Rustc has different representations for constants: one for MIR ([rustc_middle::mir::Const]), one for the type system ([rustc_middle::ty::ConstKind]). For simplicity the frontend maps those two constructs to the same ConstantExpr type.
ConstantFieldExpr
VariantIdx
The source-order index of a variant in a type.

Enums§

ConstSource
A constant that we can ask rustc to evaluate.
ConstantByte
A byte of an evaluated constant, in the MiniRust sense.
ConstantByteProvenance
What a pointer byte in an evaluated constant points to.
ConstantExprKind
The subset of expressions that corresponds to constants.
ConstantInt
ConstantLiteral
ConstantProjectionElem
Projects a place inside the pointee of a constant pointer.
ConstantPtrBase
The place a constant pointer starts from.
FnPtrTarget
The function a function pointer points to.
GlobalRef
A global allocation.
ReadMode
How to read back an evaluated constant.
VariantKind
Describe the kind of a variant

Functions§

bits_and_type_to_float_constant_literal
Converts a bit-representation of a float of type ty to a constant literal
const_reader
The reader for constants evaluated in the current context.
read_const
Evaluate src and read it back as a ConstantExpr.
scalar_int_to_constant_literal
unsizing_metadata
The metadata of a pointer to a value of type from unsized to type to.