What is funny is that Rust has similar or worse issues regarding temporary lifetimes. Only some UB is caught (and in practice only sometimes), issues like deadlocks aren't.
https://fasterthanli.me/articles/a-rust-match-made-in-hell
Challenge to you, simonask: Explain why the curly braces here determines whether there is a deadlock or not. Bonus points if you do so without asking for help or looking anything up.
https://play.rust-lang.org/?version=stable&mode=debug&editio...
https://play.rust-lang.org/?version=stable&mode=debug&editio...