It's not rust specific, but any language which allows you to work on a higher level and with better typing helps close that gap. For example for a long time Linux kernel had an issue with marking user/kernel addresses which opened it up to bugs and security issues. In C those are just numbers. In Rust this is moot and correct by default because user addresses are explicitly UserPtr.
So yes, sometimes a better language allows you make some unintended things explicitly not compile. It won't solve the issue completely, but the scope of the mismatch gets much smaller.
What if you didn't understand the comment?
Full validation of spec to implementation is still close to impossible and nothing that exists today will get us there outside of extremely limited scope. But some language features make the gap just a bit smaller. The less you have to look at details and more at the actual structure, the more you can be sure the implementation matches what you want.
Extreme, unrealistic case: you want to add something to a list of samples - one implementation does list.add(sample), the other inlines all the reference counting, object cloning, memory allocation and possible extension of list over 100 lines. How sure are you that either one of those implements what you want? Now reduce that to more realistic scenarios where C still forces you to either be more verbose or less explicit, while Rust (or any other more expressive language) lets you show exactly what's needed via better features or via types.
> Does it know anything about quantiles or student t distributions and will warn the agent if it implements them wrong?
No, we're not even close to that. But it lets you use stylo and implement `student(PositiveInteger v)`, which you can't achieve in C. So again - nothing can eliminate that gap today, but language features can definitely make it smaller.
You can take a lot more "smart" shortcuts in Nim, that are hard to reason about, and probably even harder when an automated system writes them.