Deriving `zeroize::Zeroize` requires the `Zeroize` trait to already be in scope
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Esegui la riproduzione minima in src/lib.rs e ispeziona l’espansione del derive di zeroize::Zeroize, usando il confronto con il derive di serde come contesto. Conferma che il problema è risolto quando il derive di zeroize::Zeroize non richiede più un import esplicito di use zeroize::Zeroize, mentre la riproduzione continua a compilare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 674
- Fork
- 170
- Merge medio
- 1g 12h
- PR unite (30g)
- 10
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RustCrypto/utils
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
RustCrypto/utils#1546 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
RustCrypto/utils#1537 · 7 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
RustCrypto/utils#1534 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
RustCrypto/utils#1529 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
RustCrypto/utils#1510 · 1 commento ·
Tutte le issue di RustCrypto/utils
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug core
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Apertafuzz
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ClickHouse/ClickHouse#122114 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
linebender/vello_svg#90 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100