• SorteKanin@feddit.dk
    link
    fedilink
    arrow-up
    47
    ·
    edit-2
    9 months ago

    It’s utilizing an obscure bug in the Rust compiler that unfortunately lets you circumvent the safety guarantees in order to produce undefined behavior - it’s mostly just a joke though, you will not run into the bug in normal code

    • porgamrer
      link
      fedilink
      arrow-up
      4
      ·
      9 months ago

      Thanks for clarifying. Do you know what the bug is? I gathering it’s something to do with enums and boxing to enable a “safe” transmute, but couldn’t make sense of the code.

      Scary compiler edge cases with value-type enums aren’t surprising though. Trying to implement that feature with memory safety and high performance sounds like a nightmare.