this post was submitted on 12 Mar 2025
702 points (98.5% liked)

Programmer Humor

21564 readers
2279 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Traister101@lemmy.today 1 points 4 days ago (1 children)

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 1 points 4 days 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.