about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-16 23:06:29 -0700
committerbors <bors@rust-lang.org>2016-04-16 23:06:29 -0700
commitb5de94fba9a137a1128448f4b703250e7e8ff975 (patch)
tree57b28ae22fc683cd89d65477466375e335c09218 /src/liballoc_system
parent6892277cc030a9bc9931a644fffd3f420c41a6de (diff)
parentae79ce3f030db27aa7d35d1b22307fb4eba14f36 (diff)
downloadrust-b5de94fba9a137a1128448f4b703250e7e8ff975.tar.gz
rust-b5de94fba9a137a1128448f4b703250e7e8ff975.zip
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
Diffstat (limited to 'src/liballoc_system')
0 files changed, 0 insertions, 0 deletions