about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2020-08-13Stop BTreeMap casts from reborrowingStein Somers-20/+16
2020-08-13Add Arc::new_cyclicDPC-4/+148
2020-08-12Rollup merge of #75424 - joseluis:patch-1, r=joshtriplettYuki Okushi-1/+1
fix wrong word in documentation Change "two" to "three", since there are three significantly different things printed below that sentence: --- While these: ```rust println!("{}, `{name:.*}` has 3 fractional digits", "Hello", 3, name=1234.56); println!("{}, `{name:.*}` has 3 characters", "Hello", 3, name="1234.56"); println!("{}, `{name:>8.*}` has 3 right-aligned characters", "Hello", 3, name="1234.56"); ``` print two significantly different things: ``` rust Hello, `1234.560` has 3 fractional digits Hello, `123` has 3 characters Hello, ` 123` has 3 right-aligned characters ``` --- [`https://doc.rust-lang.org/std/fmt/#precision`](https://doc.rust-lang.org/std/fmt/#precision)
2020-08-12Somewhat complicated way to respect BTreeMap's node length invariantStein Somers-16/+65
2020-08-11word changeJosé Luis Cruz-1/+1
there are three significantly different things printed below
2020-08-11Fix range term in alloc vec docIvan Tham-1/+1
`range` is not an element, it is a variable.
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-10Liballoc DoubleEndedIterator limit unsafe to pointer arithmethicIvan Tham-15/+11
2020-08-10Liballoc IntoIter limit unsafe to pointer arithmethicIvan Tham-18/+14
2020-08-10Liballoc tweak use *const T instead of *const i8Ivan Tham-1/+1
*const T is also used in the same parts and also used for arith_offset.
2020-08-09BTreeMap: better distinguish the root holder from the root nodeStein Somers-42/+51
2020-08-09Rollup merge of #75151 - pickfire:patch-4, r=LukasKalbertodtYuki Okushi-4/+6
Consistent variable name alloc for raw_vec
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-05Add {Box,Rc,Arc}::new_zeroed_sliceAmos Onn-0/+91
2020-08-05Use alloc_zeroed in {Rc,Arc}::new_zeroedAmos Onn-30/+48
2020-08-04Replace `Memoryblock` with `NonNull<[u8]>`Tim Diekmann-40/+45
2020-08-04Consistent variable name alloc for raw_vecIvan Tham-4/+6
2020-08-04Auto merge of #74850 - TimDiekmann:remove-in-place-alloc, r=Amanieubors-106/+123
Remove in-place allocation and revert to separate methods for zeroed allocations closes rust-lang/wg-allocators#58
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-03Auto merge of #74827 - ssomers:btree_cleanup_insert, r=Mark-Simulacrumbors-37/+70
Move bulk of BTreeMap::insert method down to new method on handle Adjust the boundary between the map and node layers for insertion: do more in the node layer, keep root manipulation and pointer dereferencing separate. No change in undefined behaviour or performance. r? @Mark-Simulacrum
2020-08-03Merge branch 'master' into remove-in-place-allocTim Diekmann-238/+191
2020-08-02Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPCManish Goregaokar-2/+2
fix typos Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
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-02fix typosliuzhenyu-2/+2
2020-08-02Auto merge of #75033 - Manishearth:rollup-d8afil1, r=Manishearthbors-1/+42
Rollup of 5 pull requests Successful merges: - #74602 (Clarify the doc for MaybeUninit::zeroed on incorrect use) - #74720 (Clean up E0728 explanation) - #74992 (fix rustdoc generic param order) - #75015 (Add Vec::spare_capacity_mut) - #75022 (Use a slice pattern instead of rchunks_exact(_).next()) Failed merges: r? @ghost
2020-08-01Auto merge of #74605 - rust-lang:vec-leak, r=Amanieubors-6/+4
Stabilize Vec::leak as a method Closes https://github.com/rust-lang/rust/issues/62195 The signature is changed to a method rather than an associated function: ```diff -pub fn leak<'a>(vec: Vec<T>) -> &'a mut [T] +pub fn leak<'a>(self) -> &'a mut [T] ``` The reason for `Box::leak` not to be a method (`Deref` to an arbitrary `T` which might have its own, different `leak` method) does not apply.
2020-08-01BTreeMap::drain_filter no longer touches the root during iterationStein Somers-30/+73
2020-08-01Add Vec::spare_capacity_mutAmanieu d'Antras-1/+42
2020-08-01Define forget_type only when relevantStein Somers-8/+16
2020-08-01Auto merge of #74373 - lcnr:array_chunks, r=withoutboatsbors-0/+3
add `slice::array_chunks` to std Now that #74113 has landed, these methods are suddenly usable. A rebirth of #72334 Tests are directly copied from `chunks_exact` and some additional tests for type inference. r? @withoutboats as you are both part of t-libs and working on const generics. closes #60735
2020-08-01add tracking issueBastian Kauschke-1/+1
2020-08-01Rollup merge of #74644 - crlf0710:drop_old_stuff, r=AmanieuYuki Okushi-62/+10
Remove `linked_list_extras` methods. Removing these in favor of the `Cursor` API in https://github.com/rust-lang/rust/issues/58533 . Closes #27794. r? @Amanieu
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