about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-21 03:47:29 +0000
committerbors <bors@rust-lang.org>2023-07-21 03:47:29 +0000
commit1a44b45987a56dc1bbb4fc8327aa46efa58d5eaa (patch)
treefb724f21291cf50169abc46f0022a7459b887c75 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parentd26f0b79d57a4e688e8fdee1e22818a0a71ab0de (diff)
parent6ffca76e9b9bbc7757d2167cdf07c193e357d69c (diff)
downloadrust-1a44b45987a56dc1bbb4fc8327aa46efa58d5eaa.tar.gz
rust-1a44b45987a56dc1bbb4fc8327aa46efa58d5eaa.zip
Auto merge of #113106 - marcospb19:improve-path-with-extension-function, r=thomcc
std: remove an allocation in `Path::with_extension`

`Path::with_extension` used to reallocate (and copy) paths twice per call, now it does it once, by checking the size of the previous and new extensions it's possible to call `PathBuf::with_capacity` and pass the exact capacity required.

This also reduces the memory consumption of the path returned from `Path::with_extension` by using exact capacity instead of using amortized exponential growth.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions