Expand description
Reconstruct structured expressions from rustc’s various constant representations.
Functions§
- bits_
and_ 🔒type_ to_ float_ constant_ literal - Converts a bit-representation of a float of type
tyto a constant literal - const_
value_ to_ constant_ expr - eval_
mir_ constant - Evaluate a
mir::Const. - eval_
ty_ constant - Evaluate a
ty::Const. - is_
anon_ 🔒const - Whether a
DefIdis aAnonConst. An anonymous constant is generated by Rustc, hoisting every constat bits from items as separate top-level items. This AnonConst mechanism is internal to Rustc; we don’t want to reflect that, instead we prefer inlining those.is_anon_constis used to detect such AnonConst so that we can evaluate and inline them. - op_
to_ 🔒const - Use the const-eval interpreter to convert an evaluated operand back to a structured constant expression.
- scalar_
int_ 🔒to_ constant_ literal - translate_
constant_ reference - Attempts to translate a
ty::UnevaluatedConstinto a constant expression. This handles cases of references to top-level or associated constants. ReturnsNoneif the input was not a named constant. - valtree_
to_ 🔒constant_ expr