How to construct hir::ConstBlock in ast lowering

I'm trying to improve the way format_args! gets lowered in the compiler, and I want to wrap the call to Arguments::new_const in a const block expr to make sure it gets constant folded (relavant github issue), but hir::ConstBlock doesn't have an obvious method of construction.

I have a hir::ExprKind, and I somehow need to turn that into a BodyId? some of the LoweringContext methods are useful for constructing other types of expressions, but not so much for ConstBlock.

Any idea how to do this?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.