Skip to content

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Mar 5, 2022

This pull-request expose the function get_many_mut and get_many_unchecked_mut from hashbrown to the standard library HashMap type. They obviously keep the same API and are added under the (new) map_many_mut feature.

  • get_many_mut: Attempts to get mutable references to N values in the map at once.
  • get_many_unchecked_mut: Attempts to get mutable references to N values in the map at once, without validating that the values are unique.

@rust-highfive
Copy link
Contributor

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 5, 2022
@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Mar 7, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2022
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 8, 2022
@thomcc
Copy link
Member

thomcc commented May 20, 2022

r? @thomcc

@thomcc thomcc closed this May 20, 2022
@thomcc
Copy link
Member

thomcc commented May 20, 2022

Err, didn't mean to close.

@thomcc thomcc reopened this May 20, 2022
@thomcc
Copy link
Member

thomcc commented May 20, 2022

Since I was asked in the other PR, I'll take this one.

r? @thomcc

@rust-highfive rust-highfive assigned thomcc and unassigned kennytm May 20, 2022
@thomcc
Copy link
Member

thomcc commented May 20, 2022

This is an API change, so it should go to T-libs-api.

r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs

@rust-highfive rust-highfive assigned joshtriplett and unassigned thomcc May 20, 2022
@thomcc
Copy link
Member

thomcc commented May 20, 2022

CC @Amanieu

@Amanieu
Copy link
Member

Amanieu commented May 20, 2022

There was some discussion in hashbrown about allowing a variable slice instead of an array: rust-lang/hashbrown#332

However I don't think this is immediately relevant since this is still unstable.

@Urgau
Copy link
Member Author

Urgau commented May 31, 2022

@Amanieu Since you know the API and underline hashbrown code, could you take over this (small) review ?

@Amanieu
Copy link
Member

Amanieu commented May 31, 2022

LGTM. Can you create a tracking issue and refer to it in the code?

@Urgau Urgau mentioned this pull request May 31, 2022
4 tasks
@Urgau Urgau force-pushed the hash-map-many-mut branch from 19604e2 to 0a6001b Compare May 31, 2022 22:24
@Amanieu
Copy link
Member

Amanieu commented May 31, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented May 31, 2022

📌 Commit 0a6001b has been approved by Amanieu

@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 May 31, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 1, 2022
Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap

This pull-request expose the function [`get_many_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_mut) and [`get_many_unchecked_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_unchecked_mut) from `hashbrown` to the standard library `HashMap` type. They obviously keep the same API and are added under the (new) `map_many_mut` feature.

- `get_many_mut`: Attempts to get mutable references to `N` values in the map at once.
- `get_many_unchecked_mut`: Attempts to get mutable references to `N` values in the map at once, without validating that the values are unique.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 1, 2022
Rollup of 9 pull requests

Successful merges:

 - rust-lang#94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap)
 - rust-lang#97216 (Ensure we never consider the null pointer dereferencable)
 - rust-lang#97399 (simplify code of finding arg index in `opt_const_param_of`)
 - rust-lang#97470 (rustdoc: add more test coverage)
 - rust-lang#97498 (Corrected EBNF grammar for from_str)
 - rust-lang#97562 (Fix comment in `poly_project_and_unify_type`)
 - rust-lang#97580 (Add regression test for rust-lang#71546)
 - rust-lang#97611 (Tweak insert docs)
 - rust-lang#97616 (Remove an unnecessary `Option`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 1, 2022
Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap

This pull-request expose the function [`get_many_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_mut) and [`get_many_unchecked_mut`](https://docs.rs/hashbrown/0.12.0/hashbrown/struct.HashMap.html#method.get_many_unchecked_mut) from `hashbrown` to the standard library `HashMap` type. They obviously keep the same API and are added under the (new) `map_many_mut` feature.

- `get_many_mut`: Attempts to get mutable references to `N` values in the map at once.
- `get_many_unchecked_mut`: Attempts to get mutable references to `N` values in the map at once, without validating that the values are unique.
@bors bors merged commit 9ddae15 into rust-lang:master Jun 1, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 1, 2022
@Urgau Urgau deleted the hash-map-many-mut branch May 5, 2023 16:46
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.

9 participants