rust-lang / reference

The Rust Reference
https://doc.rust-lang.org/nightly/reference/
Apache License 2.0
1.22k stars 476 forks source link

Expand `derive` documentation. #540

Open ehuss opened 5 years ago

ehuss commented 5 years ago

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

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.

Mark-Simulacrum commented 5 years ago

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 commented 5 years ago

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

Centril commented 5 years ago

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 commented 1 month ago

We should also document: