|
|
|
|
|
by Ygg2
620 days ago
|
|
> If your Rust project leans heavily on unsafe code and/or many libraries that use lots of unsafe, then aren’t you fooling yourself to some degree 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. |
|