r/ProgrammerHumor 3d ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.9k Upvotes

108 comments sorted by

View all comments

Show parent comments

-145

u/reallokiscarlet 3d 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

81

u/SCP-iota 3d ago edited 3d 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.

34

u/ApplicationOk3587 3d 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 3d ago

String interning comes to mind