run non-const Display/Debug impls for const panic message #86364
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given that the CTFE core engine already supports the entire display machinery (demonstrated by the fact that it works in Miri), we might
alternativelypoke a small hole into the const checks that allows executing formatting machinery frompanic_fmt
only -- something like "miri unleashed", but more targeted.Originally posted by @RalfJung in #78356 (comment)
Basically the same rationale as allowing -> _ return types in the parser, to get a better error later. In this case, when you use panic!() in CTFE, you are going to fail the build anyway, so we can just as well run something that may fail to get evaluated because it does something horribly unconst.
The only problem is that then const fn can execute non-const code at runtime during the panic machinery and before actually panicking, which may not be desirable.
The text was updated successfully, but these errors were encountered: