-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Clone for all Copy types "by magic" #33507
Comments
Due to RFC 1521, we're allowed to assume that a |
Seems a bit magical, is the intent of this simply to allow one to type |
@bstrie also to fix the bug where large arrays and tuples are |
@bstrie The latter is actually the main purpose. Also to fix the ICEs that can result from a type being I do wish that this could be done in impl<T: Copy> Clone for T {
fn clone(&self) {
return self;
}
} |
This feels maybe doable with specialization, though I think it might require the lattice rule. At the moment, we don't want to use specialization in a way that adds functionality that can't exist without it since the feature's unstable. |
I've never seen it tried, but yeah, whenever this comes up in the context AFAIU the proposal here is to do it by magic, to eliminate concerns over It's a good idea if we want to commit to the fact that large arrays and On Tue, May 10, 2016 at 12:21 PM, Steven Fackler notifications@github.com
|
Please no! This would break so much†! †Mostly winapi. |
Yes, the idea here is to do it purely by compiler magic. My intent is
|
I'm going to close this issue, since this is not the right place for it. If someone wants to pursue this, please follow the RFC process here https://github.com/rust-lang/rfcs#before-creating-an-rfc. |
This probably needs an RFC, but one solution to the problem of
Copy
not implyingClone
is to make this happen via compiler magic: the compiler "magically" inserts an implementation ofClone
for anyCopy
type.GHC does something similar with
Coercible
.The text was updated successfully, but these errors were encountered: