Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMake Copy a subtrait of Clone #23860
Conversation
rust-highfive
assigned
aturon
Mar 30, 2015
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
from
e340206
to
a608750
Mar 30, 2015
pnkfelix
reviewed
Mar 30, 2015
| @@ -8,10 +8,18 @@ | |||
| // option. This file may not be copied, modified, or distributed | |||
| // except according to those terms. | |||
|
|
|||
| <<<<<<< HEAD | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Mar 30, 2015
| @@ -227,7 +227,7 @@ pub mod types { | |||
| pub type rlim_t = u64; | |||
|
|
|||
| #[repr(C)] | |||
| #[derive(Copy)] pub struct glob_t { | |||
| #[derive(Copy, Clone)] pub struct glob_t { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Mar 30, 2015
Author
Contributor
@alexcrichton why? (that is, why is this any more unfortunate than any other fallout?)
seems like this will be a lot less painful for everyone if we made #[derive(Copy)] imply #[derive(Clone)]...
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 30, 2015
Member
I personally prefer to not see inherent methods and trait implementations directly on FFI types but rather on appropriate wrappers, so this is forcing the addition of a trait implementation on FFI types that want to also be Copy. Although others may differ on that opinion!
I do agree that inferred derive would be nice.
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Mar 30, 2015
Author
Contributor
I see. Seems like a minor thing to me though. You can still avoid trait impls beyond Copy/Clone if you choose.
This comment has been minimized.
This comment has been minimized.
|
r=me once bad merge is resolved. |
This comment has been minimized.
This comment has been minimized.
|
|
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
to
eb8315a
Mar 30, 2015
This comment has been minimized.
This comment has been minimized.
|
Created a discuss thread about this PR http://internals.rust-lang.org/t/making-copy-a-subtrait-of-clone-pr-23860/1777 |
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
from
eb8315a
to
32b6ec6
Mar 30, 2015
This comment has been minimized.
This comment has been minimized.
theemathas
commented
Mar 31, 2015
|
I have always assumed that Turns out that |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
oh, needs merge. |
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
from
32b6ec6
to
a758cf5
Mar 31, 2015
This comment has been minimized.
This comment has been minimized.
|
|
erickt
referenced this pull request
Mar 31, 2015
Closed
Make #[derive(Copy, Eq, Ord)] imply #[derive(Clone, PartialEq, PartialOrd)] #23905
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
from
a758cf5
to
1b5ac16
Apr 1, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
nikomatsakis
added some commits
Mar 26, 2015
nikomatsakis
force-pushed the
nikomatsakis:copy-requires-clone
branch
from
1b5ac16
to
c35c468
Apr 1, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Would this bloat crate size for crates that derive I'm also a bit concerned if this affects |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@Manishearth presumably this will affect crate sizes, specifically metadata. As for Bottom line for me though is that making |
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Apr 1, 2015
bors
added a commit
that referenced
this pull request
Apr 1, 2015
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Apr 1, 2015
This comment has been minimized.
This comment has been minimized.
|
@Manishearth that should be fixed by the most recent push. |
This comment has been minimized.
This comment has been minimized.
|
|
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Apr 2, 2015
This comment has been minimized.
This comment has been minimized.
|
gah I missed this in the rollup! |
nikomatsakis commentedMar 30, 2015
Logically,
Copy: Clonemakes sense, sinceCopybasically means "I can clone this with just memcpy". This also means that one can start out with aCopybound and relax it to aClonebound.This is a [breaking-change] because one must change
#[derive(Copy)]to#[derive(Copy,Clone)]. In some cases, deriving doesn't create a proper clone impl (notably around fixed-length arrays), in which case you should write one by hand. Because the type in question isCopy, this is very simple:Fixes #23790.
r? @aturon (stabilization issue)