about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-12-19 15:15:57 +0900
committerGitHub <noreply@github.com>2020-12-19 15:15:57 +0900
commit0765536c0be31100eaa4bf6d00274bbad280621c (patch)
treedcfa22376240fd950cdce2961883900a9153fbb0 /compiler/rustc_data_structures/src
parentd1741e59cb87d3c8c794eebf6d5430d1b383f51f (diff)
parentf115be93abd2634f3d71d91bf1341e9860a87056 (diff)
downloadrust-0765536c0be31100eaa4bf6d00274bbad280621c.tar.gz
rust-0765536c0be31100eaa4bf6d00274bbad280621c.zip
Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se
Stabilize or_insert_with_key

Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/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.
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/sso/map.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/sso/map.rs b/compiler/rustc_data_structures/src/sso/map.rs
index fe8ae7abf98..06e8442d475 100644
--- a/compiler/rustc_data_structures/src/sso/map.rs
+++ b/compiler/rustc_data_structures/src/sso/map.rs
@@ -40,7 +40,7 @@ const SSO_ARRAY_SIZE: usize = 8;
 //   into_keys/into_values (unstable)
 //   all raw_entry-related
 //   PartialEq/Eq (requires sorting the array)
-//   Entry::or_insert_with_key (unstable)
+//   Entry::or_insert_with_key
 //   Vacant/Occupied entries and related
 //
 // FIXME: In HashMap most methods accepting key reference