Add diagnostic::on_unimplemented attributes to key transmogrify traits#248
Add diagnostic::on_unimplemented attributes to key transmogrify traits#248
Conversation
…ameFieldPlucker traits Co-authored-by: lloydmeta <914805+lloydmeta@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR enhances developer experience by adding #[diagnostic::on_unimplemented] attributes to the Transmogrifier and ByNameFieldPlucker traits, transforming cryptic compiler errors into clear, actionable messages.
- Added diagnostic attributes to
Transmogrifiertrait with helpful conversion error messages - Added diagnostic attributes to
ByNameFieldPluckertrait with field lookup error guidance
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lloydmeta
left a comment
There was a problem hiding this comment.
I think there are few more traits that get used by transmogrify, for instance LabelledGeneric is very important.
Also make sure all the CI checks pass.
… clippy unused imports warning Co-authored-by: lloydmeta <914805+lloydmeta@users.noreply.github.com>
Added diagnostic attributes to LabelledGeneric and Sculptor traits, which are key traits used by transmogrify. Also fixed the clippy warning about unused imports in tuples.rs. Commit: 1be8690 |
|
Holy moly the future is here |
Compile-time errors on
transmogrifyare cryptic and unhelpful, showing deeply nested trait bound failures that don't indicate the actual problem (mismatched fields, wrong types, etc.).Changes
Added
#[diagnostic::on_unimplemented]attributes (Rust 1.78+) to key traits used by transmogrify operations:Transmogrifier: Shows "Cannot transmogrify{Self}into{Target}" with notes about field compatibility and structure requirementsByNameFieldPlucker: Shows "Cannot find field with key{TargetKey}in{Self}" when a required field is missingLabelledGeneric: Shows "Cannot derive labelled generic representation for{Self}" with guidance on using the derive macroSculptor: Shows "Cannot sculpt{Self}into the target HList shape" with notes about required typesAlso fixed clippy unused imports warning in
tuples.rs.Example
Before:
After:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.