Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #32977 - alexcrichton:ignore-panics, r=brson
std: Change String::truncate to panic less The `Vec::truncate` method does not panic if the length argument is greater than the vector's current length, but `String::truncate` will indeed panic. This semantic difference can be a bit jarring (e.g. #32717), and after some discussion the libs team concluded that although this can technically be a breaking change it is almost undoubtedly not so in practice. This commit changes the semantics of `String::truncate` to be a noop if `new_len` is greater than the length of the current string. Closes #32717
- Loading branch information