Skip to content

zeroize_derive: use of PhantomData #724

@aewag

Description

@aewag

I currently try to apply the zeroize v1.5 with the zeroize_derive feature.

I would like to use the zeroize_derive feature for a stuct which contains PhantomData, for example.

This fails to compile and displays following error message:

$ cargo test --features zeroize_derive
   Compiling zeroize v1.5.1 (/home/alwagner/working_directory/projects/research/rust_crypto/utils/zeroize)
WARN rustc_metadata::locator no metadata found: incompatible metadata version found: '/home/alwagner/working_directory/projects/research/rust_crypto/utils/target/debug/deps/libzeroize_derive-b9ca4201b79543dd.so'
error[E0034]: multiple applicable items in scope
  --> zeroize/tests/zeroize_derive.rs:20:27
   |
20 |         #[derive(Zeroize, ZeroizeOnDrop)]
   |                           ^^^^^^^^^^^^^ multiple `zeroize_or_on_drop` found
   |
   = note: candidate #1 is defined in an impl of the trait `AssertZeroizeOnDrop` for the type `&mut T`
   = note: candidate #2 is defined in an impl of the trait `AssertZeroize` for the type `T`
   = note: this error originates in the derive macro `ZeroizeOnDrop` (in Nightly builds, run with -Z macro-backtrace for more info)
help: disambiguate the associated function for candidate #1
   |
20 |         #[derive(Zeroize, AssertZeroizeOnDrop::zeroize_or_on_drop(&mut ZeroizeOnDrop))]
   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
   |
20 |         #[derive(Zeroize, AssertZeroize::zeroize_or_on_drop(&mut ZeroizeOnDrop))]
   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
  --> zeroize/tests/zeroize_derive.rs:25:27
   |
25 |         #[derive(Zeroize, ZeroizeOnDrop)]
   |                           ^^^^^^^^^^^^^ multiple `zeroize_or_on_drop` found
   |
   = note: candidate #1 is defined in an impl of the trait `AssertZeroizeOnDrop` for the type `&mut T`
   = note: candidate #2 is defined in an impl of the trait `AssertZeroize` for the type `T`
   = note: this error originates in the derive macro `ZeroizeOnDrop` (in Nightly builds, run with -Z macro-backtrace for more info)
help: disambiguate the associated function for candidate #1
   |
25 |         #[derive(Zeroize, AssertZeroizeOnDrop::zeroize_or_on_drop(&mut ZeroizeOnDrop))]
   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
   |
25 |         #[derive(Zeroize, AssertZeroize::zeroize_or_on_drop(&mut ZeroizeOnDrop))]
   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0034`.
error: could not compile `zeroize` due to 2 previous errors

Shall this even be supported or am I misusing this feature? (FYI: I created a draft PR on my fork to test a bit.)

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