-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZeroizeOnDrop
auto-deref
#700
ZeroizeOnDrop
auto-deref
#700
Conversation
zeroize/src/lib.rs
Outdated
fn zeroize_or_on_drop(&mut self); | ||
} | ||
|
||
#[doc(hidden)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d suggest making these proper sealed traits by placing them in a private module, rather than merely hiding them from the docs. Otherwise they’re still a part of the public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They need to be part of the public API, otherwise the derive proc-macro can't access them. Some alternatives:
- Rename them further to
__AssertZeroizeOnDrop
. - Remove them from
zeroize
and let the proc-macro insert them. This has the disadvantage of requiring everyimpl
block to add them, which might increase compile time. - Mark traits as
unsafe
.
Or a combination of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise the derive proc-macro can't access them
Aah!
Rename them further to __AssertZeroizeOnDrop.
Another option would be to put them in a module like pub mod __internal
, which would also let you do #[doc(hidden)]
in a single place.
Mark traits as unsafe.
Since the trait doesn't deal strictly with memory safety I'd prefer not to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the __internal
thing!
011ad63
to
6549528
Compare
6549528
to
8557404
Compare
Thanks! |
This changes nothing from the users perspective, but will enable to implement
ZeroizeOnDrop
for fields that implement it replacing the need toskip
them instead.This will also validate that these fields types implement
ZeroizeOnDrop
.See #652 for further discussion.
Builds on top of #699.
Fixes #652.