Skip to content

run non-const Display/Debug impls for const panic message #86364

Open
@oli-obk

Description

@oli-obk

Given that the CTFE core engine already supports the entire display machinery (demonstrated by the fact that it works in Miri), we might alternatively poke a small hole into the const checks that allows executing formatting machinery from panic_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions