Constant validation is not part of the query that evaluates constants, because it would cause cycle errors in case a static directly or transitively contained a pointer back to itself.
One possible solution is to wrap another query around the const_eval query, not exposing the const_eval query to regular callers (similar to is_freeze_raw) and having a wrapper query around it that does the validation and thus also caches the validation.
Constant validation is not part of the query that evaluates constants, because it would cause cycle errors in case a static directly or transitively contained a pointer back to itself.
One possible solution is to wrap another query around the
const_evalquery, not exposing theconst_evalquery to regular callers (similar tois_freeze_raw) and having a wrapper query around it that does the validation and thus also caches the validation.