News for hackers. Stuff that matters.
Re:What Is Rust's Unsafe? (2019) by afdbcreid on Sunday April 10, 2022 @11:51PM (#30984425)
Technically, code that contains UB is just UB, and unsound code is code that allows you to trigger UB using safe code only.

For example, this is UB:

  unsafe { std::hint::unreachable_unchecked() };
And this is an unsound code, that may not contain any UB if I call `unsound()` with `false`:

  fn unsound(trigger: bool) {
      if trigger { unsafe { std::hint::unreachable_unchecked() }; }
  }

There are no comments on this comment yet.