Skip to content

Can't derive Copy for structs containing arrays #24288

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

Closed
mahkoh opened this issue Apr 10, 2015 · 13 comments
Closed

Can't derive Copy for structs containing arrays #24288

mahkoh opened this issue Apr 10, 2015 · 13 comments

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Apr 10, 2015

Since Copy: Clone and arrays implement Copy but not Clone.

Whose bright idea was it to have a language item depend on an arbitrary trait?

@retep998
Copy link
Member

impl Clone for Blah { fn clone(&self) -> Blah { *self } }

@mahkoh
Copy link
Contributor Author

mahkoh commented Apr 10, 2015

No shit. Then why doesn't #[derive(Copy, Clone)] do this?

@retep998
Copy link
Member

Because #[derive] is unable to inspect what traits are already implemented for a type to choose the appropriate implementation.

@retep998
Copy link
Member

However you do bring up a good point with that Copy: Clone yet arrays impl Copy but not Clone. That's definitely something that needs to be fixed, and I believe integer generics are the key to solving it.

@mahkoh
Copy link
Contributor Author

mahkoh commented Apr 10, 2015

Because #[derive]is unable to inspect what traits are already implemented for a type to choose the appropriate implementation.

Looks like you found the solution: Change derive to be able to do this.

@lilyball
Copy link
Contributor

@mahkoh You raise a legitimate issue, but you need to watch your language and tone of voice. The way you've written your ticket and replies is unnecessarily rude, and this isn't an isolated incident.

@solson
Copy link
Member

solson commented Apr 10, 2015

@mahkoh Hey, we can solve this problem without being rude about it. This is an annoying wart, for sure, but it's not the end of the world, and it will get fixed.

@mahkoh
Copy link
Contributor Author

mahkoh commented Apr 10, 2015

@kballard @tsion Interesting.

@nikomatsakis
Copy link
Contributor

@mahkoh that was implemented as part of PR #23905. I was just encouraging erickt on IRC to extract that out as a separate thing, in fact.

@eternaleye
Copy link
Contributor

@mahkoh #23905 may be of interest.

I will note that your tone comes across as quite confrontational, while the Rust community seems to strive for a more collaborative atmosphere in my experience.

@retep998
Copy link
Member

@mahkoh Sorry about all the people that decided to take over this issue to point out your rudeness. (You should still try to be nicer to people in the community though, so people wouldn't have to complain.)

@steveklabnik
Copy link
Member

@retep998 that's one reason why rudeness is so bad: it's a distraction from the technical point at hand.

@mahkoh
Copy link
Contributor Author

mahkoh commented Apr 10, 2015

@nikomatsakis

Yes, this PR explicitly handles #[derive(Copy, Clone)]

Then that should solve the problem.

@mahkoh mahkoh closed this as completed Apr 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants