Deriving `zeroize::Zeroize` requires the `Zeroize` trait to already be in scope
还没有人认领这个 Issue。
评估
调研方向
运行 src/lib.rs 中的最小复现,并检查 zeroize::Zeroize 的 derive 展开,以 serde 的 derive 对比作为上下文。当派生 zeroize::Zeroize 不再要求显式导入 use zeroize::Zeroize,且复现仍能编译时,确认该问题已解决。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Rust
- 星标
- 674
- 派生
- 170
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 10
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RustCrypto/utils 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
RustCrypto/utils#1546 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
RustCrypto/utils#1537 · 7 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
RustCrypto/utils#1534 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 45/100
RustCrypto/utils#1529 · 4 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
RustCrypto/utils#1510 · 1 条评论 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
TheLarkInn/aipm#2413 ·
-
documentation
难度 1/5 1 小时以内 新手友好度 90/100
alexgorbatchev/simple-ptt#15 ·
-
tooling
难度 2/5 1-3 小时 新手友好度 75/100
-
todo:ticket
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
taikoxyz/taiko-mono#22168 · 1 条评论 ·