Skip to content

Commit

Permalink
chore: remove unused Once type (risc0#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell authored Jun 28, 2023
1 parent 44c67ee commit 691d7e0
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions risc0/zkvm/src/guest/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,6 @@ use crate::{
sha::rust_crypto::{Digest as _, Output, Sha256},
};

struct Once<T> {
data: UnsafeCell<MaybeUninit<T>>,
}

unsafe impl<T: Send + Sync> Sync for Once<T> {}

impl<T: Default> Once<T> {
const fn new() -> Self {
Once {
data: UnsafeCell::new(MaybeUninit::uninit()),
}
}

fn init(&self, value: T) {
unsafe { &mut *(self.data.get()) }.write(value);
}

fn get(&self) -> &mut T {
unsafe {
self.data
.get()
.as_mut()
.unwrap_unchecked()
.assume_init_mut()
}
}
}

static mut HASHER: Option<Sha256> = None;

pub(crate) fn init() {
Expand Down

0 comments on commit 691d7e0

Please sign in to comment.