about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-09 21:02:33 +0000
committerbors <bors@rust-lang.org>2022-10-09 21:02:33 +0000
commit1a7c203e7f89f92598a793c6f6406735c024e7ee (patch)
tree092e5362232165047754ef24ff91a0a242790bbf /compiler/rustc_codegen_llvm/src
parent81f391930301afbc121b7c468138069daa354bf8 (diff)
parentbb74f97445f04d68e42e7e308a109f78a2d2b0f7 (diff)
downloadrust-1a7c203e7f89f92598a793c6f6406735c024e7ee.tar.gz
rust-1a7c203e7f89f92598a793c6f6406735c024e7ee.zip
Auto merge of #89123 - the8472:push_in_capacity, r=amanieu
add Vec::push_within_capacity - fallible, does not allocate

This method can serve several purposes. It

* is fallible
* guarantees that items in Vec aren't moved
* allows loops that do `reserve` and `push` separately to avoid pulling in the allocation machinery a second time in the `push` part which should make things easier on the optimizer
* eases the path towards `ArrayVec` a bit since - compared to `push()` - there are fewer questions around how it should be implemented

I haven't named it `try_push` because that should probably occupy a middle ground that will still try to reserve and only return an error in the unlikely OOM case.

resolves #84649
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions