rust/library/alloc/src
bors 4a86c7907b Auto merge of #96605 - Urgau:string-retain-codegen, r=thomcc
Improve codegen of String::retain method

This pull-request improve the codegen of the `String::retain` method.

Using `unwrap_unchecked` helps the optimizer to not generate a panicking path that will never be taken for valid UTF-8 like string.

Using `encode_utf8` saves us from an expensive call to `memcpy`, as the optimizer is unable to realize that `ch_len <= 4` and so can generate much better assembly code.

https://rust.godbolt.org/z/z73ohenfc
2022-05-21 01:56:51 +00:00
..
alloc Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
boxed Add ThinBox type for 1 stack pointer sized heap allocated trait objects 2022-04-08 09:00:16 -07:00
collections Warn on unused doc(hidden) on trait impl items 2022-05-08 22:53:14 +02:00
ffi Fix targets not supporting target_has_atomic = "ptr" 2022-04-14 21:53:11 +03:00
raw_vec Add a unit test for zero-sized types in RawVec. 2021-11-26 19:30:45 +11:00
rc Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
sync Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
vec Reverse condition in Vec::retain_mut doctest 2022-05-19 20:54:16 +02:00
alloc.rs Auto merge of #97033 - nbdd0121:unwind3, r=Amanieu 2022-05-19 04:04:40 +00:00
borrow.rs Rollup merge of #94022 - jongiddy:cow-into-owned-docs, r=Dylan-DPC 2022-04-26 13:22:26 +02:00
boxed.rs Add a dedicated length-prefixing method to Hasher 2022-05-06 00:03:38 -07:00
fmt.rs std::fmt: Improved list of formatting macros 2022-05-01 15:27:41 +02:00
lib.rs Apply CR suggestions; add real tracking issue 2022-05-11 17:16:25 -07:00
macros.rs Allow unused rules in some places in the compiler, library and tools 2022-05-05 19:13:00 +02:00
raw_vec.rs Remove some unnecessary rustc_allow_const_fn_unstable attributes. 2022-05-13 16:01:18 +10:00
rc.rs Rollup merge of #95843 - GuillaumeGomez:improve-new-cyclic-doc, r=m-ou-se 2022-05-05 15:43:02 +02:00
slice.rs Rename unsigned_offset_from to sub_ptr 2022-05-11 17:16:25 -07:00
str.rs trivial cfg(bootstrap) changes 2022-04-05 23:18:40 +02:00
string.rs Auto merge of #96605 - Urgau:string-retain-codegen, r=thomcc 2022-05-21 01:56:51 +00:00
sync.rs Auto merge of #95183 - ibraheemdev:arc-count-acquire, r=Amanieu 2022-05-06 14:53:24 +00:00
task.rs Document From implementations for Waker and RawWaker 2021-04-22 14:16:33 -07:00
tests.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00