Unleakable crate safety/sanity


A while ago, I worked on an ‘unleakable’ crate that attempted to make a non-leakable container: https://github.com/Sgeo/unleakable. It relies on the assumption that if a value cannot be moved, it cannot be leaked.

I gave up because of bug #14875 which is one way to leak an unmovable value. But this bug looks like it’s on its way to being fixed, and/or is already fixed. Is it safe for code to rely on it being fixed?

Can I enforce that the crate only works with Rust 11.0 and above (or wherever bug 14875 is confirmed resolved)?

Are there other ways to violate this guarantee, and should I worry about it? There are already “safe” crates that might be unsafe when mixed together, like crossbeam + any coroutine stuff.

Other issues: Should Handle support DerefMut? It might be convenient sometimes but it weakens the guarantee.

Just use macros instead? There was another bug blocking macros to implement this but it’s resolved now.