What are the most absolutely demonic patterns (and anti-patterns) of Rust?

238 points oneirical 169 comments

If I asked this question in a C forum, it would be easy, they would quickly whip up traumatizing UB and memory allocation problems. But in Rust that category goes out the window (unless you use unsafe poorly).

So, what’s a Rust concept that’s booby-trapped, very unintuitive, and difficult to fix if it sneaks up in your codebase? I’m looking for things like messed up usage of trait objects, cursed lifetimes, non-deterministic parallelism bugs, a usage of unsafe that WOULD BE safe if it were not for that one tiny thing… a horror story you might have experienced yourself.