-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Hi, while trying to add zeroize support to a crate I'm making, I found that I was getting a weird error about the Zeroize trait not being in scope:
error[E0405]: cannot find trait `Zeroize` in this scope
--> src\lib.rs:13:40
|
13 | #[cfg_attr(feature = "zeroize", derive(zeroize::Zeroize))]
| ^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the derive macro `zeroize::Zeroize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this trait
|
3 + use zeroize::Zeroize;
|
Here's a minimal reproduction (unfortunately I can't send a playground link, since the playground doesn't provide the zeroize derives):
#[derive(zeroize::Zeroize)]
struct A;The fix is relatively simple:
use zeroize::Zeroize;
#[derive(zeroize::Zeroize)]
struct A;though having a trait in scope solely for a derive feels... wrong.
I will note that serde is able to derive without its relevant traits in scope:
#[derive(serde::Serialize, serde::Deserialize)]
struct A;So perhaps zeroize should be changed to do the same?
Thank you for your time, and hopefully this is a relatively easy fix.
Metadata
Metadata
Assignees
Labels
No labels