about summary refs log tree commit diff
path: root/src/liballoc/collections
AgeCommit message (Collapse)AuthorLines
2020-04-27Rollup merge of #71589 - RalfJung:unique-no-shr, r=SimonSapinDylan DPC-1/+1
remove Unique::from for shared pointer types r? @SimonSapin
2020-04-26remove Unique::from for shared pointer typesRalf Jung-1/+1
2020-04-26Rollup merge of #71575 - jplatte:patch-4, r=Mark-SimulacrumDylan DPC-1/+1
Fix stable(since) attribute for BTreeMap::remove_entry Stabilized in #70712. Maybe checking that the since attributes are added correctly should be automated through tidy? This is the third PR I'm opening that fixes a stable(since) attribute for something meant to be stabilized in 1.43 / 1.44 initially but then only stabilized in 1.45. (the other two are #71571, #71574)
2020-04-26Fix stable(since) attribute for BTreeMap::remove_entryJonas Platte-1/+1
2020-04-26fix more clippy warningsMatthias Krüger-2/+2
clippy::{redundant_pattern_matching, clone_on_copy, iter_cloned_collect, option_as_ref_deref, match_ref_pats}
2020-04-25Rollup merge of #71548 - crlf0710:cursor_bounds, r=AmanieuDylan DPC-0/+12
Add missing Send and Sync impls for linked list Cursor and CursorMut. Someone pointed out these to me, and i think it's indeed reasonable to add those impl. r? @Amanieu
2020-04-25Rollup merge of #71168 - SimonSapin:into_raw_non_null, r=AmanieuDylan DPC-9/+7
Deprecate `{Box,Rc,Arc}::into_raw_non_null` Per ongoing FCP at https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016 See also https://github.com/rust-lang/rust/issues/47336#issuecomment-614054164
2020-04-25Rollup merge of #70712 - :stabilize-remove-entry, r=AmanieuDylan DPC-2/+1
stabilize BTreeMap::remove_entry This PR stabilizes `BTreeMap::remove_entry` as implemented in https://github.com/rust-lang/rust/pull/68378. Closes https://github.com/rust-lang/rust/issues/66714
2020-04-25Use the correct bound for `Cursor` `Send`Charles Lew-1/+1
Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
2020-04-25Rollup merge of #71523 - Mark-Simulacrum:alloc-inline-dup, r=AmanieuDylan DPC-10/+7
Take a single root node in range_search The unsafe code can be justified within range_search, as it makes sure to not overlap the returned references, but from the callers perspective it's an entirely safe algorithm and there's no need for the caller to know about the duplication. cc @ssomers r? @Amanieu
2020-04-25Add missing Send and Sync bounds for linked list Cursor and CursorMut.Charles Lew-0/+12
2020-04-25Rollup merge of #71485 - arlopurcell:binary_heap_retain, r=AmanieuDylan DPC-0/+28
Add BinaryHeap::retain as suggested in #42849 This PR implements retain for BinaryHeap as suggested in #42849. This is my first PR for Rust, so please let me know if I should be doing anything differently, thanks!
2020-04-24Take a single root node in range_searchMark Rousskov-10/+7
The unsafe code can be justified within range_search, as it makes sure to not overlap the returned references, but from the callers perspective it's an entirely safe algorithm and there's no need for the caller to know about the duplication.
2020-04-24Rollup merge of #71476 - RalfJung:miri-test-sizes, r=kennytmDylan DPC-4/+2
more compact way to adjust test sizes for Miri Inspired by @dtolnay
2020-04-24Add BinaryHeap::retain as suggested in #42849arlo-0/+28
2020-04-23liballoc: more compact way to adjust test sizes for MiriRalf Jung-4/+2
2020-04-23Fix doc link errorsTyler Ruckinger-1/+1
2020-04-22More diagnostic items for Clippy usagePhilipp Hansch-0/+1
This adds a couple of more diagnostic items to be used in Clippy. I chose these particular ones because they were the types which we seem to check for the most in Clippy. I'm not sure if the `cfg_attr(not(test))` is needed, but it was also used for `Vec` and a few other types.
2020-04-17Rollup merge of #71167 - RalfJung:big-o, r=shepmasterDylan DPC-29/+28
big-O notation: parenthesis for function calls, explicit multiplication I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing. This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here. While I was at it I also added backticks consistently.
2020-04-17Implement `Clone` for `liballoc::collections::linked_list::Cursor`.Charles Lew-0/+8
2020-04-17Rollup merge of #71220 - cuviper:std_or_patterns, r=Mark-SimulacrumDylan DPC-6/+1
Dogfood or_patterns in the standard library We can start using `or_patterns` in the standard library as a step toward stabilization. cc #54883 @Centril
2020-04-16Minor fixes to doc comments of 'VecDequeue'Youngsuk Kim-6/+6
1. Changed descriptions of `fn get` & `fn get_mut`. Since both of these functions are returning references, and not the owned value, I thought the doc comments could be fixed to be consistent with doc comments of `fn front` & `fn front_mut`. 2. Other changes are minor fixes or additions for clarification. Thank you for taking a look :)
2020-04-16Dogfood or_patterns in the standard libraryJosh Stone-6/+1
2020-04-15don't specify log base in big-ORalf Jung-3/+3
2020-04-15Deprecate `Box::into_raw_non_null`Simon Sapin-9/+7
Per https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
2020-04-15big-O notation: parenthesis, multiplication and backticksRalf Jung-28/+27
2020-04-11Rollup merge of #70996 - ChaiTRex:master, r=AmanieuDylan DPC-0/+28
Add or_insert_with_key to Entry of HashMap/BTreeMap Going along with `or_insert_with`, `or_insert_with_key` provides the `Entry`'s key to the lambda, avoiding the need to either clone the key or the need to reimplement this body of this method from scratch each time. This is useful when the initial value for a map entry is derived from the key. For example, the introductory Rust book has an example Cacher struct that takes an expensive-to-compute lambda and then can, given an argument to the lambda, produce either the cached result or execute the lambda. --- I'm fairly new to Rust, so any optimizations, corrections to types, better names, better documentation, or whatever else would be appreciated. I'd like to thank Arnavion on freenode for helping me to implement a very similar method when I found that `or_insert_with_key` was unavailable. As a somewhat-related note, this implements https://github.com/rust-lang/rfcs/issues/1202 from 2015, so if this pull request is accepted, that should be closed.
2020-04-11Change issue number to point to tracking issueChai T. Rex-1/+1
2020-04-10Fixed doc tests for added methodsChai T. Rex-0/+1
2020-04-10Add or_insert_with_key to Entry of HashMap/BTreeMapChai T. Rex-0/+27
Going along with or_insert_with, or_insert_with_key provides the Entry's key to the lambda, avoiding the need to either clone the key or the need to reimplement this body of this method from scratch each time. This is useful when the initial value for a map entry is derived from the key. For example, the introductory Rust book has an example Cacher struct that takes an expensive-to-compute lambda and then can, given an argument to the lambda, produce either the cached result or execute the lambda.
2020-04-10Rollup merge of #70981 - ssomers:btreemap_into_into_iter, r=Mark-SimulacrumMazdak Farrokhzad-13/+13
Rearrange BTreeMap::into_iter to match range_mut. r? @Mark-Simulacrum I wondered why you catered for the optional root differently in `into_iter` than in `range_mut`.
2020-04-10Rollup merge of #70979 - ssomers:btreemap_the_alice_merton_variations, r=AmanieuMazdak Farrokhzad-4/+2
Follow up on BTreeMap comments r? @Amanieu (for the first commit)
2020-04-10Rollup merge of #70843 - ssomers:btree_drain_filter_epilogue, r=AmanieuMazdak Farrokhzad-45/+21
Remove the Ord bound that was plaguing drain_filter Now that #70795 made it superfluous. Also removes superfluous lifetime specifiers (at least I think they are).
2020-04-10Rearrange BTreeMap::into_iter to match range_mut.Stein Somers-13/+13
2020-04-09Respect the comment: no root unless the borrow type is `Mut`Stein Somers-2/+2
2020-04-09Kill comment left behind by a last minute change in #70795Stein Somers-2/+0
2020-04-08Rollup merge of #70930 - lcnr:patch-1, r=Dylan-DPCDylan DPC-1/+1
add tracking issue to `VecDeque::make_contiguous` The tracking issue is https://github.com/rust-lang/rust/issues/70929
2020-04-08add `VecDeque::make_contiguous` tracking issueBastian Kauschke-1/+1
2020-04-06BTreeMap first/last: add pop methodsStein Somers-0/+48
2020-04-06BTreeMap first/last: make examples more to the pointStein Somers-10/+12
2020-04-06BTreeMap first/last: simplify implementationsStein Somers-38/+16
2020-04-06Remove the Ord bound that was plaguing drain_filter, and superfluous lifetimesStein Somers-45/+21
2020-04-05Rollup merge of #70795 - Amanieu:btree_remove_tracking, r=Mark-SimulacrumDylan DPC-49/+64
Keep track of position when deleting from a BTreeMap This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap. cc @ssomers r? @Mark-Simulacrum
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-1/+0
Don't import integer and float modules, use assoc consts Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now. This PR is a follow up of #69860 which made sure we use the new constants in documentation. This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step. r? @dtolnay
2020-04-05Apply review feedbackAmanieu d'Antras-15/+10
2020-04-05Keep track of position when deleting from a BTreeMapAmanieu d'Antras-39/+59
This improves the performance of drain_filter and is needed for future Cursor support for BTreeMap.
2020-04-05Stop importing integer modules in liballocLinus Färnstrand-1/+0
2020-04-04use ManuallyDrop instead of forget inside collectionsTrevor Spiteri-14/+13
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-02stabilize BTreeMap::remove_entryDutchGhost-2/+1
2020-04-02Auto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieubors-4/+5
Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2 GitHub won't let me reopen #69889 so I make a new PR. In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified. r? @Amanieu fixes rust-lang/wg-allocators#38 fixes rust-lang/wg-allocators#41 fixes rust-lang/wg-allocators#44 fixes rust-lang/wg-allocators#51