about summary refs log tree commit diff
path: root/src/liballoc/raw_vec.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-536/+0
2020-07-03Auto merge of #73882 - nnethercote:avoid-unwrap_or_else-in-allocate_in, ↵bors-3/+14
r=Amanieu Avoid `unwrap_or_else` in `RawVec::allocate_in`. This reduces the amount of LLVM IR generated by up to 1 or 2%. r? @Amanieu
2020-06-30Avoid `unwrap_or_else` in `RawVec::allocate_in`.Nicholas Nethercote-3/+14
This reduces the amount of LLVM IR generated by up to 1 or 2%.
2020-06-29Auto merge of #73391 - pickfire:liballoc-panic-doc, r=Mark-Simulacrumbors-9/+3
Add liballoc doc panic detail according to RawVec
2020-06-27Add liballoc doc panic detail according to RawVecIvan Tham-9/+3
2020-06-23Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisaManish Goregaokar-1/+1
A way forward for pointer equality in const eval r? @varkor on the first commit and @RalfJung on the second commit cc #53020
2020-06-20Satisfy tidyOliver Scherer-1/+1
2020-06-19`#[deny(unsafe_op_in_unsafe_fn)]` in liballocLeSeulArtichaut-4/+6
2020-06-09Rename some identifiers in `RawVec` and `libarena`.Nicholas Nethercote-49/+32
- Use `len` more consistently for the number of elements in a vector, because that's the usual name. - Use `additional` more consistently for the number of elements we want to add, because that's what `Vec::reserve()` uses. - Use `cap` consistently rather than `capacity`. - Plus a few other tweaks. This increases consistency and conciseness.
2020-06-09Remove `RawVec::reserve_in_place`.Nicholas Nethercote-39/+6
Also remove a now-unnecessary `placement` argument.
2020-05-31Merge raw_vec into_box with previous impl<T, Global>Ivan Tham-26/+24
There are two separate `impl<T, Global>` which no special reason, it would be better to merge both of them.
2020-05-29Fix grammar in liballoc raw_vecIvan Tham-1/+1
2020-05-20Adjust the zero check in `RawVec::grow`.Nicholas Nethercote-4/+3
This was supposed to land as part of #72227. (I wish `git push` would abort when you have uncommited changes.)
2020-05-18Tiny Vecs are dumb.Nicholas Nethercote-4/+25
Currently, if you repeatedly push to an empty vector, the capacity growth sequence is 0, 1, 2, 4, 8, 16, etc. This commit changes the relevant code (the "amortized" growth strategy) to skip 1 and 2 in most cases, instead using 0, 4, 8, 16, etc. (You can still get a capacity of 1 or 2 using the "exact" growth strategy, e.g. via `reserve_exact()`.) This idea (along with the phrase "tiny Vecs are dumb") comes from the "doubling" growth strategy that was removed from `RawVec` in #72013. That strategy was barely ever used -- only when a `VecDeque` was grown, oddly enough -- which is why it was removed in #72013. (Fun fact: until just a few days ago, I thought the "doubling" strategy was used for repeated push case. In other words, this commit makes `Vec`s behave the way I always thought they behaved.) This change reduces the number of allocations done by rustc itself by 10% or more. It speeds up rustc, and will also speed up any other Rust program that uses `Vec`s a lot.
2020-05-12Split `RawVec::grow` up.Nicholas Nethercote-50/+79
The amortized case is much more common than the exact case, and it is typically instantiated many times. Also, we can put a chunk of the code into a function that isn't generic over T, which reduces the amount of LLVM IR generated quite a lot, improving compile times.
2020-05-12Remove `RawVec::double`.Nicholas Nethercote-82/+9
It's only used once, for `VecDeque`, and can easily be replaced by something else. The commit changes `grow_if_necessary` to `grow` to avoid some small regressions caused by changed inlining. The commit also removes `Strategy::Double`, and streamlines the remaining variants of `Strategy`. It's a compile time win on some benchmarks because the many instantations of `RawVec::grow` are a little smaller.
2020-05-12Remove `RawVec::double_in_place`.Nicholas Nethercote-18/+0
It's unused.
2020-04-30rename-unique: Rename Unique::empty() to Unique::dangling()cohenarthur-5/+5
rename-unique: Change calls and doc in raw_vec.rs rename-unique: Change empty() -> dangling() in const-ptr-unique-rpass.rs
2020-04-26remove Unique::from for shared pointer typesRalf Jung-2/+2
2020-04-06Use usize::MAX as assoc const in liballocLinus Färnstrand-1/+1
2020-04-05clarify safety in RawVec::into_boxRalf Jung-3/+6
2020-04-04use ManuallyDrop instead of forget inside collectionsTrevor Spiteri-9/+7
This commit changes some usage of mem::forget into mem::ManuallyDrop in some Vec, VecDeque, BTreeMap and Box methods. Before the commit, the generated IR for some of the methods was longer, and even after optimization, some unwinding artifacts were still present.
2020-04-01Add missing allocation guard in `RawVec::grow`Tim Diekmann-0/+1
2020-03-28Make fields in `MemoryBlock` publicTim Diekmann-4/+4
2020-03-26Remove alignment from `MemoryBlock`Tim Diekmann-23/+19
2020-03-26Fix safety section of `RawVec::into_box`Tim Diekmann-1/+2
2020-03-26Fix wording in `RawVec::from_raw_parts(_in)`Tim Diekmann-2/+2
2020-03-26Remove check for ZST in `RawVec::needs_to_grow`Tim Diekmann-2/+1
2020-03-26Refine docs for `RawVec::from_raw_parts(_in)`Tim Diekmann-4/+6
2020-03-26Remove the note on the internal capacity field in `RawVec`Tim Diekmann-3/+1
2020-03-26Fix assertion in `shrink` to use `capacity()` insteadTim Diekmann-1/+1
2020-03-26Fix comment in `RawVec::into_box()`Tim Diekmann-1/+1
2020-03-26Fix ZST handling for `RawVec`Tim Diekmann-6/+6
2020-03-26Fix issues from review and unsoundness of `RawVec::into_box`Tim Diekmann-114/+114
2020-03-26Overhaul of the `AllocRef` trait to match allocator-wg's latest consensTim Diekmann-347/+221
2020-03-08Allow ZSTs in `AllocRef`Tim Diekmann-20/+18
2020-03-03Remove `usable_size` APIsTim Diekmann-8/+13
2020-02-10Remove common usage pattern from `AllocRef`Tim Diekmann-6/+7
2020-01-27Rename `Alloc` to `AllocRef`Tim Diekmann-8/+8
2019-12-22Format the worldMark Rousskov-71/+55
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-12-18no need to bootstrapMark Mansi-8/+1
2019-12-18add fixmeMark Mansi-0/+1
2019-12-18fix importMark Mansi-1/+1
2019-12-18use usize::MAX instead of !0Mark Mansi-1/+1
2019-12-18remove a bit more hackeryMark Mansi-41/+8
2019-12-18Remove a const-if-hack in RawVecMark Mansi-8/+32
2019-09-16Const-stabilize `Vec::new`.Mazdak Farrokhzad-1/+26
2019-09-14Update src/liballoc/raw_vec.rsAlexander Regueiro-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-06A few cosmetic improvements to code & comments in liballoc and libcoreAlexander Regueiro-76/+74