• SorteKanin
    arrow-up
    47
    arrow-down
    0
    ·
    8 months ago
    edit-2
    8 months ago
    link
    fedilink

    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
      arrow-up
      4
      arrow-down
      0
      ·
      8 months ago
      link
      fedilink

      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.