Deriving may want to ignore marker fields #726
Labels
T-lang
Relevant to the language team, which will review and decide on the RFC.
T-libs-api
Relevant to the library API team, which will review and decide on the RFC.
Issue by kballard
Sunday May 18, 2014 at 00:05 GMT
For earlier discussion, see rust-lang/rust#14268
This issue was labelled with: in the Rust repository
Marker fields are used to provide extra information about types, including opting out of
Copy
,Send
, andShare
bounds. However, the presence of a marker field can prevent the ability to#[derive]
traits for that type. For example,core::kinds::marker::NoCopy
only implementsClone
andEq
(according to rustdoc; I am unsure if there are any libstd traits it implements because rustdoc doesn't show cross-crate traits). This means that any struct with aNoCopy
field cannot e.g. deriveShow
, orOrd
, or other useful traits.I think the right solution here is to simply not consider the marker fields when deriving traits, with the only exception being
Clone
. Every other trait should just pretend that field doesn't exist.The text was updated successfully, but these errors were encountered: