I was reading in the forum and found this topic which in turn led me to this topic where @steffahn posted this code snippet.
You can opt-in or opt-out the
clone method of
Clone via implementing
Copy. I understand what this is good for but I don't understand why Rust "behaves" this way. Could anybody explain why this works this way? Is this behaviour documented anywhere?
This is hinted at in docs for
It's implemented using specialization, which is an unstable/experimental feature that you can't normally use in stable Rust.
Clone is a "lang item", which means it has special-case implementations in the compiler.