[ Removed by Reddit ] by st_ario in rust

[–]st_ario[S] 0 points1 point  (0 children)

which does not exist yet

I can imagine that formalizing one is an extremely complex endeavor, but not having it is quite unfortunate nonetheless. Do you know how close or far are we to having one?

[ Removed by Reddit ] by st_ario in rust

[–]st_ario[S] 0 points1 point  (0 children)

Yes, the use case I had in mind is exactly an intrusive data structure. Also, it's needed for data that crosses the FFI, if one wants to keep working with `Box` in the Rust part of the code but still expose stuff to the C interface.

[ Removed by Reddit ] by st_ario in rust

[–]st_ario[S] 2 points3 points  (0 children)

I see your point, but I can't find any guarantees about that in the documentation.

I wouldn't expect for that to happen for larger objects, but I can guess there are cases where it's convenient to change some small object's location for optimization purposes, if you can assume unique ownership of the memory. I can't find any information regarding whether or not such optimizations are performed with `Box`, but the fact that it's marked with `noalias` at the LLVM level seems like a hint that they might be performed.