one of the gnarliest tricks i've seen in rust is preventing deadlocks *at compile time*
I think it might be fun to make a mutex library where you must give every mutex a u32 priority, and you are only allowed to acquire mutexes of strictly higher priority than any your thread currently holds, with crashes if you violate this rule. This completely prevents deadlocks.



