Skip to content

Support or reject generic persisted validator impls #12

@eboody

Description

@eboody

Summary

Generic persisted validator impls do not appear to round-trip cleanly through #[validators] expansion.

The macro rebuilds emitted impl blocks from self_ty instead of preserving the original impl generics and where-clause. That looks fragile or broken for shapes like impl<T> DbRow<T>.

This also appears to predate the non-authoritative scanning refactor, but it should be covered explicitly.

Current shape

The validators path keeps item_impl.self_ty and emits new impl blocks from that type. The original item_impl.generics are not preserved on the emitted outer impls.

Relevant code:

  • statum-macros/src/validators.rs
  • statum-macros/src/validators/emission.rs

Expected behavior

If generic persisted types are meant to be supported, the macro should preserve:

  • impl generic params
  • where clauses
  • direct compatibility with generic persisted types used by #[validators]

If they are not meant to be supported, the macro should reject them explicitly with a clear diagnostic.

Suggested acceptance

  • add a trybuild case for a generic persisted validators impl
  • either support it fully or fail closed with a targeted error
  • document the supported shape in validators docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions