Code Review
Code Review
Posted Nov 14, 2025 19:22 UTC (Fri) by tialaramex (subscriber, #21167)In reply to: Code Review by Vorpal
Parent article: Rust in Android: move fast and fix things (Google Security Blog)
"Oh! Yeah, that's wrong, I will fix it"
and rarely that you say instead:
"Stupid compiler. It's not wrong, either shut up and accept what I wrote or explain clearly the problem"
I had a Rust diagnostic that I felt was less helpful than it should be. I grep'd the error text, found a constant with that text as its definition (this is all memory so details may be wrong) and then found that constant used only once, at the site emitting the diagnostic text. I read surrounding code and intuited how to write a better diagnostic, and yeah, first time it compiled it actually worked - as I got more familiar with the surrounding code I actually added some useful extra stuff until I was happy that anyone seeing this diagnostic was getting the best I could give them. One thing I realized part way through is that we're not on the happy path - nobody is ever going to curse that my diagnosis code is inefficient, because their program is wrong, and I'm telling them why, if the program wasn't wrong my code never runs at all. From "How hard can it be?" to a (nightly) release with my fix took less than one week. Rustc's reviewer was very helpful in shepherding me through and identifying anywhere my change did need small improvements to hit their quality goals.
