Skip to main content

mir_for_direct_const

Function mir_for_direct_const 

Source
fn mir_for_direct_const<'tcx>(
    tcx: TyCtxt<'tcx>,
    def_id: LocalDefId,
) -> Body<'tcx>
Expand description

A Const::Unevaluated/mir::UnevaluatedConst to a gca! const refers to synthesized MIR that simply returns a Const::Ty of itself. Evaluation of the Const::Ty then calls typesystem normalization, which eventually calls const_of_item (among other checks) which is the “actual” value of the const. It then performs a valtree to const val conversion.

This function produces that synthesized MIR.