Skip to content

derive(Trait) for existing Trait should point at its definition and explain it must be impld manually #159483

Description

@estebank

Code

#[derive(Clone, Display)]
struct User;

fn main() {}

Current output

error: cannot find derive macro `Display` in this scope
  --> $DIR/display-is-not-builtin-derive.rs:12:10
   |
LL |          Display,
   |          ^^^^^^^

Desired output

error: cannot find derive macro `Display` in this scope
  --> $DIR/display-is-not-builtin-derive.rs:12:10
   |
LL |          Display,
   |          ^^^^^^^
note: trait `Display` can't be derived, you must `impl` it manually
  --> path/to/display.rs

Rationale and extra context

We should likely have a link or explanation about why not all traits are automatically derivable.

Other cases

Rust Version

1.97

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions