Why is this necessarily true? All Rust gives you is safety -- no data races and better memory safety. But since data races and use-after-free are undefined behavior in C++ anyway, C++ compilers can still aggressively optimize by assuming those two don't happen.
It's true that some compilers disable optimizations on certain undefined behavior to prevent unintuitive behavior (https://blog.regehr.org/archives/140) but that's unlikely to happen for data races or memory safety.