From 0a14c4a7024c7e0a3d58d86fa96344228cb96344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 11 Oct 2024 18:20:46 +0200 Subject: [PATCH] build(deps): update zerocopy requirement from 0.7 to 0.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates the requirements on [zerocopy](https://github.com/google/zerocopy) to permit the latest version. - [Release notes](https://github.com/google/zerocopy/releases) - [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/zerocopy/compare/v0.7.0...v0.8.2) --- updated-dependencies: - dependency-name: zerocopy dependency-type: direct:production ... Signed-off-by: Martin Kröning --- examples/wasmtime/Cargo.toml | 2 +- examples/wasmtime/src/preview1.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/wasmtime/Cargo.toml b/examples/wasmtime/Cargo.toml index fe2368f41..373ccb2ae 100644 --- a/examples/wasmtime/Cargo.toml +++ b/examples/wasmtime/Cargo.toml @@ -19,7 +19,7 @@ log = { version = "0.4" } #, features = ["kv_unstable"]} simple_logger = { version = "5.0", default-features = false } # FIXME: remove `gc` feature once upgraded to wasmtime 25: wasmtime = { version = "24.0", default-features = false, features = ["std", "gc", "runtime", "cranelift", "threads", "parallel-compilation"] } #"pooling-allocator", "incremental-cache", "wat", "gc", "component-model"] } -zerocopy = { version = "0.7", default-features = false, features = ["alloc", "derive", "simd-nightly"] } +zerocopy = { version = "0.8", default-features = false, features = ["alloc", "derive", "simd-nightly"] } [target.'cfg(target_os = "hermit")'.dependencies] hermit = { path = "../../hermit", default-features = false, features = ["acpi", "pci", "fsgsbase", "fs", "tcp", "dhcpv4", "mmap"] } diff --git a/examples/wasmtime/src/preview1.rs b/examples/wasmtime/src/preview1.rs index b3a51c79c..b5dd0d10b 100644 --- a/examples/wasmtime/src/preview1.rs +++ b/examples/wasmtime/src/preview1.rs @@ -15,7 +15,7 @@ use bitflags::bitflags; use log::debug; use wasi::*; use wasmtime::{AsContext, AsContextMut, Caller, Extern}; -use zerocopy::AsBytes; +use zerocopy::{Immutable, IntoBytes, KnownLayout}; static FD: Mutex> = Mutex::new(Vec::new()); @@ -74,7 +74,7 @@ const SOCKET_STREAM: u8 = 1 << 5; /// The file refers to a symbolic link inode. const SYMBOLIC_LINK: u8 = 1 << 6; -#[derive(Debug, Copy, Clone, Default, AsBytes)] +#[derive(Debug, Copy, Clone, Default, IntoBytes, KnownLayout, Immutable)] #[repr(C)] pub(crate) struct FileStat { pub dev: u64, @@ -90,7 +90,7 @@ pub(crate) struct FileStat { pub ctim: u64, } -#[derive(Debug, Copy, Clone, Default, AsBytes)] +#[derive(Debug, Copy, Clone, Default, IntoBytes, KnownLayout, Immutable)] #[repr(C)] pub(crate) struct FdStat { pub filetype: u8, @@ -191,7 +191,7 @@ pub(crate) fn init(linker: &mut wasmtime::Linker) -> Result<()> { let _ = mem.read( caller.as_context_mut(), path_ptr.try_into().unwrap(), - path.as_bytes_mut(), + path.as_mut_bytes(), ); let path = "/".to_owned() + std::str::from_utf8(&path).unwrap(); @@ -250,7 +250,7 @@ pub(crate) fn init(linker: &mut wasmtime::Linker) -> Result<()> { let _ = mem.read( caller.as_context_mut(), path_ptr.try_into().unwrap(), - path.as_bytes_mut(), + path.as_mut_bytes(), ); let path = "/".to_owned() + std::str::from_utf8(&path).unwrap(); @@ -469,7 +469,7 @@ pub(crate) fn init(linker: &mut wasmtime::Linker) -> Result<()> { let _ = mem.read( caller.as_context(), iovs_ptr.try_into().unwrap(), - iovs.as_bytes_mut(), + iovs.as_mut_bytes(), ); let mut nread_bytes: i32 = 0; @@ -594,7 +594,7 @@ pub(crate) fn init(linker: &mut wasmtime::Linker) -> Result<()> { let _ = mem.read( caller.as_context(), iovs_ptr.try_into().unwrap(), - iovs.as_bytes_mut(), + iovs.as_mut_bytes(), ); let mut nwritten_bytes: i32 = 0;