External Publication
Visit Post

Could collections hypothetically store keys and values inline?

Rust Internals [Unofficial] April 24, 2026
Source

robofinch:

Or is there some reason I'm missing that already prevents std::collections data structures from storing values and (if applicable) keys inline, even hypothetically? In other words, can unsafe code stably and soundly use e.g. a HashMap as backing data for self-references to keys and values?

That's a libs-api question, not a UCG question (so you put this in the wrong section of this forum). And the answer is no, you can't rely on anything that's not explicitly documented.

Discussion in the ATmosphere

Loading comments...