Hacker News new | past | comments | ask | show | jobs | submit login

Right, in relatively recent versions of LLVM, there is a "freeze" operation. Making it available to programmers, possibly as a method off MaybeUninit, would potentially be useful. The safety overlaps that of "safe transmute" (and ecosystem crates such as bytemuck that provide that). The Pod trait[1] probably establishes the invariants so that freeze on uninitialized memory is safe.

I imagine the details are tricky (my understanding is that "freeze" took a long time to land in LLVM), but that there's no fundamental reason it can't be done. But I also imagine there are a lot higher priorities; the use case in this blog is pretty niche.

There's more discussion in this thread: [2]

[1]: https://docs.rs/bytemuck/latest/bytemuck/trait.Pod.html

[2]: https://internals.rust-lang.org/t/freeze-maybeuninit-t-maybe...




I definitely care more about growing what is possible, and specifically what can be written correctly than about the - perhaps more sensible - goal of making possible things easier. So that's a place where my priorities aren't Rust's priorities. My preferences absolutely can lead to the Turing Tarpit.

Reading for after work thanks for links




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: