• Traister101@lemmy.today
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      Ah yes now I can… dereference a raw pointer (yes that’s essentially the only thing unsafe rust actually enables you to do, it doesn’t disable the borrow checker or anything else, it just allows you to play with pointers)

      • calcopiritus@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        6 hours ago
        unsafe fn<'a, T>(p: &'a T) -> &'static mut T {
            p as *cons T as *mut T as &'static mut T
        }
        

        It is a bit more than just dereferencing raw pointers.