about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2020-09-25BTreeMap: various tweaksStein Somers-61/+50
2020-09-25BTreeMap: introduce edge methods similar to those of keys and valuesStein Somers-24/+34
2020-09-25BTreeMap: refactor correct_childrens_parent_linksStein Somers-26/+16
2020-09-25Rollup merge of #77079 - poliorcetics:more-self-in-docs, r=jyn514Jonas Schievink-2/+2
Use `Self` in docs when possible Fixes #76542. I used `rg '\s*//[!/]\s+fn [\w_]+\(&?self, ' .` in `library/` to find instances, I found some with that and some by manually checking. @rustbot modify labels: C-enhancement T-doc
2020-09-25Rollup merge of #77050 - follower:patch-1, r=oli-obkJonas Schievink-1/+1
Typo fix: "satsify" -> "satisfy"
2020-09-23Rollup merge of #77017 - GuillaumeGomez:vec-missing-examples-iter, r=Dylan-DPCDylan DPC-0/+31
Add missing examples on Vec iter types r? @Dylan-DPC
2020-09-23Rollup merge of #76993 - blitzerr:alloc-ref, r=AmanieuDylan DPC-17/+18
Changing the alloc() to accept &self instead of &mut self Fixes: [#55](https://github.com/rust-lang/wg-allocators/issues/55) This is the first cut. It only makes the change for `alloc` method.
2020-09-22a few more &mut self -> self changesblitzerr-4/+4
2020-09-23Use Self in allocAlexis Bourget-2/+2
2020-09-22Update library functions with stability attributesDylan MacKenzie-0/+5
This may not be strictly minimal, but all unstable functions also need a `rustc_const_unstable` attribute.
2020-09-22removing &mut self for other methods of AllocRefblitzerr-4/+4
2020-09-22Add missing examples on Vec iter typesGuillaume Gomez-0/+31
2020-09-22Typo fix: "satsify" -> "satisfy"follower-1/+1
2020-09-21Rollup merge of #72734 - pickfire:liballoc, r=KodrAusecstatic-morse-15/+13
Reduce duplicate in liballoc reserve error handling Not sure if it affects compilation time.
2020-09-21replaced cell::update with cell::[g|s]etblitzerr-5/+1
2020-09-21Added feature flag to use cell_updateblitzerr-0/+4
2020-09-21Changing the alloc() to accept &self instead of &mut selfblitzerr-9/+10
2020-09-21Rollup merge of #76983 - ssomers:btree_extra_test, r=Mark-SimulacrumRalf Jung-6/+25
BTreeMap: extra testing & fixed comments r? @Mark-Simulacrum
2020-09-21Auto merge of #75974 - SkiFire13:peekmut-opt-sift, r=LukasKalbertodtbors-2/+4
Avoid useless sift_down when std::collections::binary_heap::PeekMut is never mutably dereferenced If `deref_mut` is never called then it's not possible for the element to be mutated without internal mutability, meaning there's no need to call `sift_down`. This could be a little improvement in cases where you want to mutate the biggest element of the heap only if it satisfies a certain predicate that needs only read access to the element.
2020-09-20BTreeMap: extra testing unveiling mistakes in future PRStein Somers-6/+25
2020-09-20Rollup merge of #76926 - ssomers:btree_cleanup_1, r=Mark-SimulacrumRalf Jung-7/+7
BTreeMap: code readability tweaks Gathered over the past months r? @Mark-Simulacrum
2020-09-20Rollup merge of #76877 - denisvasilik:intra-doc-links-alloc-vec-deque, r=jyn514Ralf Jung-23/+28
Move to intra-doc links in collections/vec_deque.rs and collections/vec_deque/drain.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links
2020-09-20Rollup merge of #76876 - denisvasilik:intra-doc-links-alloc, r=jyn514Ralf Jung-12/+8
Move to intra-doc links in collections/btree/map.rs and collections/linked_list.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links
2020-09-20Rollup merge of #76875 - denisvasilik:intra-doc-links-alloc-binary-heap, ↵Ralf Jung-20/+14
r=jyn514 Move to intra-doc links in library/alloc/src/collections/binary_heap.rs Helps with #75080. @rustbot modify labels: T-doc, A-intra-doc-links
2020-09-20Rollup merge of #76866 - est31:master, r=lcnrRalf Jung-9/+1
Remove unused feature gates from library/ crates Removes some unused feature gates from library crates. It's likely not a complete list as I only tested a subset for which it's more likely that it is unused.
2020-09-20Rollup merge of #76722 - ssomers:btree_send_sync, r=Mark-SimulacrumRalf Jung-0/+143
Test and fix Send and Sync traits of BTreeMap artefacts Fixes #76686. I'm not quite sure what all this implies. E.g. comparing with the definitions for `NodeRef` in node.rs, maybe an extra bound `T: 'a` is useful for something. The test compiles on stable/beta (apart from `drain_filter`) so I bet `Sync` is equally desirable. r? @Mark-Simulacrum
2020-09-20Remove some unused features from alloc core and stdest31-8/+1
2020-09-20Fix time complexity in BinaryHeap::peek_mut docsGiacomo Stevanato-1/+2
2020-09-20Set sift=true only when PeekMut yields a mutable referenceGiacomo Stevanato-1/+2
2020-09-19Use intra-doc linksDenis Vasilik-12/+8
2020-09-19Auto merge of #76929 - ssomers:btree_cleanup_2, r=Mark-Simulacrumbors-20/+22
BTreeMap: wrap node's raw parent pointer in NonNull Now that the other `*const` (root) is gone, seemed like a small step forward. r? `@Mark-Simulacrum`
2020-09-19BTreeMap: wrap node's raw parent pointer in NonNullStein Somers-20/+22
2020-09-19BTreeMap: code readability tweaksStein Somers-7/+7
2020-09-19Rollup merge of #76525 - fusion-engineering-forks:string-drain, r=dtolnayRalf Jung-1/+35
Add as_str() to string::Drain. Vec's Drain recently [had its `.as_slice()` stabilized](https://github.com/rust-lang/rust/pull/72584), but String's Drain was still missing the analogous `.as_str()`. This adds that. Also improves the Debug implementation, which now shows the remaining data instead of just `"Drain { .. }"`.
2020-09-19Rollup merge of #76492 - fusion-engineering-forks:int-bits, r=dtolnayRalf Jung-3/+4
Add associated constant `BITS` to all integer types Recently I've regularly come across this snippet (in a few different crates, including `core` and `std`): ```rust std::mem::size_of<usize>() * 8 ``` I think it's time for a `usize::BITS`.
2020-09-19Rollup merge of #76310 - scottmcm:array-try_from-vec, r=dtolnayRalf Jung-0/+52
Add `[T; N]: TryFrom<Vec<T>>` (insta-stable) This is very similar to the [existing](https://doc.rust-lang.org/nightly/std/convert/trait.TryFrom.html#impl-TryFrom%3CBox%3C%5BT%5D%3E%3E) `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice. Like the slice equivalents of this, it fails if the length of the vector is not exactly `N`. This uses `Vec<T>` as the `Error` type to return the input, like how the `Rc<[T]> -> Rc<[T; N]>` (and Arc) ones also reflect the input directly in the error type. ```rust #[stable(feature = "array_try_from_vec", since = "1.47.0")] impl<T, const N: usize> TryFrom<Vec<T>> for [T; N] { type Error = Vec<T>; fn try_from(mut vec: Vec<T>) -> Result<[T; N], Vec<T>>; } ``` Inspired by this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/APIs.20for.20getting.20stuff.20from.20a.20Vec.20by.20owned/near/209048103
2020-09-19Add tracking issue number for string_drain_as_str.Mara Bos-3/+3
2020-09-19Use `T::BITS` instead of `size_of::<T> * 8`.Mara Bos-3/+4
2020-09-18Rename method to `assert_len`dylni-5/+5
2020-09-18Move `slice::check_range` to `RangeBounds`dylni-8/+5
2020-09-18Update library/alloc/src/collections/binary_heap.rsDenis Vasilik-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18Update library/alloc/src/collections/binary_heap.rsDenis Vasilik-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18Update library/alloc/src/collections/binary_heap.rsDenis Vasilik-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18Update library/alloc/src/collections/binary_heap.rsDenis Vasilik-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18Use intra-doc linksDenis Vasilik-2/+1
2020-09-18Move to intra-doc linksDenis Vasilik-21/+27
2020-09-18Use intra-doc linksDenis Vasilik-16/+10
2020-09-18Remove unused libc feature gateest31-1/+0
Libc isn't used by alloc. And std and panic_* use libc from crates.io now, which isn't feature gated.
2020-09-18Auto merge of #76790 - ssomers:btree_slice_slasher_returns, r=Mark-Simulacrumbors-16/+29
BTreeMap: avoid slices even more Epilogue to #73971: it seems the compiler is unable to realize that creating a slice and `get_unchecked`-ing one element is a simple fetch. So try to spell it out for the only remaining but often invoked case. Also, the previous code doesn't seem fair game to me, using `get_unchecked` to reach beyond the end of a slice. Although the local function `slice_insert` also does that. r? `@Mark-Simulacrum`
2020-09-16Rollup merge of #75026 - JulianKnodt:array_windows, r=AmanieuTyler Mandry-0/+3
Add array_windows fn This mimicks the functionality added by array_chunks, and implements a const-generic form of `windows`. It makes egregious use of `unsafe`, but by necessity because the array must be re-interpreted as a slice of arrays, and unlike array_chunks this cannot be done by casting the original array once, since each time the index is advanced it needs to move one element, not `N`. I'm planning on adding more tests, but this should be good enough as a premise for the functionality. Notably: should there be more functions overwritten for the iterator implementation/in general? ~~I've marked the issue as #74985 as there is no corresponding exact issue for `array_windows`, but it's based of off `array_chunks`.~~ Edit: See Issue #75027 created by @lcnr for tracking issue ~~Do not merge until I add more tests, please.~~ r? @lcnr