Skip to content

Commit cf9d5df

Browse files
authored
Replace wasi crate with wasip2 (#721)
The recent releases of `wasi` simply re-export contents of `wasip2`.
1 parent 6134f6b commit cf9d5df

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ libc = { version = "0.2.154", default-features = false }
6262
[target.'cfg(target_os = "vxworks")'.dependencies]
6363
libc = { version = "0.2.154", default-features = false }
6464

65-
# wasi (0.2 only)
65+
# wasi_p2
6666
[target.'cfg(all(target_arch = "wasm32", target_os = "wasi", target_env = "p2"))'.dependencies]
67-
wasi = { version = "0.14", default-features = false }
67+
wasip2 = { version = "1", default-features = false }
6868

6969
# wasm_js
7070
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies]

src/backends/wasi_p2.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Implementation for WASI Preview 2.
22
use crate::Error;
3-
use core::mem::MaybeUninit;
4-
use wasi::random::random::get_random_u64;
3+
use core::{mem::MaybeUninit, ptr::copy_nonoverlapping};
4+
use wasip2::random::random::get_random_u64;
55

66
#[inline]
77
pub fn inner_u32() -> Result<u32, Error> {
@@ -16,9 +16,6 @@ pub fn inner_u64() -> Result<u64, Error> {
1616

1717
#[inline]
1818
pub fn fill_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
19-
use core::ptr::copy_nonoverlapping;
20-
use wasi::random::random::get_random_u64;
21-
2219
let (prefix, chunks, suffix) = unsafe { dest.align_to_mut::<MaybeUninit<u64>>() };
2320

2421
// We use `get_random_u64` instead of `get_random_bytes` because the latter creates

0 commit comments

Comments
 (0)