Function rustc_const_eval::const_eval::destructure_const [−][src]
pub(crate) fn destructure_const<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
val: &'tcx Const<'tcx>
) -> DestructuredConst<'tcx>
Expand description
This function uses unwrap
copiously, because an already validated constant
must have valid fields and can thus never fail outside of compiler bugs. However, it is
invoked from the pretty printer, where it can receive enums with no variants and e.g.
read_discriminant
needs to be able to handle that.