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 consts
to be const-safe.
MacrosΒ§
- err_
validation_ πfailure - throw_
validation_ πfailure - try_
validation π - 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
InvalidProgramerrors are left. This lets you use the patterns as a kind of validation list, asserting which errors can possibly happen:
StructsΒ§
- Range
Set - Represents a set of
Sizevalues as a sorted list of ranges. - RefTracking
- State for tracking recursive validation of references
- Validity
Visitor π
EnumsΒ§
- Ctfe
Validation Mode - Extra things to check for during validation of CTFE results.
- Expected
Kind π - Path
Elem - 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>wherePathElemcontains all the data we need to later print something for the user. - Pointer
Kind π - Validation
Error πKind - Validation errors that can be emitted in one than one place get a variant here so that
we format them consistently. Everything else uses the
Stringfallback.
FunctionsΒ§
- fmt_
range π - write_
path π - Format a path