Commit graph

237 commits

Author SHA1 Message Date
Mara Bos
255fde3f46
Rollup merge of #80390 - ssomers:btree_cleanup_slices_2, r=Mark-Simulacrum
BTreeMap: rename the area access methods

r? `@Mark-Simulacrum`
2020-12-28 19:09:20 +00:00
Dylan DPC
cefe40bb0c
Rollup merge of #80353 - ssomers:btree_test_split_off, 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``
2020-12-28 14:13:14 +01:00
Stein Somers
be3a5a1bec BTreeMap: rename the area access methods 2020-12-26 21:43:04 +01:00
bors
89524d0f8e Auto merge of #79520 - ssomers:btree_cleanup_1, 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`
2020-12-26 16:47:33 +00:00
bors
30a42735a0 Auto merge of #80354 - ssomers:btree_test_compact, r=Mark-Simulacrum
BTreeMap: test full nodes a little more

r? `@Mark-Simulacrum`
2020-12-26 13:46:16 +00:00
bors
d30dac2d83 Auto merge of #79022 - SpyrosRoum:stabilize-deque_range, r=m-ou-se
stabilize deque_range

Make #74217 stable, stabilizing `VecDeque::range` and `VecDeque::range_mut`.
Pr: #74099

r? `@m-ou-se`
2020-12-26 03:50:16 +00:00
Stein Somers
0d2548a173 BTreeMap: declare exclusive access to arrays when copying from them 2020-12-25 09:33:58 +01:00
Dylan DPC
7c7812dfd3
Rollup merge of #80352 - ssomers:btree_test_diagnostics, r=Mark-Simulacrum
BTreeMap: make test cases more explicit on failure

r? `@Mark-Simulacrum`
2020-12-25 03:39:51 +01:00
Stein Somers
f327a352b8 BTreeMap: test full nodes a little more 2020-12-24 16:48:27 +01:00
Stein Somers
d473cbe75b BTreeMap: test split_off (and append) more thoroughly 2020-12-24 16:44:46 +01:00
Stein Somers
9e618bacf2 BTreeMap: make test cases more explicit on failure 2020-12-24 15:58:57 +01:00
Stein Somers
8824efd61c BTreeMap: avoid implicit use of node length in flight 2020-12-24 11:41:40 +01:00
bors
3d10d3e49d Auto merge of #79521 - ssomers:btree_cleanup_2, 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`
2020-12-23 21:43:28 +00:00
Yuki Okushi
0765536c0b
Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se
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-19 15:15:57 +09:00
Dylan DPC
2e9ed6fb93
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnay
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-18 00:30:11 +01:00
Stein Somers
29114ff0fb BTreeMap: relax the explicit borrow rule to make code shorter and safer 2020-12-17 19:07:15 +01:00
Guillaume Gomez
53af11651b
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeSet: simplify implementation of pop_first/pop_last

…and stop it interfering in #79245.
r? ```````@Mark-Simulacrum```````
2020-12-17 11:36:49 +01:00
Guillaume Gomez
6b83013d1f
Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-Simulacrum
BTreeMap: more expressive local variables in merge

r? ```````@Mark-Simulacrum```````
2020-12-17 11:36:47 +01:00
Stein Somers
6c7835e441 BTreeSet: simplify implementation of pop_first/pop_last 2020-12-14 11:25:34 +01:00
bors
7feab000b2 Auto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BTreeMap: declare clear_parent_link directly on the root it needs

r? `@Mark-Simulacrum`
2020-12-13 22:13:02 +00:00
bors
69ff39ee32 Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
BTreeMap: detect bulk_steal's count-1 underflow in release builds too

