While Unique<T>
is a lang item and has special SB treatment, it still can be viewed as just a pointer. And no one can, or should, prevent unsafe code from making the same invariant, and your code will allow people to break that.
Copying values is such a fundamental operation that unsafe code relies on invariants regarding it a lot; that is why we have Copy
. Copying things that are not Copy
, that is, were never meant to be copied and moreover, many times they were meant to not be copied, is going to break a lot of things. If you want a trait for "can be safely duplicated", well, it has the name Copy
.
Now there can (though I doubt that, since Copy
is that essential) a type that is mistakenly not Copy
and you cannot fix it for some reason, make a newtype and unsafely copy it, that's fine (assuming we suppose that's fine, see the above UCG issue). But doing that generically is going to hurt you.