Skip to content

zeroize: implement Zeroize for PhantomData/PhantomPinned #651

@tarcieri

Description

@tarcieri

Originally filed by @Allen-Webb as iqlusioninc/crates#651

Since often pinning is desired in conjunction with Zeroize, it would be nice to have zeroize define a Zeroize implementation for core::marker::PhantomPinned so that derive can be used with structs that contain PhantomPinned to prevent moving.

Originally filed by @daxpedda as iqlusioninc/crates#899

Sometimes, when you want to implement Zeroize for a structure that contains a PhantomData field, it's necessary to implement Zeroize by hand. I suggest improving this by simply implementing Zeroize for PhantomData, which should be no-op, as this has no representation data wise I believe.

Alternatively, the derive proc-macro could detect PhantomData and skip it. I prefer the above solution though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions