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 938e4a6d..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; @@ -586,6 +592,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 +764,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. /// 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),* ; ; ) => {};