Implementing data structures that make use of reading uninitialized memory

⚓ Rust    📅 2025-08-12    👤 surdeus    👁️ 4      

surdeus

I came accross this interesting trick for speeding up initialization of sparse data structures: research!rsc: Using Uninitialized Memory for Fun and Profit.

I tried to implement it in Rust, but ran into a seemingly fundamental problem. Even with unsafe, Rust seems to have no way to read uninitialized memory without causing undefined behavior.

Is there a way to implement this trick in Rust (without undefined behavior)? If not, are there any upcoming proposals that would allow implementing this trick?

1 post - 1 participant

Read full topic

🏷️ Rust_feed