Structural const qualification.
Qualif trait for more info.
- Constant containing interior mutability (
UnsafeCell<T>). This must be ruled out to make sure that evaluating the constant at compile-time and at any point during the run-time would produce the same result. In particular, promotion of temporaries must not change program behavior; if the promoted could be written to, that would be a problem.
- Constant containing an ADT that implements
Drop. This must be ruled out because implicit promotion would remove side-effects that occur as part of dropping that value. N.B., the implicit promotion has to reject const Drop implementations because even if side-effects are ruled out through other means, the execution of the drop could diverge.
- Constant containing an ADT that implements non-const
Drop. This must be ruled out because we cannot run
- A “qualif”(-ication) is a way to look for something “bad” in the MIR that would disqualify some code for promotion or prevent it from evaluating at compile time.