rust-lang / rust-lang/reference

Should `#[automatically_derived]` docs contain advice for derive macros?

Open
#1,439 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

The documentation for #[automatically_derived] currently states:

The automatically_derived attribute is automatically added to implementations created by the derive attribute for built-in traits. It has no direct effect, but it may be used by tools and diagnostic lints to detect these automatically generated implementations.

I think the suggestion that this is only for built-in traits is incomplete; it's in use by many crates, including serde, clap, bevy, yew...

Also the "may be used by tools and diagnostic lints" seems vague: is this attribute recommended for use in derive macro output, for the purpose of suppressing clippy lints? Would this strategy be not recommended? I have seen a few github issues on proc-macro crates, and it does not seem like this attribute is well understood by crate authors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current #[automatically_derived] documentation and the linked examples from serde, clap, bevy, and yew. Done means the Reference clearly explains whether derive macros should use the attribute, how it relates to tools and diagnostic lints, and whether suppressing Clippy lints is recommended.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.