about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2020-08-22Reduce duplicate in liballoc reserve error handlingIvan Tham-15/+13
2020-08-22Rollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514Dylan DPC-223/+116
Use intra-doc-links in `alloc` I didn't have time to test this, so I will let the CI do it for me. r? @jyn514 cc #75080
2020-08-21Update rc.rsamosonn-1/+1
2020-08-21Apply suggestions from code reviewLeSeulArtichaut-14/+6
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-21Use intra-doc-links in `alloc`LeSeulArtichaut-220/+121
2020-08-20Rollup merge of #75672 - kofls:intradoc-fix, r=jyn514Josh Stone-48/+30
Move to intra-doc links for task.rs and vec.rs Partial fix for #75080 links for [`get`], [`get_mut`] skipped due to #75643 link for [`copy_from_slice`] skipped due to #63351
2020-08-20Assume same alignment in `RawVec`Tim Diekmann-1/+6
2020-08-20Add debug assertion for equal alignment in RawVecTim Diekmann-0/+1
2020-08-19BTreeMap: introduce marker::ValMut and reserve marker::Mut for unique accessStein Somers-171/+319
2020-08-19Auto merge of #75480 - ssomers:btree_check_invariant, r=Mark-Simulacrumbors-41/+302
BTreeMap: check some invariants in unit tests
2020-08-19Apply suggestions from code reviewSurya Midatala-13/+12
2020-08-19Allow reallocation to different alignmentTim Diekmann-41/+61
2020-08-19Auto merge of #75677 - cuviper:shrink-towel, r=Mark-Simulacrumbors-1/+4
Don't panic in Vec::shrink_to_fit We can help the compiler see that `Vec::shrink_to_fit` will never reach the panic case in `RawVec::shrink_to_fit`, just by guarding the call only for cases where the capacity is strictly greater. A capacity less than the length is only possible through an unsafe call to `set_len`, which would break the `Vec` invariants, so `shrink_to_fit` can just ignore that. This removes the panicking code from the examples in both #71861 and #75636.
2020-08-18Don't panic in Vec::shrink_to_fitJosh Stone-1/+4
2020-08-18Move to intra-doc links for task.rs and vec.rsSurya Midatala-36/+19
2020-08-18Make `grow_impl` unsafeTim Diekmann-3/+6
2020-08-18BTreeMap: check some invariants, avoid recursion in depth first searchStein Somers-41/+302
2020-08-18Clean up AllocRef implementation and documentationTim Diekmann-74/+71
2020-08-17Fix typo in commentTim Diekmann-2/+2
2020-08-17Remove fast path in reallocation for same layout sizesTim Diekmann-17/+10
2020-08-16Replace ad hoc implementations with `slice::check_range`dylni-71/+20
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-15tidy upDPC-23/+23
2020-08-14Rollup merge of #75531 - ssomers:btree_tests_migration, r=Mark-SimulacrumTyler Mandry-0/+2176
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/+37
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-14Rollup merge of #74185 - pickfire:liballoc-iter-doc, r=jyn514Tyler Mandry-12/+3
Remove liballoc unneeded explicit link
2020-08-14Move btree unit test to their native, privileged locationStein Somers-0/+2176
2020-08-14BTreeMap: refactor splitpoint and move testing over to unit testStein Somers-31/+37
2020-08-14BTreeMap: refactor splitpoint and move testing over to unit testStein Somers-31/+37
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-14Update liballoc vec doc linkIvan Tham-8/+3
2020-08-14Update src/liballoc/vec.rsIvan Tham-1/+0
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-14Remove liballoc unneeded explicit linkIvan Tham-3/+0
2020-08-14add missing newlineDPC-1/+1
2020-08-14fix duplicated feature gateDPC-1/+0
2020-08-13Auto merge of #75105 - ssomers:btree_respect_min_len_hard, r=Mark-Simulacrumbors-16/+65
Hard way to respect BTreeMap's minimum node length Resolves #74834 the hard way (though not the hardest imaginable). Benchmarks (which are all biased/realistic, inserting keys in ascending order) say: ``` benchcmp r0 r1 --threshold 10 name r0 ns/iter r1 ns/iter diff ns/iter diff % speedup btree::map::clone_slim_100_and_clear 2,183 2,723 540 24.74% x 0.80 btree::map::clone_slim_100_and_drain_all 3,652 4,173 521 14.27% x 0.88 btree::map::clone_slim_100_and_drain_half 3,320 3,940 620 18.67% x 0.84 btree::map::clone_slim_100_and_into_iter 2,154 2,717 563 26.14% x 0.79 btree::map::clone_slim_100_and_pop_all 3,372 3,870 498 14.77% x 0.87 btree::map::clone_slim_100_and_remove_all 5,111 5,647 536 10.49% x 0.91 btree::map::clone_slim_100_and_remove_half 3,259 3,821 562 17.24% x 0.85 btree::map::iter_0 1,733 1,509 -224 -12.93% x 1.15 btree::map::iter_100 2,714 3,739 1,025 37.77% x 0.73 btree::map::iter_10k 3,728 4,269 541 14.51% x 0.87 btree::map::range_unbounded_unbounded 28,426 36,631 8,205 28.86% x 0.78 btree::map::range_unbounded_vs_iter 28,808 34,056 5,248 18.22% x 0.85 ``` This difference is not caused by the `debug_assert`-related code in the function `splitpoint`, it's the same without.
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-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.