Login
You're viewing the ruby.social public feed.
  • Nov 25, 2026, 8:24 PM

    @mcc@mastodon.social @complexmath@hachyderm.io That's very different from what C UB provisions are like.

    What it basically says is that if you include unsafe{} in your code you are free to do the equivalent of randomly scribbling over your memory, and any soundness goes out the window as a result. It does not allow 'a-b' to generate code to execute 'rm -rf'.
    ​:abunhd:​

    💬 1🔄 0⭐ 0

Replies

  • Seancomplexmath@hachyderm.io
    Nov 25, 2026, 8:30 PM

    @bunny @mcc It's much easier to just say "we don't know what will happen if you violate these rules" than to try and state specifically what will happen when your language targets an unbounded set of computer architectures.

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 25, 2026, 8:32 PM

    @bunny @complexmath I am not a compiler engineer and have not worked on rustc. But given the way Rust ownership has implications for things like aliasing or whether a variable even exists, I'd be *very* surprised if Rust UB is restricted to "could cause runtime state corruption" rather than encompassing actual incorrect codegen. Rust's confinement of UB to unsafe {} blocks makes it a better language than C, but it doesn't mean Rust is using a different definition of the term "UB" altogether.

    💬 1🔄 0⭐ 0
  • Nov 25, 2026, 8:34 PM

    @bunny @complexmath I do notice the Rustinomicon:

    doc.rust-lang.org/nomicon/what

    early on states "Invoking Undefined Behavior gives the compiler full rights to do arbitrarily bad things to your program". Which sounds equivalent to the definitions in C and Zig. This is the document the Undefined Behavior page in the reference manual credits as the source of in-practice information about how unsafe {} is used.

    💬 0🔄 0⭐ 0