Rust compiler do exactly what you need
I wouldn't bother with rust under any circumstance.
And in any case, I'm wondering about compiler-writing resources, not compilers.
I daresay you didn't even read what I wrote and just typed "hurr, Rust is good." I've seen a million comments like this, and it's largely the reason I'll never bother.
I think you didn't read what I wrote, did I say 'rust is good' ? I meant the rust compiler contains logic you are searching for. And you need to learn about being polite to people trying to help you.
I’ve always wondered if there’s a way to know at compile time whether a value is being mutated, rather than throwing a runtime exception.