summary refs log tree commit diff
path: root/library/alloc/src/collections
AgeCommit message (Collapse)AuthorLines
2021-02-05Auto merge of #81257 - ↵bors-1/+1
pnkfelix:issue-80949-short-term-resolution-via-revert-of-pr-78373, r=matthewjasper Revert 78373 ("dont leak return value after panic in drop") Short term resolution for issue #80949. Reopen #47949 after this lands. (We plan to fine-tune PR #78373 to not run into this problem.)
2020-12-25Rollup merge of #80352 - ssomers:btree_test_diagnostics, r=Mark-SimulacrumDylan DPC-5/+9
BTreeMap: make test cases more explicit on failure r? `@Mark-Simulacrum`
2020-12-24BTreeMap: make test cases more explicit on failureStein Somers-5/+9
2020-12-24BTreeMap: avoid implicit use of node length in flightStein Somers-97/+81
2020-12-23Auto merge of #79521 - ssomers:btree_cleanup_2, r=Mark-Simulacrumbors-106/+108
BTreeMap: relax the explicit borrow rule to make code shorter and safer Expressions like `.reborrow_mut().into_len_mut()` are annoyingly long, and kind of dangerous for the reason `reborrow_mut()` is unsafe. By relaxing the single rule, we no longer have to make an exception for functions with a `borrow` name and functions like `as_leaf_mut`. This is largely restoring the declaration style of the btree::node API about a year ago, but with more explanation and consistency. r? `@Mark-Simulacrum`
2020-12-19Rollup merge of #78083 - ChaiTRex:master, r=m-ou-seYuki Okushi-5/+7
Stabilize or_insert_with_key Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/71024. This allows inserting key-derived values when a `HashMap`/`BTreeMap` entry is vacant. The difference between this and `.or_insert_with(|| ... )` is that this provides a reference to the key to the closure after it is moved with `.entry(key_being_moved)`, avoiding the need to copy or clone the key.
2020-12-18Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnayDylan DPC-2/+6
Fix overflow when converting ZST Vec to VecDeque ```rust let v = vec![(); 100]; let queue = VecDeque::from(v); println!("{:?}", queue); ``` This code will currently panic with a capacity overflow. This PR resolves this issue and makes the code run fine. Resolves #78532
2020-12-17BTreeMap: relax the explicit borrow rule to make code shorter and saferStein Somers-106/+108
2020-12-17Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-SimulacrumGuillaume Gomez-2/+2
BTreeSet: simplify implementation of pop_first/pop_last …and stop it interfering in #79245. r? ```````@Mark-Simulacrum```````
2020-12-17Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-SimulacrumGuillaume Gomez-28/+27
BTreeMap: more expressive local variables in merge r? ```````@Mark-Simulacrum```````
2020-12-14BTreeSet: simplify implementation of pop_first/pop_lastStein Somers-2/+2
2020-12-13Auto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrumbors-10/+11
BTreeMap: declare clear_parent_link directly on the root it needs r? `@Mark-Simulacrum`
2020-12-13Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrumbors-0/+2
BTreeMap: detect bulk_steal's count-1 underflow in release builds too r? `@Mark-Simulacrum`
2020-12-13Auto merge of #79376 - ssomers:btree_choose_parent_kv, r=Mark-Simulacrumbors-12/+14
BTreeMap: clarify comments and panics around choose_parent_kv Fixes a lie in recent code: `unreachable!("empty non-root node")` should shout "empty internal node", but it might as well be good and keep quiet r? `@Mark-Simulacrum`
2020-12-13fix typoJustus K-1/+1
2020-12-13BTreeMap: more expressive local variables in mergeStein Somers-28/+27
2020-12-13BTreeMap: declare clear_parent_link directly on the root it needsStein Somers-10/+11
2020-12-13fix panic if converting ZST Vec to VecDequeJustus K-2/+6
2020-12-13Auto merge of #79994 - JohnTitor:rollup-43wl2uj, r=JohnTitorbors-62/+0
Rollup of 12 pull requests Successful merges: - #79360 (std::iter: document iteration over `&T` and `&mut T`) - #79398 (Link loop/for keyword) - #79834 (Remove deprecated linked_list_extras methods.) - #79845 (Fix rustup support in default_build_triple for python3) - #79940 (fix more clippy::complexity findings) - #79942 (Add post-init hook for static memory for miri.) - #79954 (Fix building compiler docs with stage 0) - #79963 (Fix typo in `DebruijnIndex` documentation) - #79970 (Misc rustbuild improvements when the LLVM backend isn't used) - #79973 (rustdoc light theme: Fix CSS for selected buttons) - #79984 (Remove an unused dependency that made `rustdoc` crash) - #79985 (Fixes submit event of the search input) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-12-13Rollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-SimulacrumYuki Okushi-62/+0
Remove deprecated linked_list_extras methods. https://github.com/rust-lang/rust/issues/27794#issuecomment-667524201: > I'd say give it about 2 weeks then remove them. It's been 18 weeks. Time to remove them. :) Closes #27794.
2020-12-13BTreeMap: capture a recurring use pattern as replace_kvStein Somers-8/+10
2020-12-13BTreeMap: detect bulk_steal's count-1 underflow in release builds tooStein Somers-0/+2
2020-12-12BTreeMap: clarify comments and panics surrounding choose_parent_kvStein Somers-12/+14
2020-12-08Remove deprecated linked_list_extras methods.Mara Bos-62/+0
2020-12-08fix unsoundness in `make_contiguous`Bastian Kauschke-5/+27
2020-12-07Removed spurious linebreak from new documentationChai T. Rex-1/+1
2020-12-07Improved documentation for HashMap/BTreeMap Entry's .or_insert_with_key methodChai T. Rex-3/+6
2020-12-05Auto merge of #78373 - matthewjasper:drop-on-into, r=pnkfelixbors-1/+1
Don't leak return value after panic in drop Closes #47949
2020-12-04Avoid leaking block expression valuesMatthew Jasper-1/+1
2020-12-04 Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`Tim Diekmann-5/+5
2020-12-01Update rustc version that or_insert_with_key landedChai T. Rex-1/+1
2020-11-28BTreeMap: try to enhance various comments & local identifiersStein Somers-89/+118
2020-11-24Rollup merge of #79358 - ssomers:btree_public_comments, r=Mark-SimulacrumJonas Schievink-4/+6
BTreeMap/BTreeSet: make public doc more consistent Tweaks #72876 and #73667 and propagate them to `BTreeSet`.
2020-11-24Rollup merge of #79354 - ssomers:btree_bereave_BoxedNode, r=Mark-SimulacrumJonas Schievink-38/+12
BTreeMap: cut out the ceremony around BoxedNode The opposite direction of #79093. r? ``@Mark-Simulacrum``
2020-11-23BTreeMap/BTreeSet: make public doc more consistentStein Somers-4/+6
2020-11-23BTreeMap: cut out the ceremony around BoxedNodeStein Somers-38/+12
2020-11-23doc typooliver-2/+2
plus a small edit for clarity
2020-11-22Rollup merge of #79297 - ssomers:btree_post_redux, r=Mark-SimulacrumMara Bos-14/+14
BTreeMap: swap the names of NodeRef::new and Root::new_leaf #78104 preserved the name of Root::new_leaf to minimize changes, but the resulting names are confusing. r? `@Mark-Simulacrum`
2020-11-22Rollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-SimulacrumMara Bos-16/+15
BTreeMap: fix minor testing mistakes in #78903 Mostly a duplicate test case r? `@Mark-Simulacrum`
2020-11-22Rollup merge of #79267 - ssomers:btree_namespaces, r=Mark-SimulacrumMara Bos-35/+33
BTreeMap: address namespace conflicts Fix an annoyance popping up whenever synchronizing the test cases with a version capable of miri-track-raw-pointers. r? `@Mark-Simulacrum`
2020-11-22BTreeMap: swap the names of NodeRef::new and Root::new_leafStein Somers-14/+14
2020-11-22BTreeMap: fix minor testing mistakes in #78903Stein Somers-16/+15
2020-11-21More consistently use spaces after commas in lists in docsCarol (Nichols || Goulding)-6/+6
2020-11-21BTreeMap: address namespace conflictsStein Somers-35/+33
2020-11-18BTreeMap: reuse NodeRef as Root, keep BoxedNode for edges only, ban UniqueStein Somers-141/+132
2020-11-16Rollup merge of #78903 - ssomers:btree_order_chaos_testing, r=Mark-SimulacrumMara Bos-26/+201
BTreeMap: test chaotic ordering & other bits & bobs r? `@Mark-Simulacrum`
2020-11-16Rollup merge of #77691 - exrook:rename-layouterr, r=KodrAusMara Bos-3/+3
Rename/Deprecate LayoutErr in favor of LayoutError Implements rust-lang/wg-allocators#73. This patch renames LayoutErr to LayoutError, and uses a type alias to support users using the old name. The new name will be instantly stable in release 1.49 (current nightly), the type alias will become deprecated in release 1.51 (so that when the current nightly is 1.51, 1.49 will be stable). This is the only error type in `std` that ends in `Err` rather than `Error`, if this PR lands all stdlib error types will end in `Error` :smiling_face_with_three_hearts:
2020-11-16Auto merge of #78631 - ssomers:btree-alias_for_underfull, r=Mark-Simulacrumbors-203/+320
BTreeMap: fix pointer provenance rules in underfullness Continuing on #78480, and for readability, and possibly for performance: avoid aliasing when handling underfull nodes, and consolidate the code doing that. In particular: - Avoid the rather explicit aliasing for internal nodes in `remove_kv_tracking`. - Climb down to the root to handle underfull nodes using a reborrowed handle, rather than one copied with `ptr::read`, before resuming on the leaf level. - Integrate the code tracking leaf edge position into the functions performing changes, rather than bolting it on. r? `@Mark-Simulacrum`
2020-11-15Rollup merge of #79026 - mbrubeck:btree_retain, r=m-ou-seJonas Schievink-0/+70
Implement BTreeMap::retain and BTreeSet::retain Adds new methods `BTreeMap::retain` and `BTreeSet::retain`. These are implemented on top of `drain_filter` (#70530). The API of these methods is identical to `HashMap::retain` and `HashSet::retain`, which were implemented in #39560 and stabilized in #36648. The docs and tests are also copied from HashMap/HashSet. The new methods are unstable, behind the `btree_retain` feature gate, with tracking issue #79025. See also rust-lang/rfcs#1338.
2020-11-13Add BTreeMap::retain and BTreeSet::retainMatt Brubeck-0/+70