From d04eb536459e742b0b1f71c1bb50f39d6128b9d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 06:02:18 +0000 Subject: [PATCH 1/3] Initial plan From 22764e9870cbc58b8179d53551493e83227cf16c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 06:07:41 +0000 Subject: [PATCH 2/3] Add diagnostic::on_unimplemented attributes to Transmogrifier and ByNameFieldPlucker traits Co-authored-by: lloydmeta <914805+lloydmeta@users.noreply.github.com> --- core/src/labelled.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/labelled.rs b/core/src/labelled.rs index 938e4a6d..fc48498b 100644 --- a/core/src/labelled.rs +++ b/core/src/labelled.rs @@ -586,6 +586,12 @@ where } /// Trait for plucking out a `Field` from a type by type-level `TargetKey`. +#[diagnostic::on_unimplemented( + message = "Cannot find field with key `{TargetKey}` in `{Self}`", + label = "Field not found", + note = "The source type does not contain a field with the target key.", + note = "Make sure the field name exists in the source struct and matches exactly." +)] pub trait ByNameFieldPlucker { type TargetValue; type Remainder; @@ -752,6 +758,13 @@ where /// /// Credit: /// 1. Haskell "transmogrify" Github repo: +#[diagnostic::on_unimplemented( + message = "Cannot transmogrify `{Self}` into `{Target}`", + label = "Cannot convert this type into the target type", + note = "Transmogrify requires that the source and target types have compatible structures.", + note = "The source type must have all the fields needed for the target type, possibly in a different order or nested structure.", + note = "Check that field names match and types are compatible between the source and target." +)] pub trait Transmogrifier { /// Consume this current object and return an object of the Target type. /// From 1be8690399fa38dd56800ffc5e5e265eafd4be19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 06:22:49 +0000 Subject: [PATCH 3/3] Add diagnostic attributes to LabelledGeneric and Sculptor traits, fix clippy unused imports warning Co-authored-by: lloydmeta <914805+lloydmeta@users.noreply.github.com> --- core/src/hlist.rs | 6 ++++++ core/src/labelled.rs | 6 ++++++ core/src/tuples.rs | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/hlist.rs b/core/src/hlist.rs index 3771544e..e03c7b85 100644 --- a/core/src/hlist.rs +++ b/core/src/hlist.rs @@ -970,6 +970,12 @@ where /// then `list.sculpt()` should "just work" even without the trait. /// /// [`HCons::sculpt`]: struct.HCons.html#method.sculpt +#[diagnostic::on_unimplemented( + message = "Cannot sculpt `{Self}` into the target HList shape", + label = "Sculpture failed", + note = "The source HList must contain all the types needed for the target HList.", + note = "Make sure all required types are present in the source, possibly in a different order." +)] pub trait Sculptor { type Remainder; diff --git a/core/src/labelled.rs b/core/src/labelled.rs index fc48498b..1506a2f6 100644 --- a/core/src/labelled.rs +++ b/core/src/labelled.rs @@ -195,6 +195,12 @@ use core::marker::PhantomData; /// // representation of the source object to that of the target type /// let s_user: SavedUser = frunk::transform_from(n_user); // done /// # } +#[diagnostic::on_unimplemented( + message = "Cannot derive labelled generic representation for `{Self}`", + label = "LabelledGeneric not implemented", + note = "The type must have a LabelledGeneric instance to be used with transform_from or transmogrify.", + note = "Derive LabelledGeneric using #[derive(LabelledGeneric)] on your struct or enum." +)] pub trait LabelledGeneric { /// The labelled generic representation type. type Repr; diff --git a/core/src/tuples.rs b/core/src/tuples.rs index b259875d..2911aad6 100644 --- a/core/src/tuples.rs +++ b/core/src/tuples.rs @@ -17,7 +17,6 @@ //! ``` use crate::generic::Generic; -use crate::{hlist, HList}; macro_rules! tup_def { ( $($dtype: ident),* ; ; ) => {};