That's why every unsafe block needs a SAFETY block.
Is using vec.get_unchecked(6) safe? No. Is it safe for a vector that will under all circumstances (i.e. invariant) have exactly 64 element. Yes.
As long as for all possible inputs in safe function your SAFETY block holds, that code is considered safe.
That's why every unsafe block needs a SAFETY block.
Is using vec.get_unchecked(6) safe? No. Is it safe for a vector that will under all circumstances (i.e. invariant) have exactly 64 element. Yes.
As long as for all possible inputs in safe function your SAFETY block holds, that code is considered safe.