Deriving `zeroize::Zeroize` requires the `Zeroize` trait to already be in scope
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Run the minimal reproduction in src/lib.rs and inspect the zeroize::Zeroize derive expansion, using the serde derive comparison as context. Confirm the issue is resolved when deriving zeroize::Zeroize no longer requires an explicit use zeroize::Zeroize import, while the reproduction still compiles.
Written by the indexing model from the issue text.
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.
- Dominant language
- Rust
- Stars
- 674
- Forks
- 170
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 10
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RustCrypto/utils
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RustCrypto/utils#1546 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
RustCrypto/utils#1537 · 7 comments ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
RustCrypto/utils#1534 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
RustCrypto/utils#1529 · 4 comments ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
RustCrypto/utils#1510 · 1 comment ·
Maintainers usually reply within 2 days
All issues in RustCrypto/utils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Docs: "Work with Codex from anywhere" page still claims Windows mobile support is "coming soon"Openapp documentation remote windows-os
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oxidecomputer/dendrite#380 ·
Maintainers usually reply within 5 days
-
area:cli bug good first issue priority:high
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day