You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
There is some uncertainty about how to create a Rust version of container_of that is never UB, which is currently needed in order to create Arc::from_raw here: rust-lang/rust#37192
Since there is a warning in ptr.offset saying this:
Both the starting and resulting pointer must be either in bounds or one byte past the end of an
allocated object. If either pointer is out of bounds or arithmetic overflow occurs then any further
use of the returned value will result in undefined behavior.
...the idea has come up to create a temporary object like this:
let t: T = mem::uninitialized(); // or mem::zeroed()
// do pointer arithmetic on t
mem::forget(t);
...but this seems risky; in case do pointer arithmetic on t would panic for some unforeseen reason,
we'll try to drop an uninitialized object.