← Back to context

Comment by Graziano_M

21 hours ago

The second you have any `unsafe`, Rust is _by definition_ not memory-safe.

By that definition, Python is not memory-safe, Java is not memory-safe, Go is not memory-safe, and so on. All of these languages contain escape hatches to do memory-unsafe stuff, yet no one is calling them memory unsafe.

  • Go is more memory unsafe than Java or Rust. Data races in concurrent Go code can cause memory corruption, unlike in concurrent Java code. Safe Rust is designed to avoid data races altogether using static analysis.

And the majority of the Rust standard library uses `unsafe`.

  • Prove it. Show me the stats that the standard library is over 50% unsafe.

    • "Over 50%" only holds if the statement is intended to be binary. It may be that he considers direct use, no use, and transitive use to be all different. In which case it is possible that the majority[1] use unsafe, even if more than 50% does not.

      [1] The cult of the orange man would call this a plurality, which may be what has tripped you up, but the civilized world calls it a majority.