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

Implement cursors for BTreeMap #105641

Merged
merged 2 commits into from
Feb 8, 2023
Merged

Implement cursors for BTreeMap #105641

merged 2 commits into from
Feb 8, 2023

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented Dec 12, 2022

See the ACP for an overview of the API: rust-lang/libs-team#141

The implementation is split into 2 commits:

  • The first changes the internal insertion functions to return a handle to the newly inserted element. The lifetimes involved are a bit hairy since we need a mutable handle to both the BTreeMap itself (which holds the root) and the nodes allocated in memory. I have tested that this passes the standard library testsuite under miri.
  • The second commit implements the cursor API itself. This is more straightforward to follow but still involves some unsafe code to deal with simultaneous mutable borrows of the tree root and the node that is currently being iterated.

@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2022

r? @m-ou-se

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 12, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 12, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@pitaj
Copy link
Contributor

pitaj commented Jan 28, 2023

@rustbot label +T-libs-api -T-libs +S-waiting-on-ACP -S-waiting-on-review

@rustbot rustbot added S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 28, 2023
Copy link
Member

@m-ou-se m-ou-se left a comment

Choose a reason for hiding this comment

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

r=me after adding a tracking issue.

@m-ou-se m-ou-se added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Jan 30, 2023
This is a prerequisite for cursor support for `BTreeMap`.
@Amanieu
Copy link
Member Author

Amanieu commented Feb 1, 2023

Added tracking issue #107540

r=m-ou-se

@jeffparsons
Copy link
Contributor

Does this need an explicit bors r+?

(Not sure how Bors interacts with GitHub reviews, if at all.)

@Amanieu
Copy link
Member Author

Amanieu commented Feb 8, 2023

@bors r=m-ou-se

@bors
Copy link
Contributor

bors commented Feb 8, 2023

📌 Commit 36831b3 has been approved by m-ou-se

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 8, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 8, 2023
Implement cursors for BTreeMap

See the ACP for an overview of the API: rust-lang/libs-team#141

The implementation is split into 2 commits:
- The first changes the internal insertion functions to return a handle to the newly inserted element. The lifetimes involved are a bit hairy since we need a mutable handle to both the `BTreeMap` itself (which holds the root) and the nodes allocated in memory. I have tested that this passes the standard library testsuite under miri.
- The second commit implements the cursor API itself. This is more straightforward to follow but still involves some unsafe code to deal with simultaneous mutable borrows of the tree root and the node that is currently being iterated.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2023
Implement cursors for BTreeMap

See the ACP for an overview of the API: rust-lang/libs-team#141

The implementation is split into 2 commits:
- The first changes the internal insertion functions to return a handle to the newly inserted element. The lifetimes involved are a bit hairy since we need a mutable handle to both the `BTreeMap` itself (which holds the root) and the nodes allocated in memory. I have tested that this passes the standard library testsuite under miri.
- The second commit implements the cursor API itself. This is more straightforward to follow but still involves some unsafe code to deal with simultaneous mutable borrows of the tree root and the node that is currently being iterated.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#105641 (Implement cursors for BTreeMap)
 - rust-lang#107271 (Treat Drop as a rmw operation)
 - rust-lang#107710 (Update strip-ansi-escapes and vte)
 - rust-lang#107758 (Change `arena_cache` to not alter the declared query result)
 - rust-lang#107777 (Make `derive_const` derive properly const-if-const impls)
 - rust-lang#107780 (Rename `replace_bound_vars_with_*` to `instantiate_binder_with_*`)
 - rust-lang#107793 (Add missing tracking issue for `RawOsError`)
 - rust-lang#107807 (Fix small debug typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 562581c into rust-lang:master Feb 8, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 8, 2023
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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants