Get the latest tech news
Four limitations of Rust's borrow checker
I’ve been using Rust for hobby projects since 2016 and have been working professionally in Rust since 2021, so I tend to consider myself pretty knowledgeable about Rust. I’m already familiar with all the common limitations of Rust’s type system and how to work around them, so it’s pretty rare that I have to “fight the borrow checker” as new Rust users often struggle with. However, it does still happen on occasion.
You can trivially bypass any problem by using unsafe code or by using runtime checks (e.g. “just slap Arc<Mutex<_>> on everything.”) However, having to resort to this still represents a limitation of the type system. However, the compiler currently doesn’t do any control flow analysis when deciding whether futures are Send or not, and hence it is flagged as a false positive. Out of the issues I’ve highlighted here, #1 and #4 in particular seem like obvious things to fix that would deliver a lot of value at minimal cost.
Or read this on Hacker News