diff options
| author | bors <bors@rust-lang.org> | 2022-05-21 01:56:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-21 01:56:51 +0000 |
| commit | 4a86c7907b1e34d14d742fa4c4202626bb77eddc (patch) | |
| tree | ca6b724e0a8e3855c2168c58b4ad9796d7d59951 /compiler/rustc_codegen_gcc | |
| parent | e57884b6e96bede12447e21edcdc92fcac59ee46 (diff) | |
| parent | a98abe83eb42b2f537e8a2d7706ba08d9e296f31 (diff) | |
| download | rust-4a86c7907b1e34d14d742fa4c4202626bb77eddc.tar.gz rust-4a86c7907b1e34d14d742fa4c4202626bb77eddc.zip | |
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
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions
