| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2025-09-25 | Rollup merge of #146859 - cammeresi:btree-alloc-20250920, r=joboet | Matthias Krüger | -2/+10 | |
| BTreeMap: Don't leak allocators when initializing nodes Memory was allocated via `Box::leak` and thence intended to be tracked and deallocated manually, but the allocator was also leaked, not tracked, and never dropped. Now it is dropped immediately. According to my reading of the `Allocator` trait, if a copy of the allocator remains live, then its allocations must remain live. Since the B-tree has a copy of the allocator that will only be dropped after the nodes, it's safe to not store the allocator in each node (which would be a much more intrusive change). Fixes: rust-lang/rust#106203 | ||||
| 2025-09-24 | BTreeMap: Don't leak allocators when initializing nodes | Sidney Cammeresi | -2/+10 | |
| Memory was allocated via `Box::leak` and thence intended to be tracked and deallocated manually, but the allocator was also leaked, not tracked, and never dropped. Now it is dropped immediately. According to my reading of the `Allocator` trait, if a copy of the allocator remains live, then its allocations must remain live. Since the B-tree has a copy of the allocator that will only be dropped after the nodes, it's safe to not store the allocator in each node (which would be a much more intrusive change). | ||||
| 2025-09-21 | btree InternalNode::new safety comments | Marijn Schouten | -2/+3 | |
| 2025-09-19 | btree: safety comments for init and new | Marijn Schouten | -1/+7 | |
| 2025-01-29 | btree/node.rs: pop_internal_level: does not invalidate other handles | Bart Jacobs | -0/+3 | |
| 2025-01-28 | btree/node.rs: remove incorrect comment from pop_internal_level docs | Bart Jacobs | -3/+0 | |
| 2025-01-20 | alloc: add `#![warn(unreachable_pub)]` | Urgau | -97/+112 | |
| 2025-01-11 | Add inherent versions of MaybeUninit methods for slices | ltdk | -3/+1 | |
| 2024-11-26 | Rollup merge of #133042 - cuviper:btreemap-insert_entry, r=Amanieu | Michael Goulet | -1/+1 | |
| btree: add `{Entry,VacantEntry}::insert_entry` This matches the recently-stabilized methods on `HashMap` entries. I've reused tracking issue #65225 for now, but we may want to split it. | ||||
| 2024-11-14 | btree: add `{Entry,VacantEntry}::insert_entry` | Josh Stone | -1/+1 | |
| This matches the recently-stabilized methods on `HashMap` entries. I've reused tracking issue #65225 for now, but we may want to split it. | ||||
| 2024-11-04 | btree: don't leak value if destructor of key panics | Lukas Markeffsky | -2/+16 | |
| 2024-10-23 | "innermost", "outermost", "leftmost", and "rightmost" don't need hyphens | Josh Triplett | -2/+2 | |
| These are all standard dictionary words and don't require hyphenation. | ||||
| 2024-09-25 | Use `&raw` in the standard library | Josh Stone | -5/+5 | |
| Since the stabilization in #127679 has reached stage0, 1.82-beta, we can start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!` and `ptr::addr_of_mut!` can stop allowing the unstable feature. I intentionally did not change any documentation or tests, but the rest of those macro uses are all now using `&raw const` or `&raw mut` in the standard library. | ||||
| 2023-11-23 | Rewrite the BTreeMap cursor API using gaps | Amanieu d'Antras | -5/+24 | |
| Tracking issue: #107540 Currently, a `Cursor` points to a single element in the tree, and allows moving to the next or previous element while mutating the tree. However this was found to be confusing and hard to use. This PR completely refactors cursors to instead point to a gap between two elements in the tree. This eliminates the need for a "ghost" element that exists after the last element and before the first one. Additionally, `upper_bound` and `lower_bound` now have a much clearer meaning. The ability to mutate keys is also factored out into a separate `CursorMutKey` type which is unsafe to create. This makes the API easier to use since it avoids duplicated versions of each method with and without key mutation. API summary: ```rust impl<K, V> BTreeMap<K, V> { fn lower_bound<Q>(&self, bound: Bound<&Q>) -> Cursor<'_, K, V> where K: Borrow<Q> + Ord, Q: Ord; fn lower_bound_mut<Q>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, K, V> where K: Borrow<Q> + Ord, Q: Ord; fn upper_bound<Q>(&self, bound: Bound<&Q>) -> Cursor<'_, K, V> where K: Borrow<Q> + Ord, Q: Ord; fn upper_bound_mut<Q>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, K, V> where K: Borrow<Q> + Ord, Q: Ord; } struct Cursor<'a, K: 'a, V: 'a>; impl<'a, K, V> Cursor<'a, K, V> { fn next(&mut self) -> Option<(&'a K, &'a V)>; fn prev(&mut self) -> Option<(&'a K, &'a V)>; fn peek_next(&self) -> Option<(&'a K, &'a V)>; fn peek_prev(&self) -> Option<(&'a K, &'a V)>; } struct CursorMut<'a, K: 'a, V: 'a>; impl<'a, K, V> CursorMut<'a, K, V> { fn next(&mut self) -> Option<(&K, &mut V)>; fn prev(&mut self) -> Option<(&K, &mut V)>; fn peek_next(&mut self) -> Option<(&K, &mut V)>; fn peek_prev(&mut self) -> Option<(&K, &mut V)>; unsafe fn insert_after_unchecked(&mut self, key: K, value: V); unsafe fn insert_before_unchecked(&mut self, key: K, value: V); fn insert_after(&mut self, key: K, value: V); fn insert_before(&mut self, key: K, value: V); fn remove_next(&mut self) -> Option<(K, V)>; fn remove_prev(&mut self) -> Option<(K, V)>; fn as_cursor(&self) -> Cursor<'_, K, V>; unsafe fn with_mutable_key(self) -> CursorMutKey<'a, K, V, A>; } struct CursorMutKey<'a, K: 'a, V: 'a>; impl<'a, K, V> CursorMut<'a, K, V> { fn next(&mut self) -> Option<(&mut K, &mut V)>; fn prev(&mut self) -> Option<(&mut K, &mut V)>; fn peek_next(&mut self) -> Option<(&mut K, &mut V)>; fn peek_prev(&mut self) -> Option<(&mut K, &mut V)>; unsafe fn insert_after_unchecked(&mut self, key: K, value: V); unsafe fn insert_before_unchecked(&mut self, key: K, value: V); fn insert_after(&mut self, key: K, value: V); fn insert_before(&mut self, key: K, value: V); fn remove_next(&mut self) -> Option<(K, V)>; fn remove_prev(&mut self) -> Option<(K, V)>; fn as_cursor(&self) -> Cursor<'_, K, V>; unsafe fn with_mutable_key(self) -> CursorMutKey<'a, K, V, A>; } ``` | ||||
| 2023-02-01 | BTreeMap: Add Cursor and CursorMut | Amanieu d'Antras | -1/+9 | |
| 2023-02-01 | BTreeMap: Change internal insert function to return a handle | Amanieu d'Antras | -18/+76 | |
| This is a prerequisite for cursor support for `BTreeMap`. | ||||
| 2022-12-28 | fix documenting private items of standard library | Lukas Markeffsky | -11/+17 | |
| 2022-10-05 | Fix overconstrained Send impls in btree internals | David Tolnay | -3/+3 | |
| 2022-08-26 | Rollup merge of #95005 - ssomers:btree_static_assert, r=thomcc | Guillaume Gomez | -7/+9 | |
| BTree: evaluate static type-related check at compile time `assert`s like the ones replaced here would only go off when you run the right test cases, if the code were ever incorrectly changed such that rhey would trigger. But [inspired on a nice forum question](https://users.rust-lang.org/t/compile-time-const-generic-parameter-check/69202), they can be checked at compile time. | ||||
| 2022-06-16 | btree: avoid forcing the allocator to be a reference | Ralf Jung | -32/+37 | |
| 2022-06-14 | BTreeMap: Add alloc param | Jacob Hughes | -38/+61 | |
| 2022-03-16 | BTree: evaluate static type-related check at compile time | Stein Somers | -7/+9 | |
| 2022-03-09 | BTreeMap::entry: Avoid allocating if no insertion | Frank King | -4/+5 | |
| 2022-03-07 | BTree: remove dead data needlessly complicating insert | Stein Somers | -37/+16 | |
| 2021-08-17 | BTree: refine some comments | Stein Somers | -2/+2 | |
| 2021-08-02 | BTree: merge the complication introduced by #81486 and #86031 | Stein Somers | -2/+6 | |
| 2021-07-29 | Fix may not to appropriate might not or must not | Ali Malik | -2/+2 | |
| 2021-06-25 | Fix a few misspellings. | Eric Huss | -1/+1 | |
| 2021-05-07 | BTree: no longer copy keys and values before dropping them | Stein Somers | -3/+36 | |
| 2021-04-28 | Minor grammar tweaks for readability | Ben-Lichtman | -4/+4 | |
| 2021-03-03 | BTree: move blocks around in node.rs | Stein Somers | -167/+165 | |
| 2021-03-03 | Rollup merge of #82439 - ssomers:btree_fix_unsafety, r=Mark-Simulacrum | Yuki Okushi | -16/+15 | |
| BTree: fix untrue safety Fix needless and missing `unsafe` tags. r? ````@Mark-Simulacrum```` | ||||
| 2021-03-01 | Auto merge of #82440 - ssomers:btree_fix_casts, r=Mark-Simulacrum | bors | -8/+10 | |
| BTree: no longer define impossible casts Casts to leaf to internal only make sense when the original has a chance of being the thing it's cast to. r? `@Mark-Simulacrum` | ||||
| 2021-02-23 | BTree: fix untrue safety | Stein Somers | -16/+15 | |
| 2021-02-23 | BTree: no longer define impossible casts | Stein Somers | -8/+10 | |
| 2021-02-23 | BTree: split off reusable components from range_search | Stein Somers | -10/+0 | |
| 2021-02-14 | Rollup merge of #81919 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum | Dylan DPC | -1/+1 | |
| BTreeMap: fix internal comments Salvaged from #81372 r? `@Mark-Simulacrum` | ||||
| 2021-02-12 | Use raw ref macros as in #80886 | Stein Somers | -3/+3 | |
| 2021-02-12 | Initialize BTree nodes directly in the heap | Josh Stone | -18/+30 | |
| 2021-02-09 | BTreeMap: fix internal comments | Stein Somers | -1/+1 | |
| 2021-01-30 | Rollup merge of #80886 - RalfJung:stable-raw-ref-macros, r=m-ou-se | Yuki Okushi | -2/+2 | |
| Stabilize raw ref macros This stabilizes `raw_ref_macros` (https://github.com/rust-lang/rust/issues/73394), which is possible now that https://github.com/rust-lang/rust/issues/74355 is fixed. However, as I already said in https://github.com/rust-lang/rust/issues/73394#issuecomment-751342185, I am not particularly happy with the current names of the macros. So I propose we also change them, which means I am proposing to stabilize the following in `core::ptr`: ```rust pub macro const_addr_of($e:expr) { &raw const $e } pub macro mut_addr_of($e:expr) { &raw mut $e } ``` The macro name change means we need another round of FCP. Cc `````@rust-lang/libs````` Fixes #73394 | ||||
| 2021-01-29 | rename raw_const/mut -> const/mut_addr_of, and stabilize them | Ralf Jung | -2/+2 | |
| 2021-01-26 | BTreeMap: stop tree from being owned by non-root node | Stein Somers | -14/+49 | |
| 2021-01-20 | BTreeMap: bring back the key slice for immutable lookup | Stein Somers | -25/+18 | |
| 2021-01-18 | BTreeMap: prefer bulk_steal functions over specialized ones | Stein Somers | -117/+4 | |
| 2021-01-18 | Auto merge of #81090 - ssomers:btree_drainy_refactor_2, r=Mark-Simulacrum | bors | -24/+52 | |
| BTreeMap: offer merge in variants with more clarity r? `@Mark-Simulacrum` | ||||
| 2021-01-17 | Rollup merge of #81082 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum | Mara Bos | -4/+7 | |
| BTreeMap: clean up a few more comments And mark `pop` as unsafe. r? ```@Mark-Simulacrum``` | ||||
| 2021-01-16 | BTreeMap: offer merge in variants with more clarity | Stein Somers | -24/+52 | |
| 2021-01-16 | BTreeMap: expose new_internal function and sanitize from_new_internal | Stein Somers | -9/+12 | |
| 2021-01-16 | BTreeMap: clean up a few more comments | Stein Somers | -4/+7 | |
