| Age | Commit message (Collapse) | Author | Lines |
|
BTreeMap: bring back the key slice for immutable lookup
Pave the way for binary search, by reverting a bit of #73971, which banned `keys` for misbehaving while it was defined for every `BorrowType`. Adding some `debug_assert`s along the way.
r? `@Mark-Simulacrum`
|
|
|
|
Avoid hash_slice in VecDeque's Hash implementation
Fixes #80303.
|
|
|
|
|
|
BTreeMap: prefer bulk_steal functions over specialized ones
The `steal_` functions (apart from their return value) are basically specializations of the more general `bulk_steal_` functions. This PR removes the specializations. The library/alloc benchmarks say this is never slower and up to 6% faster.
r? ``@Mark-Simulacrum``
|
|
|
|
Fixes #80303.
|
|
|
|
|
|
BTreeMap: offer merge in variants with more clarity
r? `@Mark-Simulacrum`
|
|
BTreeMap: clean up a few more comments
And mark `pop` as unsafe.
r? ```@Mark-Simulacrum```
|
|
BTreeMap: expose new_internal function and sanitize from_new_internal
`new_internal` is the functional core of the imperative `push_internal_level`, and `from_new_internal` can easily do a proper job instead of returning a half-baked node.
r? `@Mark-Simulacrum`
|
|
|
|
Clarify what the effects of a 'logic error' are
This clarifies what a 'logic error' is (which is a term used to describe what happens if you put things in a hash table or btree and then use something like a refcell to break the internal ordering). This tries to be as vague as possible, as we don't really want to promise what happens, except "bad things, but not UB". This was discussed in #80657
|
|
|
|
|
|
Always use extend in BinaryHeap::append
This is faster, see #77433.
Fixes #77433
|
|
|
|
BTreeMap: tougher checks on code using raw into_kv_pointers
r? `@Mark-Simulacrum`
|
|
See #77433 for why the new heuristic was chosen.
Fixes #77433
|
|
Remove unreachable panics from VecDeque::{front/back}[_mut]
`VecDeque`'s `front`, `front_mut`, `back` and `back_mut` methods are implemented in terms of the index operator, which causes these functions to contain [unreachable panic calls](https://rust.godbolt.org/z/MTnq1o).
This PR reimplements these methods in terms of `get[_mut]` instead.
|
|
|
|
Taken from #80293.
|
|
|
|
|
|
Fix stabilization version of deque_range feature.
See https://github.com/rust-lang/rust/pull/79022#issuecomment-751315315
|
|
Add "length" as doc alias to len methods
Currently when searching for `length` there are no results: https://doc.rust-lang.org/std/?search=length. This makes `len` methods appear when searching for `length`.
|
|
BTreeMap: rename the area access methods
r? `@Mark-Simulacrum`
|
|
|
|
BTreeMap: test split_off (and append) more thoroughly
Using DeterministicRng as a poor man's property based testing rig.
r? ``@Mark-Simulacrum``
|
|
|
|
|
|
BTreeMap: clean up access to MaybeUninit arrays
Stop exposing and using immutable access to `MaybeUninit` slices when we need and have exclusive access to the tree.
r? `@Mark-Simulacrum`
|
|
BTreeMap: test full nodes a little more
r? `@Mark-Simulacrum`
|
|
stabilize deque_range
Make #74217 stable, stabilizing `VecDeque::range` and `VecDeque::range_mut`.
Pr: #74099
r? `@m-ou-se`
|
|
|
|
BTreeMap: make test cases more explicit on failure
r? `@Mark-Simulacrum`
|
|
|
|
|
|
|
|
|
|
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`
|
|
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.
|
|
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
|
|
|
|
BTreeSet: simplify implementation of pop_first/pop_last
…and stop it interfering in #79245.
r? ```````@Mark-Simulacrum```````
|
|
BTreeMap: more expressive local variables in merge
r? ```````@Mark-Simulacrum```````
|
|
|
|
BTreeMap: declare clear_parent_link directly on the root it needs
r? `@Mark-Simulacrum`
|