Skip to content

Ignore zero-width fields like PhantomData #66

@raklaptudirm

Description

@raklaptudirm

Currently, the concept of "newtypes" only refers to structs with a single field. This prevents the derives for working when the structure might have zero-width types like PhantomData for complier hints.

// This should work.
#[derive(FromPrimitive)]
struct A<B>(u16, PhantomData<B>);

This behavior can be seen in #[repr(transparent)], where the annotation will work as long as there is only one non-zero-width type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions