As a sibling notes, currently, this is for debug builds. (I love this feature, and I wish they had done it in release mode too. The sibling comment has some notes on that, too.)
(But, e.g., were `git` written in Rust, presumably the end product would be a release build. Now, you can enable the check there, but that is something you have to do, today.)
The correct answer is what shepmaster said in a sibling comment.
https://cp4space.hatsya.com/2021/09/01/an-efficient-prime-fo...
> If A happened to be larger than C, and therefore the result of the subtraction underflowed, then we can correct for this by adding p to the result. [...] we can multiply B by 2^32 using a binary shift and a subtraction, and then add it to the result. We might encounter an overflow, but we can correct for that by subtracting p.
(Highlighting the parts that relate to reacting to overflow.)
The `(T, bool)` that gets returned is friendly towards optimization.
If you don't use the bool, the overflowing arithmetic is reduced to efficient arithmetic which is overflowing by default. If you do use the bool, the generated code contains one extra instruction.
https://doc.rust-lang.org/std/?search=overflowing
It's generally less ergonomic, e.g.