Deriving `zeroize::Zeroize` requires the `Zeroize` trait to already be in scope
まだ誰も着手していません。
評価
調査の方向性
src/lib.rs の最小再現を実行し、serde の derive との比較をコンテキストとして使用して、zeroize::Zeroize の derive 展開を調査します。zeroize::Zeroize の derive に明示的な use zeroize::Zeroize import が不要になり、再現コードが引き続きコンパイルできることを確認して、問題が解決されたことを確認します。
索引モデルが 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時間
- マージ済み PR(30日)
- 10
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 45/100
RustCrypto/utils#1529 · コメント 4 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
RustCrypto/utils#1510 · コメント 1 件 ·
RustCrypto/utils の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug core
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW オープンfuzz
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ClickHouse/ClickHouse#122114 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
linebender/vello_svg#90 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100