# Why \`.insert\_entry()\` is private for \`HashSet\` and \`BTreeSet\` Entry APIs?

**URL:** <https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710>\
**Category:** libs\
**Created:** [October 26, 2026, 8:12pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710 "2026-10-26T20:12:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikwielgus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/mikwielgus/32/14686_2.png) [@mikwielgus](https://internals.rust-lang.org/u/mikwielgus)\
**Post date:** [October 26, 2026, 8:12pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710/1 "2026-10-26T20:12:49Z")

</div>

`VacantEntry` and `Entry` of `HashMap` and `BTreeMap` [each](https://doc.rust-lang.org/std/collections/hash_map/struct.VacantEntry.html#method.insert_entry) [have](https://doc.rust-lang.org/beta/std/collections/btree_map/struct.VacantEntry.html#method.insert_entry) a method called `.insert_entry()`.

Methods with this name also exist in the nightly-only experimental Entry APIs [of](https://github.com/rust-lang/rust/blob/main/library/std/src/collections/hash/set.rs#L2511) `HashSet` [and](https://github.com/rust-lang/rust/blob/main/library/alloc/src/collections/btree/set/entry.rs#L385) `BTreeSet`. However, these are private, so they can't be called by downstream programmers.

Is there a reason for this difference in APIs, or is this just an accidental inconsistency?

---

<div class="post-metadata">

**Author:** ![quinedot](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/quinedot/32/7294_2.png) [@quinedot](https://internals.rust-lang.org/u/quinedot)\
**Post date:** [October 26, 2026, 8:34pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710/2 "2026-10-26T20:34:40Z")

</div>

My guess from reading [the PR review](https://github.com/rust-lang/rust/pull/120077) is that it never got updated to look like [`hash_brown`](https://docs.rs/hashbrown/latest/hashbrown/hash_set/enum.Entry.html#method.insert) (it took a SemVer bump to make the corresponding change in `hash_brown`).

```rust
pub fn insert(self) -> OccupiedEntry<'a, T, S, A> where ...
// (no `insert_entry`)

```

---

<div class="post-metadata">

**Author:** ![mikwielgus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/mikwielgus/32/14686_2.png) [@mikwielgus](https://internals.rust-lang.org/u/mikwielgus)\
**Post date:** [October 29, 2026, 1:43pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710/3 "2026-10-29T13:43:23Z")

</div>

Would it be a good idea if I opened a pull request to rust-lang/rust for this?

---

<div class="post-metadata">

**Author:** ![cuviper](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/cuviper/32/1897_2.png) [@cuviper](https://internals.rust-lang.org/u/cuviper)\
**Post date:** [October 29, 2026, 6:40pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710/4 "2026-10-29T18:40:40Z")

</div>

It should be an API Change Proposal (ACP):

> **[Feature lifecycle - Standard library developers Guide](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html)**
>
> Guide for standard library developers

---

<div class="post-metadata">

**Author:** ![mikwielgus](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/mikwielgus/32/14686_2.png) [@mikwielgus](https://internals.rust-lang.org/u/mikwielgus)\
**Post date:** [November 13, 2026, 10:02pm UTC](https://internals.rust-lang.org/t/why-insert-entry-is-private-for-hashset-and-btreeset-entry-apis/24710/6 "2026-11-13T22:02:50Z")

</div>

Thanks, [ACP filed](https://github.com/rust-lang/libs-team/issues/946).
