The underlying compiler backend would use the same alias optimization pass for both Rust and C. Rust's advantages here are that all Rust code is automatically eligible for such optimization without the programmer having to do any work at all, and whereas a programmer can get `restrict` usage wrong (or alternately fail to have the confidence that a given pointer is truly unaliasable), the Rust compiler has perfect information.
To be fair, there are also optimizations that C can do that Rust can't, often resulting from C's undefined behavior.
To be fair, there are also optimizations that C can do that Rust can't, often resulting from C's undefined behavior.