Skip to content

Fake ToOwned trait#733

Open
clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:fake-to-owned
Open

Fake ToOwned trait#733
clarfonthey wants to merge 1 commit into
rust-lang:mainfrom
clarfonthey:fake-to-owned

Conversation

@clarfonthey

Copy link
Copy Markdown
Contributor

This follows one of the suggestions for removing the alloc dependency, specifically to allow moving HashMap into alloc: essentially, if we don't have ToOwned, store-bought is fine.

The expectation here is that specifically for libstd, they can implement a blanket forwarding of the actual ToOwned to this trait and it should work as expected. This is fine by coherence rules even though the coherence rules kind of don't make any more sense once you are libstd.

Not 100% sure if this should be merged immediately, since I want to make sure that we actually can get a full alloc-less version of hashbrown working first. But the implementation seems relatively straightforward.

@RustyYato

Copy link
Copy Markdown

For posterity: see this Zulip thread

@Amanieu

Amanieu commented Jun 22, 2026

Copy link
Copy Markdown
Member

This seems mostly fine to me, but I would like to see the full story for not depending on alloc to be resolved before merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants