We should be enforcing constness predicates on all call-like things in HIR typeck
Opened this issue · 2 comments
compiler-errors commented
Right now we're (afaict) missing autoderefs which are applied as adjustments. Specifically interesting is the answer to the question of where do we put that enforce_context_effects call...
We're possibly also missing other things, so a full audit of HIR typeck is probably worthwhile.
RalfJung commented
Can we do this in the MIR const check to be sure we don't miss anything?
compiler-errors commented
@RalfJung: Sure, we can do it for the purposes of making sure nothing non-const leaks into the body in MIR const checking, but I'd prefer that for the purposes of diagnostics that we enforce this first in HIR typeck. This is consistent with HIR and MIR checking traits first; if something fails to satisfy a const trait predicate in MIR, we delay a bug.