r? `@Mark-Simulacrum`
2020-12-13 17:09:41 +00:00
bors
cbab347e68 Auto merge of #79376 - ssomers:btree_choose_parent_kv, r=Mark-Simulacrum
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-13 14:42:37 +00:00
Justus K
09d528ec15
fix typo 2020-12-13 15:18:38 +01:00
Stein Somers
94fd1d325c BTreeMap: more expressive local variables in merge 2020-12-13 11:27:24 +01:00
Stein Somers
bdc6adfb3b BTreeMap: declare clear_parent_link directly on the root it needs 2020-12-13 11:13:54 +01:00
Justus K
0f30b7dd87
fix panic if converting ZST Vec to VecDeque 2020-12-13 10:02:36 +01:00
bors
12813159a9 Auto merge of #79994 - JohnTitor:rollup-43wl2uj, r=JohnTitor
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-13 04:02:26 +00:00
Yuki Okushi
89051d81b9
Rollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-Simulacrum
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-13 11:05:32 +09:00
Stein Somers
0ae4c95eff BTreeMap: capture a recurring use pattern as replace_kv 2020-12-13 00:44:00 +01:00
Stein Somers
ad75a96b34 BTreeMap: detect bulk_steal's count-1 underflow in release builds too 2020-12-13 00:37:30 +01:00
Stein Somers
50576420f5 BTreeMap: clarify comments and panics surrounding choose_parent_kv 2020-12-12 20:35:15 +01:00
Mara Bos
5cab04ea92 Remove deprecated linked_list_extras methods. 2020-12-08 20:52:57 +01:00
Bastian Kauschke
4fb9f1d784 fix unsoundness in make_contiguous 2020-12-08 10:34:31 +01:00
Chai T. Rex
f115be93ab
Removed spurious linebreak from new documentation 2020-12-07 21:59:52 -05:00
Chai T. Rex
f1b930d57c Improved documentation for HashMap/BTreeMap Entry's .or_insert_with_key method 2020-12-07 21:36:01 -05:00
bors
9122b769c8 Auto merge of #78373 - matthewjasper:drop-on-into, r=pnkfelix
Don't leak return value after panic in drop

Closes #47949
2020-12-05 13:41:08 +00:00
Matthew Jasper
4fef39113a Avoid leaking block expression values 2020-12-04 23:07:46 +00:00
Tim Diekmann
9274b37d99 Rename AllocRef to Allocator and (de)alloc to (de)allocate 2020-12-04 14:47:15 +01:00
Chai T. Rex
866ef87d3f Update rustc version that or_insert_with_key landed 2020-12-01 01:06:40 -05:00
Stein Somers
d1a2c0f99c BTreeMap: try to enhance various comments & local identifiers 2020-11-28 10:35:02 +01:00
Jonas Schievink
ce197961ac
Rollup merge of #79358 - ssomers:btree_public_comments, r=Mark-Simulacrum
BTreeMap/BTreeSet: make public doc more consistent

Tweaks #72876 and #73667 and propagate them to `BTreeSet`.
2020-11-24 13:17:47 +01:00
Jonas Schievink
012d5fd8d7
Rollup merge of #79354 - ssomers:btree_bereave_BoxedNode, r=Mark-Simulacrum
BTreeMap: cut out the ceremony around BoxedNode

The opposite direction of #79093.

r? ``@Mark-Simulacrum``
2020-11-24 13:17:45 +01:00
Stein Somers
9c8db454af BTreeMap/BTreeSet: make public doc more consistent 2020-11-23 19:10:02 +01:00
Stein Somers
8526c313c1 BTreeMap: cut out the ceremony around BoxedNode 2020-11-23 17:02:08 +01:00
oliver
a804e38dde
doc typo
plus a small edit for clarity
2020-11-23 02:47:45 +00:00
Mara Bos
d39e095331
Rollup merge of #79297 - ssomers:btree_post_redux, r=Mark-Simulacrum
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-22 23:01:07 +01:00
Mara Bos
b54838f960
Rollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-Simulacrum
BTreeMap: fix minor testing mistakes in #78903

Mostly a duplicate test case
r? `@Mark-Simulacrum`
2020-11-22 23:01:05 +01:00
Mara Bos
5793fa9cda
Rollup merge of #79267 - ssomers:btree_namespaces, r=Mark-Simulacrum
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-22 23:01:02 +01:00
Stein Somers
b04abc433e BTreeMap: swap the names of NodeRef::new and Root::new_leaf 2020-11-22 13:40:03 +01:00
Stein Somers
9186c073fc BTreeMap: fix minor testing mistakes in #78903 2020-11-22 13:37:39 +01:00