InfoQ Homepage Presentations The Rust Borrow Checker - a Deep Dive
Nell Shamrell-Harrington discusses how to transition from fighting the borrow checker to using its guidance to write safer and more powerful code at any experience level.
Nell Shamrell-Harrington is a principal software engineer at Microsoft in the Open Source Programs Office. She is also a member of several Rust language teams and working groups, as well as the lead editor of This Week in Rust. Previously, she worked at Mozilla and Chef Software. In her spare time, she is a member of the board of Operation Code.
QCon Plus is a virtual conference for senior software engineers and architects that covers the trends, best practices, and solutions leveraged by the world's most innovative software organizations.
Shamrell-Harrington: When I work with someone who is just learning Rust, they sometimes question whether the Rust borrow checker is their friend or their foe. If you take a look at the Rust subreddit, it's common to see posts with headlines like, "Newbie question regarding the borrow checker. Help finding the borrow checker. Does it ever get easier fighting with the borrow checker?" However, as you watch people gain more experience with Rust, they do tend to come around to the borrow checker and realize what it protects them from doing. In answer to the question, is the borrow checker a friend or a foe, I say the borrow checker will become your friend through experience. Along with gaining experience with it, it is also very helpful to understand how it works and why it does the things it does. We're going to dive deep into that.