rust/library/alloc/src
bors ee04f9a4da Auto merge of #74437 - ssomers:btree_no_root_in_noderef, r=Mark-Simulacrum
BTreeMap: move up reference to map's root from NodeRef

Since the introduction of `NodeRef` years ago, it also contained a mutable reference to the owner of the root node of the tree (somewhat disguised as *const). Its intent is to be used only when the rest of the `NodeRef` is no longer needed. Moving this to where it's actually used, thought me 2 things:
- Some sort of "postponed mutable reference" is required in most places that it is/was used, and that's exactly where we also need to store a reference to the length (number of elements) of the tree, for the same reason. The length reference can be a normal reference, because the tree code does not care about tree length (just length per node).
- It's downright obfuscation in `from_sorted_iter` (transplanted to #75329)
- It's one of the reasons for the scary notice on `reborrow_mut`, the other one being addressed in #73971.

This does repeat the raw pointer code in a few places, but it could be bundled up with the length reference.

r? `@Mark-Simulacrum`
2020-09-10 23:29:57 +00:00
..
alloc Replace Memoryblock with NonNull<[u8]> 2020-08-04 18:03:34 +02:00
collections Auto merge of #74437 - ssomers:btree_no_root_in_noderef, r=Mark-Simulacrum 2020-09-10 23:29:57 +00:00
prelude mv std libs to library/ 2020-07-27 19:51:13 -05:00
raw_vec Replace Memoryblock with NonNull<[u8]> 2020-08-04 18:03:34 +02:00
rc impl Rc::new_cyclic 2020-08-27 19:19:29 +01:00
sync add missing newline 2020-08-14 01:28:04 +02:00
alloc.rs Capitalize safety comments 2020-09-08 22:37:18 -04:00
borrow.rs Make cow_is_borrowed methods const 2020-08-31 03:43:47 +02:00
boxed.rs Use intra-doc links for MaybeUninit in boxed.rs 2020-09-01 23:54:17 -04:00
fmt.rs Apply suggestions from code review 2020-08-21 19:31:00 +02:00
lib.rs BTreeMap: avoid aliasing by avoiding slices 2020-09-09 08:58:02 -04:00
macros.rs Use intra-doc-links in alloc 2020-08-21 00:25:25 +02:00
raw_vec.rs Assume same alignment in RawVec 2020-08-20 11:56:46 +02:00
rc.rs Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus 2020-09-05 16:28:22 +02:00
slice.rs Use intra-doc-links in alloc 2020-08-21 00:25:25 +02:00
str.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
string.rs Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAus 2020-09-04 12:21:43 +00:00
sync.rs Revert change to MaybeUninit until rustdoc bugs are fixed 2020-09-02 17:38:21 -04:00
task.rs Move to intra-doc links for task.rs and vec.rs 2020-08-18 21:47:23 +05:30
tests.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
vec.rs Rollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPC 2020-09-07 01:17:56 +02:00