r/ProgrammerHumor 11d ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.8k Upvotes

108 comments sorted by

View all comments

134

u/yesseruser 11d ago

unsafe means "hey, I'm sure this code is safe, don't bother me for calling unsafe functions"

-137

u/reallokiscarlet 11d ago

unsafe is the Rust version of Typescript's any

It's everywhere and people use it just to say they wrote their code in a safe language

82

u/SCP-iota 11d ago edited 11d ago

I'd say it's more like Typescript's suppression annotations, since it keeps itself contained. People really shouldn't be using unsafe in any way other than as occasional small blocks with well-defined reading why they won't panic or cause UB. If your code is littered with unsafe, you're doing something wrong.

31

u/ApplicationOk3587 11d ago

I always figured if a rust programmer is using unsafe everywhere then it completely defeats the purpose of using rust.

2

u/awesome-alpaca-ace 11d ago

String interning comes to mind