rust-lang/rust

Cleanup CTFE error reporting code & centralize promoted error reporting logic

RalfJung opened this issue · 1 comments

CTFE error reporting code is quite complex, and some of the logic is repeated in many places -- e.g. the fact that we do not report hard errors for evaluation failures in promoteds. We should try to centralize that logic (and with rust-lang/const-eval#53 we can hopefully get rid of some of it eventually).

Cases I know of:

  • This here might or might not still be needed but at least the "promoteds only get lints" logic" can hopefully be deduplicated and all the error-reporting logic also moved to librustc_mir::const_eval.
  • Codegen also does CTFE error reporting (with yet another copy of the "promoted" logic) that should be handled through librustc_mir::const_eval::error.

Cc @rust-lang/wg-const-eval

With #80579 having landed, promoteds in functions cannot fail to evaluate, so a lot of this can be simplified by quite a bit. :)