• MartianSands@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    6
    ·
    12 hours ago

    The safety designed into Rust is suddenly foreign to the C family that I’m honestly not sure you can do that. Even “unsafe” Rust doesn’t completely switch off the enforced safety

    • InnerScientist@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 hours ago

      Yeah, to quote the manual:

      "[Unsafe Rust allows you to]

      • Dereference a raw pointer.
      • Call an unsafe function or method.
      • Access or modify a mutable static variable.
      • Implement an unsafe trait.
      • Access fields of unions.

      […] The unsafe keyword only gives you access to these five features that are then not checked by the compiler for memory safety."

      https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html