-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fix Nightly warnings #1080
Fix Nightly warnings #1080
Conversation
// It is also properly aligned, because `u8` has an alignment of `1`. | ||
unsafe { | ||
volatile_set((self as *mut Self).cast::<u8>(), 0, mem::size_of::<Self>()); | ||
volatile_set((self as *mut Self).cast::<u8>(), 0, size_of::<Self>()); |
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 am not sure why exactly compiler complains about mem::size_of
. Was it added to the prelude?
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.
Yeah, it was. Just encountered that here too: RustCrypto/traits#1589
@@ -595,6 +595,8 @@ impl Zeroize for String { | |||
#[cfg(feature = "std")] | |||
impl Zeroize for CString { | |||
fn zeroize(&mut self) { | |||
use core::mem; |
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 think you can continue to import mem
, or maybe just import take
?
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.
This import would need to be gated on feature = "std"
, otherwise the compiler will complain about unused import. I think importing it inside the method is the simplest option. IMO mem::take/replace
is a bit easier to read than just take/replace
.
No description provided.