BTreeMap: better distinguish the root holder from the root node#75329
Merged
bors merged 1 commit intorust-lang:masterfrom Aug 11, 2020
ssomers:btree_cleanup_8
Merged
BTreeMap: better distinguish the root holder from the root node#75329bors merged 1 commit intorust-lang:masterfrom ssomers:btree_cleanup_8
bors merged 1 commit intorust-lang:masterfrom
ssomers:btree_cleanup_8
Conversation
Member
|
@bors r+ |
Collaborator
|
📌 Commit ef753fc has been approved by |
Collaborator
Collaborator
|
☀️ Test successful - checks-actions, checks-azure |
This was referenced Aug 11, 2020
Merged
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 10, 2020
…ark-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 rust-lang#75329) - It's one of the reasons for the scary notice on `reborrow_mut`, the other one being addressed in rust-lang#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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames and intermediate variables