Skip to content

Expand derive documentation. #540

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

Open
ehuss opened this issue Mar 16, 2019 · 4 comments
Open

Expand derive documentation. #540

ehuss opened this issue Mar 16, 2019 · 4 comments
Labels
A-attributes Area: Attributes

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 16, 2019

The derive attribute documentation should probably list the built-in traits that are derivable. To my knowledge, the list is:

  • Clone
  • Hash
  • PartialEq
  • Eq
  • PartialOrd
  • Ord
  • Debug
  • Default
  • Send
  • Sync
  • Copy

Should the documentation also specify the semantics of how the default implementations behave? It seems like important information, but I think it is mostly covered in the core/std docs. Another option is to link to https://doc.rust-lang.org/book/appendix-03-derivable-traits.html.

@ehuss ehuss added the A-attributes Area: Attributes label Mar 16, 2019
@Mark-Simulacrum
Copy link
Member

Send and Sync to my knowledge can't be derived -- they're auto-implemented by the compiler where applicable and are otherwise unsafe to implement.

@ehuss
Copy link
Contributor Author

ehuss commented Mar 16, 2019

Oops, I had just copy/pasted from the code and didn't pay attention.

@Centril
Copy link
Contributor

Centril commented Mar 17, 2019

Should the documentation also specify the semantics of how the default implementations behave? It seems like important information, but I think it is mostly covered in the core/std docs.

Yes, the reference should strive to be the source of truth to which everything links, not the other way around. (caveat for things about rustc and notes...) The info should be here.

@lcnr
Copy link
Contributor

lcnr commented Jul 18, 2024

We should also document:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes
Projects
None yet
Development

No branches or pull requests

4 participants