External Publication
Visit Post

Pre-RFC: Unsafe traits conditionally depending on safe trait behaviour

Rust Internals [Unofficial] May 27, 2026
Source

It seems like it should require unsafe trait CompatibleClone (changing Allocator + Clone to Allocator + CompatibleClone). Types implementing Clone should then also implement the CompatibleClone.

The precondition mechanism seems to create a parallel trait resolution mechanism. It's probably more convenient if you don't need the whole world to start implementing CompatibleClone, but feels like a workaround.

Maybe it could be done with maker traits and relaxed orphan rules that allow unsafely implementing marker traits on foreign types?

Discussion in the ATmosphere

Loading comments...