Skip to content

Commit

Permalink
add #![no_std] to solana-clock (#3023)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey authored Oct 1, 2024
1 parent 489f483 commit 6f26b65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions sdk/clock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//! validator set][oracle].
//!
//! [oracle]: https://docs.solanalabs.com/implemented-proposals/validator-timestamp-oracle
#![no_std]

#[cfg(feature = "serde")]
use serde_derive::{Deserialize, Serialize};
Expand Down
6 changes: 3 additions & 3 deletions sdk/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub fn derive_clone_zeroed(input: proc_macro::TokenStream) -> proc_macro::TokenS
syn::Fields::Named(ref fields) => fields.named.iter().map(|f| {
let name = &f.ident;
quote! {
std::ptr::addr_of_mut!((*ptr).#name).write(self.#name);
core::ptr::addr_of_mut!((*ptr).#name).write(self.#name);
}
}),
_ => unimplemented!(),
Expand All @@ -332,9 +332,9 @@ pub fn derive_clone_zeroed(input: proc_macro::TokenStream) -> proc_macro::TokenS
// This is not the case here, and intentionally so because we want to
// guarantee zeroed padding.
fn clone(&self) -> Self {
let mut value = std::mem::MaybeUninit::<Self>::uninit();
let mut value = core::mem::MaybeUninit::<Self>::uninit();
unsafe {
std::ptr::write_bytes(&mut value, 0, 1);
core::ptr::write_bytes(&mut value, 0, 1);
let ptr = value.as_mut_ptr();
#(#clone_statements)*
value.assume_init()
Expand Down

0 comments on commit 6f26b65

Please sign in to comment.