Do we need even more agressive validation? #508
Labels
A-validation
Area: This affects enforcing the validity invariant, and related UB checking
C-enhancement
Category: a PR with an enhancement or an issue tracking an accepted enhancement
Currently, we do not catch this:
In the MIR, the
*xref = NonZero(0)
becomes an assignment of the only field of this struct, and that field is of typei32
and hence value0
is no problem.I could imagine doing validation of prefixes of the path involved in an assignment, but I see no way to catch the following:
This won't even be caught by @oli-obk's new unsafety check for constructing
NonZero
.(The last example is not specific to
NonZero
at all; writing2
into a&mut bool
after casting it to*mut u8
is similar.)The text was updated successfully, but these errors were encountered: