Skip to content

Use the #[diagnostic::on_unimplemented] attribute when possible - #2767

Merged
dtolnay merged 1 commit into
serde-rs:masterfrom
weiznich:feature/diagnostic_on_unimplemented
Jul 6, 2024
Merged

dtolnay merged 1 commit into
serde-rs:masterfrom
weiznich:feature/diagnostic_on_unimplemented

Conversation

@weiznich

@weiznich weiznich commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

This change enables the #[diagnostic::on_unimplemented] attribute for the Serialize and Deserialize trait to point the user to the relevant derives and point out that they might want to check crates features for external types by adding the relevant hints an note.

The help text is up for discussion, but I feel that this might help quite a lot of users that struggle why external crates do not implement the serde traits.

This change enables the `#[diagnostic::on_unimplemented]` attribute for
the `Serialize` and `Deserialize` trait to point the user to the
relevant derives and point out that they might want to check crates
features for external types by adding the relevant hints an note.

@dtolnay dtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I've added a test for this in #2769.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants