Re:Rust for Filesystems
by fla on Monday July 15, 2024 @08:54AM
(#40967439)
I like the idea of using:
[ Parent
| on HN ]
trustMeBro { ... }Yeah, you just renamed `unsafe`.
`unsafe` is the part where the compiler trusts you to uphold your own invariants, necessary to prevent Unsoundness. For example:
- unsafe fn get_unchecked(index) - compiler believes you will ensure index < length.
- unsafe fn set_capacity(capacity) - compiler trusts you will not set capacity to value that will cause UB. Even if its code boils essentially to set a field - which is safe according to Rust, but may invalidate other invariants preserving soundness.