about summary refs log tree commit diff
path: root/src/liballoc/collections/btree/map.rs
AgeCommit message (Collapse)AuthorLines
2019-04-05Use for_each to extend collectionsJosh Stone-2/+2
This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
2019-02-22Rollup merge of #58431 - RalfJung:btree, r=Mark-SimulacrumMazdak Farrokhzad-12/+20
fix overlapping references in BTree This fixes two kinds of overlapping references in BTree (both found by running the BTree test suite in Miri). In `into_slices_mut`, we did `k.into_key_slice_mut()` followed by `self.into_val_slice_mut()` (where `k` is a copy of `self`). Calling `into_val_slice_mut` calls `self.len()`, which creates a shared reference to `NodeHeader`, which unfortunately (due to padding) overlaps with the mutable reference returned by `into_key_slice_mut`. Hence the key slice got (partially) invalidated. The fix is to avoid creating an `&NodeHeader` after the first slice got created. In the iterators, we used to first create the references that will be returned, and then perform the walk on the tree. Walking the tree creates references (such as `&mut InternalNode`) that overlap with all of the keys and values stored in a pointer; in particular, they overlap with the references the iterator will later return. This is fixed by reordering the operations of walking the tree and obtaining the inner references. The test suite still passes (and it passes in Miri now!), but there is a lot of code here that I do not understand...
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-8/+8
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-17Use more impl header lifetime elisionScott McMurray-8/+8
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-13fix invalidating references in BTree iteratorsRalf Jung-12/+20
2019-02-10libs: doc commentsAlexander Regueiro-1/+1
2019-02-03liballoc: revert nested imports style changes.Mazdak Farrokhzad-18/+12
2019-02-02liballoc: fix some idiom lints.Mazdak Farrokhzad-17/+17
2019-02-02liballoc: elide some lifetimes.Mazdak Farrokhzad-22/+21
2019-02-02liballoc: apply uniform_paths.Mazdak Farrokhzad-1/+2
2019-02-02liballoc: prefer imports of borrow from libcore.Mazdak Farrokhzad-2/+1
2019-02-02liballoc: refactor & fix some imports.Mazdak Farrokhzad-16/+17
2019-02-02liballoc: cargo check passes on 2018Mazdak Farrokhzad-1/+1
2018-12-28Auto merge of #55519 - fhartwig:hashmap-index-example, r=Centrilbors-0/+3
Add example of using the indexing operator to HashMap docs Fixes #52575
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-07Fix broken doc testCorey Farwell-1/+1
2018-12-05Fix typo in variable nameCorey Farwell-1/+1
2018-12-04Add example of using the indexing operator to BTreeMap docsCorey Farwell-0/+3
2018-11-06Format BtreeMap::range_mut examplekngwyu-3/+4
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-07-02add outlives annotations to `BTreeMap`Niko Matsakis-7/+10
nll requires these annotations, I believe because of https://github.com/rust-lang/rust/issues/29149
2018-07-02Make `BTreeMap::clone()` not allocate when cloning an empty tree.Nicholas Nethercote-1/+10
2018-06-29Move some alloc crate top-level items to a new alloc::collections moduleSimon Sapin-0/+2578
This matches std::collections