News for hackers. Stuff that matters.
Re:Rust for Filesystems by fla on Monday July 15, 2024 @08:54AM (#40967439)
I like the idea of using:

  trusted { … }
Re:Rust for Filesystems by tracker1 on Monday July 15, 2024 @10:30AM (#40968201)

    trustMeBro { ... }
Re:Rust for Filesystems by Ygg2 on Monday July 15, 2024 @09:54AM (#40967924)
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.