From 0c156352b5ebf7a3b137b460ee5536c2c3a1e835 Mon Sep 17 00:00:00 2001 From: Mark Poliakov Date: Sun, 28 Jan 2024 18:56:27 +0200 Subject: [PATCH] alnyan/yggdrasil: use std instead of yggdrasil-rt --- Cargo.toml | 3 --- src/lib.rs | 3 ++- src/yggdrasil.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e727e09..ea57331 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,9 +23,6 @@ libc = { version = "0.2.149", default-features = false } [target.'cfg(target_os = "wasi")'.dependencies] wasi = { version = "0.11", default-features = false } -[target.'cfg(target_os = "yggdrasil")'.dependencies] -yggdrasil-rt = { git = "https://git.alnyan.me/yggdrasil/yggdrasil-rt.git" } - [target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies] wasm-bindgen = { version = "0.2.62", default-features = false, optional = true } js-sys = { version = "0.3", optional = true } diff --git a/src/lib.rs b/src/lib.rs index eda910d..790f23c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -188,7 +188,8 @@ html_favicon_url = "https://www.rust-lang.org/favicon.ico", html_root_url = "https://docs.rs/getrandom/0.2.12" )] -#![no_std] +#![cfg_attr(not(target_os = "yggdrasil"), no_std)] +#![cfg_attr(target_os = "yggdrasil", feature(yggdrasil_os))] #![warn(rust_2018_idioms, unused_lifetimes, missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] diff --git a/src/yggdrasil.rs b/src/yggdrasil.rs index 51dcc9d..6f7f031 100644 --- a/src/yggdrasil.rs +++ b/src/yggdrasil.rs @@ -3,5 +3,5 @@ use core::mem::MaybeUninit; use crate::Error; pub(crate) fn getrandom_inner(buffer: &mut [MaybeUninit]) -> Result<(), Error> { - Ok(unsafe { yggdrasil_rt::sys::get_random(crate::util::slice_assume_init_mut(buffer)) }) + Ok(std::os::yggdrasil::get_random(buffer)) }