about summary refs log tree commit diff
path: root/library/alloc/src/collections
AgeCommit message (Collapse)AuthorLines
2020-08-24Add more information to safety commentdylni-1/+3
2020-08-23Prefer https link for wikipedia URLsLzu Tao-3/+3
2020-08-21Apply suggestions from code reviewLeSeulArtichaut-6/+2
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-21Use intra-doc-links in `alloc`LeSeulArtichaut-7/+4
2020-08-19BTreeMap: introduce marker::ValMut and reserve marker::Mut for unique accessStein Somers-171/+319
2020-08-18BTreeMap: check some invariants, avoid recursion in depth first searchStein Somers-41/+302
2020-08-16Replace ad hoc implementations with `slice::check_range`dylni-26/+11
2020-08-15Auto merge of #75488 - ssomers:btree_revert_75257, r=Mark-Simulacrumbors-49/+20
Revert the fundamental changes in #74762 and #75257 Before possibly going over to #75487. Also contains some added and fixed comments. r? @Mark-Simulacrum
2020-08-14Rollup merge of #75531 - ssomers:btree_tests_migration, r=Mark-SimulacrumTyler Mandry-0/+2173
Migrate unit tests of btree collections to their native breeding ground There's one BTreeSet test case that I couldn't easily convince to come along, maybe because it truly is an integration test. But leaving it in place would mean git wouldn't see the move so I also moved it to a new file. r? @Mark-Simulacrum
2020-08-14Rollup merge of #75519 - ssomers:btree_splitpoint_cleanup, r=Mark-SimulacrumTyler Mandry-31/+36
BTreeMap: refactor splitpoint and move testing over to unit test r? @Mark-Simulacrum
2020-08-14Rollup merge of #75195 - ssomers:btree_split_up_into_kv_mut, r=Mark-SimulacrumTyler Mandry-9/+19
BTreeMap: purge innocent use of into_kv_mut Replace the use of `into_kv_mut` into more precise calls. This makes more sense if you know that the single remaining use of `into_kv_mut` is in fact evil and can be trialled in court (#75200) and sent to a correction facility (#73971). No real performance difference reported (but functions that might benefit a tiny constant bit like `BTreeMap::get_mut` aren't benchmarked): ``` benchcmp old new --threshold 5 name old ns/iter new ns/iter diff ns/iter diff % speedup btree::map::clone_fat_100 63,073 59,256 -3,817 -6.05% x 1.06 btree::map::iter_100 3,514 3,235 -279 -7.94% x 1.09 ```
2020-08-14Move btree unit test to their native, privileged locationStein Somers-0/+2173
2020-08-14BTreeMap: refactor splitpoint and move testing over to unit testStein Somers-31/+36
2020-08-14BTreeMap: refactor splitpoint and move testing over to unit testStein Somers-31/+36
2020-08-14Auto merge of #74777 - ssomers:btree_cleanup_7, r=Mark-Simulacrumbors-20/+16
Stop BTreeMap casts from reborrowing Down in btree/node.rs, the interface and use of `cast_unchecked` look a bit shady. It's really just there for inverting `forget_type` which does not borrow. By borrowing we can't write the same `cast_unchecked` in the same way at the Handle level. No change in undefined behaviour or performance.
2020-08-13Reverts the fundamental changes in #74762 and #75257Stein Somers-49/+20
2020-08-13Stop BTreeMap casts from reborrowingStein Somers-20/+16
2020-08-12Somewhat complicated way to respect BTreeMap's node length invariantStein Somers-16/+65
2020-08-11BTreeMap: purge innocent use of into_kv_mutStein Somers-9/+19
2020-08-10Manually implement Debug for BTreeMap::ValuesMut structNazım Can Altınova-1/+24
Deriving debug prints all the values including keys. But ValuesMut struct should only print the values.
2020-08-10Manually implement Debug for BTreeMap::{IntoKeys,IntoValues} structsNazım Can Altınova-6/+27
2020-08-09BTreeMap: better distinguish the root holder from the root nodeStein Somers-42/+51
2020-08-08Auto merge of #75163 - canova:map_into_keys_values, r=dtolnaybors-0/+148
Implement `into_keys` and `into_values` for associative maps This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature. Fixes #55214. r? @dtolnay
2020-08-08Update the tracking issue number of map_into_keys_valuesNazım Can Altınova-12/+12
2020-08-08Remove min/max values from IntoValues Iterator implementationNazım Can Altınova-8/+0
2020-08-08Auto merge of #75257 - ssomers:btree_74762_again, r=Mark-Simulacrumbors-32/+25
BTreeMap: better way to postpone root access in DrainFilter A slightly more elegant (in my opinion) adaptation of #74762. Benchmarks seem irrationally pleased to: ``` benchcmp old new --threshold 5 name old ns/iter new ns/iter diff ns/iter diff % speedup btree::map::clone_fat_100_and_remove_all 215,182 185,052 -30,130 -14.00% x 1.16 btree::map::clone_fat_100_and_remove_half 139,667 127,945 -11,722 -8.39% x 1.09 btree::map::clone_fat_val_100_and_remove_all 96,755 81,279 -15,476 -16.00% x 1.19 btree::map::clone_fat_val_100_and_remove_half 64,678 56,911 -7,767 -12.01% x 1.14 btree::map::find_rand_100 18 17 -1 -5.56% x 1.06 btree::map::first_and_last_0 33 35 2 6.06% x 0.94 btree::map::first_and_last_100 40 54 14 35.00% x 0.74 btree::map::insert_rand_100 45 42 -3 -6.67% x 1.07 btree::map::insert_rand_10_000 45 41 -4 -8.89% x 1.10 btree::map::iter_0 2,010 1,759 -251 -12.49% x 1.14 btree::map::iter_100 3,514 2,764 -750 -21.34% x 1.27 btree::map::iter_10k 4,018 3,768 -250 -6.22% x 1.07 btree::map::range_unbounded_unbounded 37,269 28,929 -8,340 -22.38% x 1.29 btree::map::range_unbounded_vs_iter 31,518 28,814 -2,704 -8.58% x 1.09 ``` r? @Mark-Simulacrum
2020-08-07Auto merge of #75071 - ssomers:btree_cleanup_5, r=Mark-Simulacrumbors-53/+51
BTreeMap: enforce the panic rule imposed by `replace` Also, reveal the unsafe parts in the closures fed to it. r? @Mark-Simulacrum
2020-08-07BTreeMap: enforce the panic rule imposed by `replace`Stein Somers-53/+51
2020-08-07BTreeMap: better way to postpone root access in DrainFilterStein Somers-32/+25
2020-08-07Change the comment of BTreeMap::into_valuesNazım Can Altınova-1/+1
2020-08-07Add `into_{keys,values}` methods for BTreeMapNazım Can Altınova-0/+156
2020-08-05Make IntoIterator lifetime bounds of &BTreeMap match with &HashMapNazım Can Altınova-2/+2
2020-08-04Auto merge of #75058 - ssomers:btree_cleanup_insert_2, r=Mark-Simulacrumbors-44/+42
Clarify reuse of a BTreeMap insert support function and treat split support likewise r? @Mark-Simulacrum
2020-08-02Separate off a leafy insert function instead of lying, and split split similarlyStein Somers-44/+42
2020-08-02Move bulk of BTreeMap::insert method down to new method on handleStein Somers-37/+70
2020-08-03Rollup merge of #74974 - RalfJung:miri-tests, r=Mark-SimulacrumYuki Okushi-6/+11
Make tests faster in Miri Reduce some test iteration counts in Miri.
2020-08-03Rollup merge of #74874 - ssomers:btree_cleanup_8, r=Mark-SimulacrumYuki Okushi-8/+16
BTreeMap: define forget_type only when relevant Similar to `forget_node_type` for handles. No effect on generated code, apart maybe from the superfluous calls that might not have been optimized away. r? @Mark-Simulacrum
2020-08-03Rollup merge of #74762 - ssomers:btree_no_root_in_remove_kv_tracking, ↵Yuki Okushi-30/+73
r=Mark-Simulacrum BTreeMap::drain_filter should not touch the root during iteration Although Miri doesn't point it out, I believe there is undefined behaviour using `drain_filter` when draining the 11th-last element from a tree that was larger. When this happens, the last remaining child nodes are merged, the root becomes empty and is popped from the tree. That last step establishes a mutable reference to the node elected root and writes a pointer in `node::Root`, while iteration continues to visit the same node. This is mostly code from #74437, slightly adapted.
2020-08-03Rollup merge of #74686 - ssomers:btree_cleanup_3, r=Mark-SimulacrumYuki Okushi-10/+3
BTreeMap: remove into_slices and its unsafe block A small tweak to make BTreeMap code shorter and less unsafe. r? @Mark-Simulacrum
2020-08-01BTreeMap::drain_filter no longer touches the root during iterationStein Somers-30/+73
2020-08-01Define forget_type only when relevantStein Somers-8/+16
2020-08-01Remove `linked_list_extras` methods.Charles Lew-62/+10
2020-07-31make some vec_deque tests less exhaustive in MiriRalf Jung-6/+11
2020-07-28Remove into_slices and its unsafe blockStein Somers-10/+3
2020-07-28Stabilize deque_make_contiguousJon Gjengset-5/+8
Closes #70929.
2020-07-27mv std libs to library/mark-0/+13998