Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Deriving `zeroize::Zeroize` requires the `Zeroize` trait to already be in scope

オープン
#1,271 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
tooling

調査の方向性

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RustCrypto/utils のほかの issue

RustCrypto/utils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。