|
|
|
|
|
by cytzol
3298 days ago
|
|
> This is my unsafe block's bug, but it seems like something that could take a good while debugging to attribute back to my unsafe block. You are correct: it's possible to write nefarious code inside an 'unsafe' block then only suffer its effects outside of it, and Rust has to document that fact. The Nomicon, mentioned in the blog post a whole bunch, points this out early on: > 'unsafe' does more than pollute a whole function: it pollutes a whole module. Generally, the only bullet-proof way to limit the scope of unsafe code is at the module boundary with privacy. [ https://doc.rust-lang.org/nightly/nomicon/working-with-unsaf... ] |
|