Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like the idea of using:

  trusted { … }


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.


    trustMeBro { ... }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: