Expand description
Check the validity invariant of a given value, and tell the user
where in the value it got violated.
In const context, this goes even further and tries to approximate const safety.
That’s useful because it means other passes (e.g. promotion) can rely on const
s
to be const-safe.
Macros§
- If $e throws an error matching the pattern, throw a validation failure. Other errors are passed back to the caller, unchanged – and if they reach the root of the visitor, we make sure only validation errors and
InvalidProgram
errors are left. This lets you use the patterns as a kind of validation list, asserting which errors can possibly happen:
Structs§
- Represents a set of
Size
values as a sorted list of ranges. - State for tracking recursive validation of references
Enums§
- Extra things to check for during validation of CTFE results.
- We want to show a nice path to the invalid field for diagnostics, but avoid string operations in the happy case where no error happens. So we track a
Vec<PathElem>
wherePathElem
contains all the data we need to later print something for the user.
Functions§
- Returns whether the allocation is mutable, and whether it’s actually a static. For “root” statics we look at the type to account for interior mutability; for nested statics we have no type and directly use the annotated mutability.
- Format a path