rust/library/alloc/src
bors 1a7c203e7f 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
2022-10-09 21:02:33 +00:00
..
alloc Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
boxed remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
collections Fix overconstrained Send impls in btree internals 2022-10-05 12:16:32 -07:00
ffi remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
raw_vec Add a unit test for zero-sized types in RawVec. 2021-11-26 19:30:45 +11:00
rc Use Box::new() instead of box syntax in alloc tests 2022-05-29 00:41:14 +02:00
sync add some Miri-only tests 2022-08-18 18:07:39 -04:00
vec Auto merge of #89123 - the8472:push_in_capacity, r=amanieu 2022-10-09 21:02:33 +00:00
alloc.rs Adjust cfgs 2022-08-12 16:28:15 -04:00
borrow.rs Intra-doc-link-ify reference to Clone::clone_from 2022-07-08 22:47:07 +02:00
boxed.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
fmt.rs remove useless cold 2022-05-29 20:40:56 +01:00
lib.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
macros.rs Extra documentation for new formatting feature 2022-08-21 15:28:27 -04:00
raw_vec.rs Make ZST checks in core/alloc more readable 2022-09-22 23:12:29 -07:00
rc.rs Fix a typo in docstring 2022-09-17 13:58:53 +09:00
slice.rs Auto merge of #102169 - scottmcm:constify-some-conditions, r=thomcc 2022-09-25 01:20:11 +00:00
str.rs Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-Simulacrum 2022-08-22 11:45:40 +05:30
string.rs remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
sync.rs Rollup merge of #98218 - kpreid:nostdarc, r=joshtriplett 2022-10-03 20:58:53 +02:00
task.rs Document the conditional existence of alloc::sync and alloc::task. 2022-06-17 20:03:23 -07:00
tests.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00