-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Stabilize or_insert_with_key #78083
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Stabilize or_insert_with_key #78083
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
This will needs a libs team sign-off. r? @SimonSapin |
@rfcbot merge |
Team member @m-ou-se has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Sorry for the delay! Unfortunately this missed 1.49. Can you update the stable versions to 1.50? |
@m-ou-se It is updated in the latest commit. |
This seems like a useful bit of information that would be good to add to the docs. |
@BurntSushi How about this?
|
@ChaiTRex Thank you, that looks great to me! |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
@bors r+ rollup |
📌 Commit f115be9 has been approved by |
Stabilize or_insert_with_key Stabilizes the `or_insert_with_key` feature from rust-lang#71024. This allows inserting key-derived values when a `HashMap`/`BTreeMap` entry is vacant. The difference between this and `.or_insert_with(|| ... )` is that this provides a reference to the key to the closure after it is moved with `.entry(key_being_moved)`, avoiding the need to copy or clone the key.
Rollup of 7 pull requests Successful merges: - rust-lang#78083 (Stabilize or_insert_with_key) - rust-lang#79211 (Add the "async" and "promise" doc aliases to `core::future::Future`) - rust-lang#79612 (Switch some links in compiler/ to intra-doc links) - rust-lang#80068 (Add `&mut` as an alias for 'reference' primitive) - rust-lang#80129 (docs: Edit rustc_ast::token::Token) - rust-lang#80133 (Suppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere) - rust-lang#80155 (Fix typo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Stabilizes the
or_insert_with_key
feature from #71024. This allows inserting key-derived values when aHashMap
/BTreeMap
entry is vacant.The difference between this and
.or_insert_with(|| ... )
is that this provides a reference to the key to the closure after it is moved with.entry(key_being_moved)
, avoiding the need to copy or clone the key.