In the standard library in Rust before 1.52.0, there is an optimization for joining strings that can cause uninitialized bytes to be exposed (or the program to crash) if the borrowed string changes after its length is checked.
https://github.com/rust-lang/rust/pull/81728#issuecomment-824904190
https://github.com/rust-lang/rust/pull/81728#issuecomment-821549174