Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BTreeMap: admit the existence of leaf edges in comments #77395

Merged
merged 1 commit into from
Oct 5, 2020

Conversation

ssomers
Copy link
Contributor

@ssomers ssomers commented Oct 1, 2020

The btree code is ambiguous about leaf edges (i.e., edges within leaf nodes). Iteration relies on them heavily, but some of the comments suggest there are no leaf edges (extracted from #77025)

r? @Mark-Simulacrum

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 1, 2020
// parent: Option<NonNull<Node<K, V, height + 1>>>,
// parent_idx: u16,
// edges: [if height > 0 { Box<Node<K, V, height - 1>> } else { () }; 2 * B],
// parent: Option<(NonNull<Node<K, V, height + 1>>, u16)>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent is unrelated to leaf edges, but the fact that parent_idx is not part of the option is not "the ideal", it's probably the only way we can have the compiler merge the two u16 fields. I was going to undo that but it's in here now,

Comment on lines -324 to -326
/// If the node is a leaf, this function simply opens up its data.
/// If the node is an internal node, so not a leaf, it does have all the data a leaf has
/// (header, keys and values), and this function exposes that.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There hasn't been a separate header for quite a while, so pruning my own comment.

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 4, 2020

📌 Commit df76cf8 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 4, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#75853 (Use more intra-doc-links in `core::fmt`)
 - rust-lang#75928 (Remove trait_selection error message in specific case)
 - rust-lang#76329 (Add check for doc alias attribute at crate level)
 - rust-lang#77219 (core::global_allocator docs link to std::alloc::GlobalAlloc)
 - rust-lang#77395 (BTreeMap: admit the existence of leaf edges in comments)
 - rust-lang#77407 (Improve build-manifest to work with the improved promote-release)
 - rust-lang#77426 (Include scope id in SocketAddrV6::Display)
 - rust-lang#77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`)
 - rust-lang#77471 (BTreeMap: refactoring around edges, missed spots)
 - rust-lang#77512 (Allow `Abort` terminators in all const-contexts)
 - rust-lang#77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter)

Failed merges:

r? `@ghost`
@bors bors merged commit fe087ec into rust-lang:master Oct 5, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 5, 2020
@ssomers ssomers deleted the btree_love_the_leaf_edge_comments branch October 6, 2020 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants