From e2ac3f8eb01811427b4d6d28164de3111bfd66e6 Mon Sep 17 00:00:00 2001 From: Christoph Herzog Date: Fri, 15 Nov 2024 08:06:18 +0100 Subject: [PATCH] deps: Remove usage of unmaintained derivative crate The crate is unmaintained and shows up in cargo-deny lints. Do a manual std::fmt::Debug impl where appropriate use derive_more instead --- Cargo.lock | 48 +++++++++++-------- Cargo.toml | 1 + lib/api/Cargo.toml | 1 - lib/api/src/c_api/store.rs | 1 + lib/api/src/js/store.rs | 1 + lib/api/src/jsc/store.rs | 1 + lib/api/src/store.rs | 15 ++++-- lib/api/src/sys/store.rs | 9 +++- lib/api/src/typed_function.rs | 2 +- lib/journal/Cargo.toml | 3 +- lib/journal/src/entry.rs | 22 ++++----- lib/virtual-fs/Cargo.toml | 2 +- lib/virtual-fs/src/arc_box_file.rs | 5 +- lib/virtual-fs/src/arc_file.rs | 5 +- lib/virtual-fs/src/combine_file.rs | 5 +- lib/virtual-fs/src/dual_write_file.rs | 7 +-- lib/virtual-io/Cargo.toml | 1 - lib/virtual-io/src/arc.rs | 6 +-- lib/virtual-io/src/interest.rs | 8 +--- lib/virtual-io/src/selector.rs | 8 +--- lib/virtual-net/Cargo.toml | 2 +- lib/virtual-net/src/client.rs | 10 ++-- lib/virtual-net/src/composite.rs | 5 +- lib/virtual-net/src/host.rs | 7 +-- lib/virtual-net/src/loopback.rs | 5 +- lib/virtual-net/src/rx_tx.rs | 4 ++ lib/virtual-net/src/server.rs | 8 +--- lib/vm/Cargo.toml | 1 - lib/vm/src/export.rs | 6 +-- lib/vm/src/extern_ref.rs | 5 +- lib/vm/src/function_env.rs | 12 +++-- lib/vm/src/global.rs | 5 +- lib/vm/src/table.rs | 6 +-- lib/wasix/Cargo.toml | 2 +- lib/wasix/src/bin_factory/binary_package.rs | 9 ++-- lib/wasix/src/net/socket.rs | 5 +- lib/wasix/src/os/console/mod.rs | 4 +- lib/wasix/src/os/tty/mod.rs | 6 +-- lib/wasix/src/runners/dcgi/callbacks.rs | 6 +-- lib/wasix/src/runners/dcgi/factory.rs | 4 +- lib/wasix/src/runners/dcgi/handler.rs | 3 +- lib/wasix/src/runners/dproxy/factory.rs | 4 +- lib/wasix/src/runners/dproxy/handler.rs | 4 +- .../src/runners/dproxy/socket_manager.rs | 6 +-- lib/wasix/src/runners/wasi_common.rs | 5 +- lib/wasix/src/runners/wcgi/callbacks.rs | 3 +- lib/wasix/src/runners/wcgi/handler.rs | 7 +-- lib/wasix/src/runners/wcgi/runner.rs | 4 +- lib/wasix/src/runtime/mod.rs | 11 +---- lib/wasix/src/runtime/task_manager/mod.rs | 6 +-- lib/wasix/src/state/env.rs | 13 +---- lib/wasix/src/syscalls/wasix/epoll_ctl.rs | 2 + tests/integration/cli/Cargo.toml | 1 - tests/integration/cli/tests/snapshot.rs | 11 +++-- 54 files changed, 135 insertions(+), 208 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b9a894b5c9..1f4b2393b51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1371,17 +1371,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "derive_arbitrary" version = "1.3.2" @@ -1437,6 +1426,27 @@ dependencies = [ "syn 2.0.85", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "unicode-xid", +] + [[package]] name = "dialoguer" version = "0.11.0" @@ -4374,7 +4384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" dependencies = [ "byteorder", - "derive_more", + "derive_more 0.99.18", "twox-hash", ] @@ -5877,7 +5887,7 @@ dependencies = [ "async-trait", "bytes", "dashmap 6.1.0", - "derivative", + "derive_more 1.0.0", "dunce", "filetime", "fs_extra", @@ -5908,7 +5918,6 @@ version = "0.5.0" dependencies = [ "async-trait", "bytes", - "derivative", "futures", "mio", "serde", @@ -5927,7 +5936,7 @@ dependencies = [ "bincode", "bytecheck 0.6.12", "bytes", - "derivative", + "derive_more 1.0.0", "futures-util", "hyper", "hyper-tungstenite", @@ -6292,7 +6301,6 @@ dependencies = [ "bytes", "cfg-if", "cmake", - "derivative", "hashbrown 0.11.2", "indexmap 1.9.3", "js-sys", @@ -6336,7 +6344,7 @@ dependencies = [ "async-trait", "clap", "cynic", - "derive_more", + "derive_more 0.99.18", "futures", "indicatif", "log", @@ -6743,7 +6751,6 @@ version = "5.0.1" dependencies = [ "anyhow", "assert_cmd 2.0.16", - "derivative", "dirs", "flate2", "futures", @@ -6779,7 +6786,7 @@ dependencies = [ "bincode", "bytecheck 0.6.12", "bytes", - "derivative", + "derive_more 1.0.0", "lz4_flex", "num_enum", "rkyv", @@ -6893,7 +6900,6 @@ dependencies = [ "corosensei", "crossbeam-queue", "dashmap 6.1.0", - "derivative", "enum-iterator", "fnv", "indexmap 2.6.0", @@ -6928,7 +6934,7 @@ dependencies = [ "chrono", "cooked-waker", "dashmap 6.1.0", - "derivative", + "derive_more 1.0.0", "env_logger", "futures", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index 4480d9fbb97..8bd437b2fd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,6 +122,7 @@ base64 = "0.22.0" time = "0.3.36" target-lexicon = { version = "0.12.2", default-features = false } object = "0.32.0" +derive_more = { version = "1", features = ["debug"] } [build-dependencies] test-generator = { path = "tests/lib/test-generator" } diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index f84e559aff8..97e4ee0a457 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -34,7 +34,6 @@ indexmap = { version = "1.6" } cfg-if = "1.0" thiserror = "1.0" more-asserts = "0.2" -derivative = { version = "^2" } bytes = "1" tracing = { version = "0.1" } # - Optional shared dependencies. diff --git a/lib/api/src/c_api/store.rs b/lib/api/src/c_api/store.rs index 7039d260c83..9775c3dfd3f 100644 --- a/lib/api/src/c_api/store.rs +++ b/lib/api/src/c_api/store.rs @@ -6,6 +6,7 @@ use crate::{ pub(crate) use objects::{InternalStoreHandle, StoreObject}; pub use objects::{StoreHandle, StoreObjects}; +#[derive(Debug)] pub(crate) struct Store { pub(crate) engine: Engine, pub(crate) inner: *mut wasm_store_t, diff --git a/lib/api/src/js/store.rs b/lib/api/src/js/store.rs index 3c3ad1434b5..035f880f2d3 100644 --- a/lib/api/src/js/store.rs +++ b/lib/api/src/js/store.rs @@ -3,6 +3,7 @@ use crate::engine::{AsEngineRef, Engine, EngineRef}; pub(crate) use objects::{InternalStoreHandle, StoreObject}; pub use objects::{StoreHandle, StoreObjects}; +#[derive(Debug)] pub(crate) struct Store { pub(crate) engine: Engine, } diff --git a/lib/api/src/jsc/store.rs b/lib/api/src/jsc/store.rs index 8931d2b4e0a..03a3e4b2985 100644 --- a/lib/api/src/jsc/store.rs +++ b/lib/api/src/jsc/store.rs @@ -3,6 +3,7 @@ use crate::engine::{AsEngineRef, Engine, EngineRef}; pub(crate) use objects::{InternalStoreHandle, StoreObject}; pub use objects::{StoreHandle, StoreObjects}; +#[derive(Debug)] pub(crate) struct Store { pub(crate) engine: Engine, } diff --git a/lib/api/src/store.rs b/lib/api/src/store.rs index db18a65cc19..cdf37c897b5 100644 --- a/lib/api/src/store.rs +++ b/lib/api/src/store.rs @@ -1,7 +1,6 @@ use crate::engine::{AsEngineRef, Engine, EngineRef}; #[cfg(feature = "sys")] use crate::sys::NativeStoreExt; -use derivative::Derivative; use std::{ fmt, ops::{Deref, DerefMut}, @@ -45,16 +44,22 @@ pub type OnCalledHandler = Box< /// We require the context to have a fixed memory address for its lifetime since /// various bits of the VM have raw pointers that point back to it. Hence we /// wrap the actual context in a box. -#[derive(Derivative)] -#[derivative(Debug)] pub(crate) struct StoreInner { pub(crate) objects: StoreObjects, - #[derivative(Debug = "ignore")] pub(crate) store: store_imp::Store, - #[derivative(Debug = "ignore")] pub(crate) on_called: Option, } +impl std::fmt::Debug for StoreInner { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("StoreInner") + .field("objects", &self.objects) + .field("store", &self.store) + .field("on_called", &"<...>") + .finish() + } +} + /// The store represents all global state that can be manipulated by /// WebAssembly programs. It consists of the runtime representation /// of all instances of functions, tables, memories, and globals that diff --git a/lib/api/src/sys/store.rs b/lib/api/src/sys/store.rs index fd56cb7ac29..39aa964899d 100644 --- a/lib/api/src/sys/store.rs +++ b/lib/api/src/sys/store.rs @@ -4,10 +4,17 @@ use wasmer_vm::TrapHandlerFn; pub(crate) struct Store { pub(crate) engine: Engine, - pub(crate) trap_handler: Option>>, } +impl std::fmt::Debug for Store { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("Store") + .field("engine", &self.engine) + .finish() + } +} + impl Store { pub(crate) fn new(engine: Engine) -> Self { init_traps(); diff --git a/lib/api/src/typed_function.rs b/lib/api/src/typed_function.rs index ccaadcfd4e5..4f234f93625 100644 --- a/lib/api/src/typed_function.rs +++ b/lib/api/src/typed_function.rs @@ -14,7 +14,7 @@ use crate::store::AsStoreRef; /// A WebAssembly function that can be called natively /// (using the Native ABI). -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct TypedFunction { pub(crate) func: Function, _phantom: PhantomData Rets>, diff --git a/lib/journal/Cargo.toml b/lib/journal/Cargo.toml index 02ef9192c19..617dd9e8d4c 100644 --- a/lib/journal/Cargo.toml +++ b/lib/journal/Cargo.toml @@ -22,15 +22,16 @@ virtual-net = { path = "../virtual-net", version = "0.11.0", default-features = "rkyv", ] } virtual-fs = { path = "../virtual-fs", version = "0.19.0", default-features = false } + shared-buffer = { workspace = true, optional = true } base64.workspace = true +derive_more.workspace = true rkyv = { workspace = true } thiserror = "1" bytes = "1.1" async-trait = { version = "^0.1" } tracing = "0.1" -derivative = { version = "^2" } bincode = { version = "1.3" } serde = { version = "1.0", default-features = false, features = ["derive"] } anyhow = "1.0" diff --git a/lib/journal/src/entry.rs b/lib/journal/src/entry.rs index 6b570cdc3bf..ee7402fc234 100644 --- a/lib/journal/src/entry.rs +++ b/lib/journal/src/entry.rs @@ -1,4 +1,3 @@ -use derivative::Derivative; use serde::{Deserialize, Serialize}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use std::net::{Shutdown, SocketAddr}; @@ -79,8 +78,7 @@ pub enum SocketOptTimeType { /// Represents a log entry in a snapshot log stream that represents the total /// state of a WASM process at a point in time. #[allow(clippy::large_enum_variant)] -#[derive(Derivative, Clone, PartialEq, serde::Serialize, serde::Deserialize)] -#[derivative(Debug)] +#[derive(derive_more::Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] pub enum JournalEntry<'a> { InitModuleV1 { @@ -89,7 +87,7 @@ pub enum JournalEntry<'a> { ClearEtherealV1, UpdateMemoryRegionV1 { region: Range, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] compressed_data: Cow<'a, [u8]>, }, @@ -98,13 +96,13 @@ pub enum JournalEntry<'a> { }, SetThreadV1 { id: u32, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] call_stack: Cow<'a, [u8]>, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] memory_stack: Cow<'a, [u8]>, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] store_data: Cow<'a, [u8]>, start: ThreadStartType, @@ -123,7 +121,7 @@ pub enum JournalEntry<'a> { FileDescriptorWriteV1 { fd: Fd, offset: u64, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] data: Cow<'a, [u8]>, is_64bit: bool, @@ -141,9 +139,9 @@ pub enum JournalEntry<'a> { dirflags: LookupFlags, path: Cow<'a, str>, o_flags: Oflags, - #[derivative(Debug = "ignore")] + #[debug(ignore)] fs_rights_base: Rights, - #[derivative(Debug = "ignore")] + #[debug(ignore)] fs_rights_inheriting: Rights, fs_flags: Fdflags, }, @@ -330,7 +328,7 @@ pub enum JournalEntry<'a> { }, SocketSendToV1 { fd: Fd, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] data: Cow<'a, [u8]>, flags: SiFlags, @@ -339,7 +337,7 @@ pub enum JournalEntry<'a> { }, SocketSendV1 { fd: Fd, - #[derivative(Debug = "ignore")] + #[debug(ignore)] #[serde(with = "base64")] data: Cow<'a, [u8]>, flags: SiFlags, diff --git a/lib/virtual-fs/Cargo.toml b/lib/virtual-fs/Cargo.toml index 7b783622c4f..9130bbb5873 100644 --- a/lib/virtual-fs/Cargo.toml +++ b/lib/virtual-fs/Cargo.toml @@ -12,11 +12,11 @@ rust-version.workspace = true [dependencies] wasmer-package.workspace = true dashmap.workspace = true +derive_more.workspace = true dunce = "1.0.4" anyhow = { version = "1.0.66", optional = true } async-trait = { version = "^0.1" } bytes = "1" -derivative = "2.2.0" filetime = { version = "0.2.18", optional = true } fs_extra = { version = "1.2.0", optional = true } futures = { version = "0.3" } diff --git a/lib/virtual-fs/src/arc_box_file.rs b/lib/virtual-fs/src/arc_box_file.rs index b55a8b415e6..ba28b080fce 100644 --- a/lib/virtual-fs/src/arc_box_file.rs +++ b/lib/virtual-fs/src/arc_box_file.rs @@ -8,15 +8,12 @@ use std::{ task::{Context, Poll}, }; -use derivative::Derivative; use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite}; use crate::VirtualFile; -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct ArcBoxFile { - #[derivative(Debug = "ignore")] inner: Arc>>, } diff --git a/lib/virtual-fs/src/arc_file.rs b/lib/virtual-fs/src/arc_file.rs index 088f6e5ce02..6059d70e14c 100644 --- a/lib/virtual-fs/src/arc_file.rs +++ b/lib/virtual-fs/src/arc_file.rs @@ -2,7 +2,6 @@ //! effectively this is a symbolic link without all the complex path redirection use crate::{ClonableVirtualFile, VirtualFile}; -use derivative::Derivative; use std::pin::Pin; use std::task::{Context, Poll}; use std::{ @@ -11,13 +10,11 @@ use std::{ }; use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite}; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct ArcFile where T: VirtualFile + Send + Sync + 'static, { - #[derivative(Debug = "ignore")] inner: Arc>>, } diff --git a/lib/virtual-fs/src/combine_file.rs b/lib/virtual-fs/src/combine_file.rs index 951de2e5a2f..8c12b83c9f1 100644 --- a/lib/virtual-fs/src/combine_file.rs +++ b/lib/virtual-fs/src/combine_file.rs @@ -1,11 +1,8 @@ -use derivative::Derivative; - use super::*; use crate::VirtualFile; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct CombineFile { tx: Box, rx: Box, diff --git a/lib/virtual-fs/src/dual_write_file.rs b/lib/virtual-fs/src/dual_write_file.rs index bf71ad41e86..b6f590a11ca 100644 --- a/lib/virtual-fs/src/dual_write_file.rs +++ b/lib/virtual-fs/src/dual_write_file.rs @@ -1,5 +1,3 @@ -use derivative::Derivative; - use super::*; use crate::VirtualFile; @@ -7,12 +5,11 @@ use crate::VirtualFile; /// Wraps a [`VirtualFile`], and also invokes a provided function for each write. /// /// Useful for debugging. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(derive_more::Debug)] pub struct DualWriteFile { inner: Box, - #[derivative(Debug = "ignore")] #[allow(clippy::type_complexity)] + #[debug(ignore)] extra_write: Box, } diff --git a/lib/virtual-io/Cargo.toml b/lib/virtual-io/Cargo.toml index b071a6277c4..943fdcadd66 100644 --- a/lib/virtual-io/Cargo.toml +++ b/lib/virtual-io/Cargo.toml @@ -17,7 +17,6 @@ tracing = "0.1" mio = { workspace = true, features = ["os-poll"], optional = true } socket2 = { workspace = true, optional = true } -derivative = { version = "^2" } futures = { version = "0.3" } serde = { version = "1.0", default-features = false, features = ["derive"] } diff --git a/lib/virtual-io/src/arc.rs b/lib/virtual-io/src/arc.rs index 7abc45f58c0..532ac6fb889 100644 --- a/lib/virtual-io/src/arc.rs +++ b/lib/virtual-io/src/arc.rs @@ -1,14 +1,10 @@ use std::sync::Arc; use std::sync::Mutex; -use derivative::Derivative; - use crate::{InterestHandler, InterestType}; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] struct ArcInterestHandlerState { - #[derivative(Debug = "ignore")] handler: Box, } diff --git a/lib/virtual-io/src/interest.rs b/lib/virtual-io/src/interest.rs index 61763e99e08..7cf0529cddb 100644 --- a/lib/virtual-io/src/interest.rs +++ b/lib/virtual-io/src/interest.rs @@ -5,8 +5,6 @@ use std::{ task::{Context, RawWaker, RawWakerVTable, Waker}, }; -use derivative::Derivative; - #[derive(Debug, Clone, Serialize, Deserialize, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum InterestType { Readable, @@ -71,7 +69,7 @@ impl InterestHandler for SharedWakerInterestHandler { } } -pub trait InterestHandler: Send + Sync { +pub trait InterestHandler: Send + Sync + std::fmt::Debug { fn push_interest(&mut self, interest: InterestType); fn pop_interest(&mut self, interest: InterestType) -> bool; @@ -101,10 +99,8 @@ pub fn handler_into_waker( }) } -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct InterestHandlerWaker { - #[derivative(Debug = "ignore")] handler: Arc>>, interest: InterestType, } diff --git a/lib/virtual-io/src/selector.rs b/lib/virtual-io/src/selector.rs index 3ea1b2f3993..0f939b74a19 100644 --- a/lib/virtual-io/src/selector.rs +++ b/lib/virtual-io/src/selector.rs @@ -4,22 +4,18 @@ use std::{ sync::{Arc, Mutex}, }; -use derivative::Derivative; use mio::{Registry, Token}; use crate::{InterestHandler, InterestType}; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub(crate) struct EngineInner { seed: usize, registry: Registry, - #[derivative(Debug = "ignore")] lookup: HashMap>, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct Selector { token_close: Token, inner: Mutex, diff --git a/lib/virtual-net/Cargo.toml b/lib/virtual-net/Cargo.toml index a2a1a1d3555..f9370c4578c 100644 --- a/lib/virtual-net/Cargo.toml +++ b/lib/virtual-net/Cargo.toml @@ -22,7 +22,7 @@ tokio = { workspace = true, default-features = false, features = ["io-util"] } libc = { workspace = true, optional = true } mio = { workspace = true, optional = true } socket2 = { workspace = true, optional = true } -derivative = { version = "^2" } +derive_more.workspace = true virtual-mio = { path = "../virtual-io", version = "0.5.0", default-features = false } bincode = { version = "1.3" } serde = { version = "1.0", default-features = false, features = ["derive"] } diff --git a/lib/virtual-net/src/client.rs b/lib/virtual-net/src/client.rs index 773c86749f1..ead08baadcc 100644 --- a/lib/virtual-net/src/client.rs +++ b/lib/virtual-net/src/client.rs @@ -17,7 +17,6 @@ use std::time::Duration; use bytes::Buf; use bytes::BytesMut; -use derivative::Derivative; use futures_util::future::BoxFuture; use futures_util::stream::FuturesOrdered; use futures_util::Sink; @@ -530,12 +529,11 @@ struct SocketWithAddr { } type SocketMap = HashMap; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(derive_more::Debug)] struct RemoteCommon { - #[derivative(Debug = "ignore")] + #[debug(ignore)] tx: RemoteTx, - #[derivative(Debug = "ignore")] + #[debug(ignore)] rx: Mutex>, request_seed: AtomicU64, requests: Mutex>, @@ -544,7 +542,7 @@ struct RemoteCommon { recv_with_addr_tx: Mutex>>, accept_tx: Mutex>>, sent_tx: Mutex>>, - #[derivative(Debug = "ignore")] + #[debug(ignore)] handlers: Mutex>>, // The stall guard will prevent reads while its held and there are background tasks running diff --git a/lib/virtual-net/src/composite.rs b/lib/virtual-net/src/composite.rs index 6901bca32b7..4a1eea08d85 100644 --- a/lib/virtual-net/src/composite.rs +++ b/lib/virtual-net/src/composite.rs @@ -2,13 +2,10 @@ use std::net::SocketAddr; use std::task::{Context, Poll}; use crate::{Ipv4Addr, Ipv6Addr, NetworkError, VirtualIoSource, VirtualTcpListener}; -use derivative::Derivative; use virtual_mio::ArcInterestHandler; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct CompositeTcpListener { - #[derivative(Debug = "ignore")] ports: Vec>, } diff --git a/lib/virtual-net/src/host.rs b/lib/virtual-net/src/host.rs index 3fd1000d7bc..0a168f8fd09 100644 --- a/lib/virtual-net/src/host.rs +++ b/lib/virtual-net/src/host.rs @@ -7,7 +7,6 @@ use crate::{ VirtualSocket, VirtualTcpListener, VirtualTcpSocket, VirtualUdpSocket, }; use bytes::{Buf, BytesMut}; -use derivative::Derivative; use std::collections::VecDeque; use std::io::{self, Read, Write}; use std::mem::MaybeUninit; @@ -29,8 +28,7 @@ use virtual_mio::{ state_as_waker_map, HandlerGuardState, InterestGuard, InterestHandler, InterestType, Selector, }; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct LocalNetworking { selector: Arc, handle: Handle, @@ -148,8 +146,7 @@ impl VirtualNetworking for LocalNetworking { } } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct LocalTcpListener { stream: mio::net::TcpListener, selector: Arc, diff --git a/lib/virtual-net/src/loopback.rs b/lib/virtual-net/src/loopback.rs index 93a68b10ad0..b59519790bc 100644 --- a/lib/virtual-net/src/loopback.rs +++ b/lib/virtual-net/src/loopback.rs @@ -9,7 +9,6 @@ use crate::{ InterestHandler, IpAddr, IpCidr, Ipv4Addr, Ipv6Addr, NetworkError, VirtualIoSource, VirtualNetworking, VirtualTcpListener, VirtualTcpSocket, }; -use derivative::Derivative; use virtual_mio::InterestType; const DEFAULT_MAX_BUFFER_SIZE: usize = 1_048_576; @@ -136,10 +135,8 @@ impl VirtualNetworking for LoopbackNetworking { } } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] struct LoopbackTcpListenerState { - #[derivative(Debug = "ignore")] handler: Option>, addr_local: SocketAddr, backlog: VecDeque, diff --git a/lib/virtual-net/src/rx_tx.rs b/lib/virtual-net/src/rx_tx.rs index 17fbf21a431..9d5d978778d 100644 --- a/lib/virtual-net/src/rx_tx.rs +++ b/lib/virtual-net/src/rx_tx.rs @@ -62,6 +62,7 @@ impl AsyncWrite for FailOnWrite { pub(crate) type StreamSink = Pin + Send + 'static>>; +#[derive(derive_more::Debug)] pub(crate) enum RemoteTx where T: Serialize, @@ -72,6 +73,7 @@ where wakers: RemoteTxWakers, }, Stream { + #[debug(ignore)] tx: Arc>>, work: mpsc::UnboundedSender>, wakers: RemoteTxWakers, @@ -504,6 +506,7 @@ where } } +#[derive(derive_more::Debug)] pub(crate) enum RemoteRx where T: serde::de::DeserializeOwned, @@ -513,6 +516,7 @@ where wakers: RemoteTxWakers, }, Stream { + #[debug(ignore)] rx: Pin> + Send + 'static>>, }, #[cfg(feature = "hyper")] diff --git a/lib/virtual-net/src/server.rs b/lib/virtual-net/src/server.rs index 2f0bcc44471..2d29b64da2b 100644 --- a/lib/virtual-net/src/server.rs +++ b/lib/virtual-net/src/server.rs @@ -5,7 +5,6 @@ use crate::{ VirtualNetworking, VirtualRawSocket, VirtualTcpListener, VirtualTcpSocket, VirtualUdpSocket, }; use crate::{IpCidr, IpRoute, NetworkError, StreamSecurity, VirtualIcmpSocket}; -use derivative::Derivative; use futures_util::stream::FuturesOrdered; #[cfg(any(feature = "hyper", feature = "tokio-tungstenite"))] use futures_util::stream::{SplitSink, SplitStream}; @@ -1223,6 +1222,7 @@ impl RemoteNetworkingServerDriver { } } +#[derive(Debug)] enum RemoteAdapterSocket { TcpListener { socket: Box, @@ -1616,14 +1616,10 @@ impl InterestHandler for RemoteAdapterHandler { type SocketMap = HashMap; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] struct RemoteAdapterCommon { - #[derivative(Debug = "ignore")] tx: RemoteTx, - #[derivative(Debug = "ignore")] rx: Mutex>, - #[derivative(Debug = "ignore")] sockets: Mutex>, socket_accept: Mutex>, handler: RemoteAdapterHandler, diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 11a219ba6f1..d6bfd555daa 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -28,7 +28,6 @@ scopeguard = "1.1.0" lazy_static = "1.4.0" region = { version = "3.0.2" } corosensei = { version = "0.2.0" } -derivative = { version = "^2" } fnv = "1.0.3" # - Optional shared dependencies. tracing = { version = "0.1", optional = true } diff --git a/lib/vm/src/export.rs b/lib/vm/src/export.rs index 462725ccb6d..6c79c9535d5 100644 --- a/lib/vm/src/export.rs +++ b/lib/vm/src/export.rs @@ -7,7 +7,6 @@ use crate::store::InternalStoreHandle; use crate::table::VMTable; use crate::vmcontext::VMFunctionKind; use crate::{MaybeInstanceOwned, VMCallerCheckedAnyfunc}; -use derivative::Derivative; use std::any::Any; use wasmer_types::FunctionType; @@ -28,12 +27,10 @@ pub enum VMExtern { } /// A function export value. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct VMFunction { /// Pointer to the `VMCallerCheckedAnyfunc` which contains data needed to /// call the function and check its signature. - #[derivative(Debug = "ignore")] pub anyfunc: MaybeInstanceOwned, /// The function type, used for compatibility checking. @@ -44,6 +41,5 @@ pub struct VMFunction { pub kind: VMFunctionKind, /// Associated data owned by a host function. - #[derivative(Debug = "ignore")] pub host_data: Box, } diff --git a/lib/vm/src/extern_ref.rs b/lib/vm/src/extern_ref.rs index 79f71b876b2..b14760f9a9e 100644 --- a/lib/vm/src/extern_ref.rs +++ b/lib/vm/src/extern_ref.rs @@ -1,14 +1,11 @@ -use derivative::Derivative; use std::any::Any; use wasmer_types::RawValue; use crate::store::InternalStoreHandle; /// Underlying object referenced by a `VMExternRef`. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct VMExternObj { - #[derivative(Debug = "ignore")] contents: Box, } diff --git a/lib/vm/src/function_env.rs b/lib/vm/src/function_env.rs index f2f8b728408..1ca855443ef 100644 --- a/lib/vm/src/function_env.rs +++ b/lib/vm/src/function_env.rs @@ -1,14 +1,18 @@ -use derivative::Derivative; use std::any::Any; /// Underlying FunctionEnvironment used by a `VMFunction`. -#[derive(Derivative)] -#[derivative(Debug)] pub struct VMFunctionEnvironment { - #[derivative(Debug = "ignore")] contents: Box, } +impl std::fmt::Debug for VMFunctionEnvironment { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("VMFunctionEnvironment") + .field("contents", &(&*self.contents as *const _)) + .finish() + } +} + impl VMFunctionEnvironment { /// Wraps the given value to expose it to Wasm code as a function context. pub fn new(val: impl Any + Send + 'static) -> Self { diff --git a/lib/vm/src/global.rs b/lib/vm/src/global.rs index bddb55575e1..1743f2c0aab 100644 --- a/lib/vm/src/global.rs +++ b/lib/vm/src/global.rs @@ -1,14 +1,11 @@ use crate::{store::MaybeInstanceOwned, vmcontext::VMGlobalDefinition}; -use derivative::Derivative; use std::{cell::UnsafeCell, ptr::NonNull}; use wasmer_types::GlobalType; /// A Global instance -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct VMGlobal { ty: GlobalType, - #[derivative(Debug = "ignore")] vm_global_definition: MaybeInstanceOwned, } diff --git a/lib/vm/src/table.rs b/lib/vm/src/table.rs index 523f15326cb..51c70c84449 100644 --- a/lib/vm/src/table.rs +++ b/lib/vm/src/table.rs @@ -10,7 +10,6 @@ use crate::vmcontext::VMTableDefinition; use crate::Trap; use crate::VMExternRef; use crate::VMFuncRef; -use derivative::Derivative; use std::cell::UnsafeCell; use std::convert::TryFrom; use std::fmt; @@ -70,17 +69,14 @@ impl Default for TableElement { } /// A table instance. -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct VMTable { - #[derivative(Debug = "ignore")] vec: Vec, maximum: Option, /// The WebAssembly table description. table: TableType, /// Our chosen implementation style. style: TableStyle, - #[derivative(Debug = "ignore")] vm_table_definition: MaybeInstanceOwned, } diff --git a/lib/wasix/Cargo.toml b/lib/wasix/Cargo.toml index 0db1b245731..f6b8493fb54 100644 --- a/lib/wasix/Cargo.toml +++ b/lib/wasix/Cargo.toml @@ -40,6 +40,7 @@ serde_yaml.workspace = true rkyv.workspace = true shared-buffer.workspace = true hyper = { workspace = true, features = ["server"], optional = true } +derive_more.workspace = true xxhash-rust = { version = "0.8.8", features = ["xxh64"] } rusty_pool = { version = "0.7.0", optional = true } @@ -55,7 +56,6 @@ chrono = { version = "^0.4.38", default-features = false, features = [ "std", "clock", ], optional = true } -derivative = { version = "^2" } bytes = "1" anyhow = { version = "1.0.66" } lazy_static = "1.4" diff --git a/lib/wasix/src/bin_factory/binary_package.rs b/lib/wasix/src/bin_factory/binary_package.rs index 9d94a64f09b..5653f3bb409 100644 --- a/lib/wasix/src/bin_factory/binary_package.rs +++ b/lib/wasix/src/bin_factory/binary_package.rs @@ -1,7 +1,6 @@ use std::{path::Path, sync::Arc}; use anyhow::Context; -use derivative::*; use once_cell::sync::OnceCell; use sha2::Digest; use virtual_fs::FileSystem; @@ -17,12 +16,11 @@ use crate::{ }; use wasmer_types::ModuleHash; -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(derive_more::Debug, Clone)] pub struct BinaryPackageCommand { name: String, metadata: webc::metadata::Command, - #[derivative(Debug = "ignore")] + #[debug(ignore)] pub(crate) atom: SharedBytes, hash: ModuleHash, } @@ -64,8 +62,7 @@ impl BinaryPackageCommand { } /// A WebAssembly package that has been loaded into memory. -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct BinaryPackage { pub id: PackageId, /// Includes the ids of all the packages in the tree diff --git a/lib/wasix/src/net/socket.rs b/lib/wasix/src/net/socket.rs index 73832318eef..42b5881d802 100644 --- a/lib/wasix/src/net/socket.rs +++ b/lib/wasix/src/net/socket.rs @@ -9,7 +9,6 @@ use std::{ time::Duration, }; -use derivative::Derivative; #[cfg(feature = "enable-serde")] use serde_derive::{Deserialize, Serialize}; use virtual_mio::InterestHandler; @@ -33,8 +32,7 @@ pub enum InodeHttpSocketType { Headers, } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct SocketProperties { pub family: Addressfamily, pub ty: Socktype, @@ -51,7 +49,6 @@ pub struct SocketProperties { pub read_timeout: Option, pub accept_timeout: Option, pub connect_timeout: Option, - #[derivative(Debug = "ignore")] pub handler: Option>, } diff --git a/lib/wasix/src/os/console/mod.rs b/lib/wasix/src/os/console/mod.rs index ca63393c32c..fb91145e375 100644 --- a/lib/wasix/src/os/console/mod.rs +++ b/lib/wasix/src/os/console/mod.rs @@ -12,7 +12,6 @@ use std::{ sync::{atomic::AtomicBool, Arc, Mutex}, }; -use derivative::*; use linked_hash_set::LinkedHashSet; use tokio::sync::{mpsc, RwLock}; #[allow(unused_imports, dead_code)] @@ -35,8 +34,7 @@ use crate::{ Runtime, SpawnError, WasiEnv, WasiEnvBuilder, WasiRuntimeError, }; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct Console { user_agent: Option, boot_cmd: String, diff --git a/lib/wasix/src/os/tty/mod.rs b/lib/wasix/src/os/tty/mod.rs index dc2ed6cf842..6755d9fb8b6 100644 --- a/lib/wasix/src/os/tty/mod.rs +++ b/lib/wasix/src/os/tty/mod.rs @@ -3,7 +3,6 @@ use std::{ sync::{Arc, Mutex}, }; -use derivative::*; use futures::future::BoxFuture; use virtual_fs::{AsyncWriteExt, NullFile, VirtualFile}; use wasmer_wasix_types::wasi::{Signal, Snapshot0Clockid}; @@ -113,8 +112,7 @@ impl TtyOptions { } } -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct Tty { stdin: Box, stdout: Box, @@ -444,7 +442,7 @@ impl Default for WasiTtyState { } /// Provides access to a TTY. -pub trait TtyBridge { +pub trait TtyBridge: std::fmt::Debug { /// Resets the values fn reset(&self); diff --git a/lib/wasix/src/runners/dcgi/callbacks.rs b/lib/wasix/src/runners/dcgi/callbacks.rs index 87b430b5c3a..fe8604c4950 100644 --- a/lib/wasix/src/runners/dcgi/callbacks.rs +++ b/lib/wasix/src/runners/dcgi/callbacks.rs @@ -1,16 +1,12 @@ use std::sync::Arc; -use derivative::Derivative; - use super::*; use crate::runners::wcgi::{self, CreateEnvConfig, CreateEnvResult, RecycleEnvConfig}; use virtual_fs::NullFile; use wasmer_wasix_types::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO}; -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct DcgiCallbacks { - #[derivative(Debug = "ignore")] inner: Arc, factory: DcgiInstanceFactory, } diff --git a/lib/wasix/src/runners/dcgi/factory.rs b/lib/wasix/src/runners/dcgi/factory.rs index 9e10a74f09b..6496f9ee9bc 100644 --- a/lib/wasix/src/runners/dcgi/factory.rs +++ b/lib/wasix/src/runners/dcgi/factory.rs @@ -1,6 +1,5 @@ use std::sync::{Arc, Mutex}; -use derivative::Derivative; use virtual_fs::Pipe; use wasmer_wasix_types::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO}; @@ -20,8 +19,7 @@ struct State { /// This factory will store and reuse instances between invocations thus /// allowing for the instances to be stateful. -#[derive(Derivative, Clone, Default)] -#[derivative(Debug)] +#[derive(Debug, Clone, Default)] pub struct DcgiInstanceFactory { state: Arc>, } diff --git a/lib/wasix/src/runners/dcgi/handler.rs b/lib/wasix/src/runners/dcgi/handler.rs index b6415eb8118..3c24db353c2 100644 --- a/lib/wasix/src/runners/dcgi/handler.rs +++ b/lib/wasix/src/runners/dcgi/handler.rs @@ -53,8 +53,7 @@ impl Deref for Handler { } } -#[derive(derivative::Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub(crate) struct SharedState { pub(crate) inner: Arc, factory: DcgiInstanceFactory, diff --git a/lib/wasix/src/runners/dproxy/factory.rs b/lib/wasix/src/runners/dproxy/factory.rs index 1833a781ca1..88554d5d6c6 100644 --- a/lib/wasix/src/runners/dproxy/factory.rs +++ b/lib/wasix/src/runners/dproxy/factory.rs @@ -5,7 +5,6 @@ use std::{ time::Instant, }; -use derivative::Derivative; use hyper_util::rt::TokioExecutor; use wasmer_journal::{DynJournal, RecombinedJournal}; @@ -26,8 +25,7 @@ struct State { /// This factory will store and reuse instances between invocations thus /// allowing for the instances to be stateful. -#[derive(Derivative, Clone, Default)] -#[derivative(Debug)] +#[derive(Debug, Clone, Default)] pub struct DProxyInstanceFactory { state: Arc>, } diff --git a/lib/wasix/src/runners/dproxy/handler.rs b/lib/wasix/src/runners/dproxy/handler.rs index 0d83d053eb8..7cc283b88c8 100644 --- a/lib/wasix/src/runners/dproxy/handler.rs +++ b/lib/wasix/src/runners/dproxy/handler.rs @@ -14,12 +14,10 @@ use crate::Runtime; use super::factory::DProxyInstanceFactory; use super::Config; -#[derive(derivative::Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct SharedState { pub(crate) config: Config, pub(crate) command_name: String, - #[derivative(Debug = "ignore")] pub(crate) runtime: Arc, pub(crate) factory: DProxyInstanceFactory, } diff --git a/lib/wasix/src/runners/dproxy/socket_manager.rs b/lib/wasix/src/runners/dproxy/socket_manager.rs index 658832fde1a..801a96e4852 100644 --- a/lib/wasix/src/runners/dproxy/socket_manager.rs +++ b/lib/wasix/src/runners/dproxy/socket_manager.rs @@ -9,17 +9,15 @@ use std::{ time::Duration, }; -use derivative::Derivative; use tokio::sync::broadcast; use virtual_net::{tcp_pair::TcpSocketHalf, LoopbackNetworking}; pub type PollListeningFn = Arc) -> Poll + Send + Sync + 'static>; -#[derive(Derivative)] -#[derivative(Debug)] +#[derive(derive_more::Debug)] pub struct SocketManager { - #[derivative(Debug = "ignore")] + #[debug(ignore)] poll_listening: PollListeningFn, loopback_networking: LoopbackNetworking, proxy_connect_init_timeout: Duration, diff --git a/lib/wasix/src/runners/wasi_common.rs b/lib/wasix/src/runners/wasi_common.rs index 3606f131e55..e50f2deffb2 100644 --- a/lib/wasix/src/runners/wasi_common.rs +++ b/lib/wasix/src/runners/wasi_common.rs @@ -5,7 +5,6 @@ use std::{ }; use anyhow::{Context, Error}; -use derivative::Derivative; use futures::future::BoxFuture; use tokio::runtime::Handle; use virtual_fs::{FileSystem, FsError, OverlayFileSystem, RootFileSystemBuilder, TmpFileSystem}; @@ -29,8 +28,7 @@ pub struct MappedCommand { pub target: String, } -#[derive(Derivative, Default, Clone)] -#[derivative(Debug)] +#[derive(Debug, Default, Clone)] pub(crate) struct CommonWasiOptions { pub(crate) entry_function: Option, pub(crate) args: Vec, @@ -42,7 +40,6 @@ pub(crate) struct CommonWasiOptions { pub(crate) is_tmp_mapped: bool, pub(crate) injected_packages: Vec, pub(crate) capabilities: Capabilities, - #[derivative(Debug = "ignore")] pub(crate) journals: Vec>, pub(crate) snapshot_on: Vec, pub(crate) snapshot_interval: Option, diff --git a/lib/wasix/src/runners/wcgi/callbacks.rs b/lib/wasix/src/runners/wcgi/callbacks.rs index 80fb68955b3..9d95d4f399f 100644 --- a/lib/wasix/src/runners/wcgi/callbacks.rs +++ b/lib/wasix/src/runners/wcgi/callbacks.rs @@ -36,7 +36,7 @@ pub struct RecycleEnvConfig { /// Callbacks that are triggered at various points in the lifecycle of a runner /// and any WebAssembly instances it may start. #[async_trait::async_trait] -pub trait Callbacks: Send + Sync + 'static { +pub trait Callbacks: std::fmt::Debug + Send + Sync + 'static { /// A callback that is called whenever the server starts. fn started(&self, _abort: AbortHandle) {} @@ -57,6 +57,7 @@ pub trait Callbacks: Send + Sync + 'static { } } +#[derive(Debug)] pub struct NoOpWcgiCallbacks; impl Callbacks for NoOpWcgiCallbacks {} diff --git a/lib/wasix/src/runners/wcgi/handler.rs b/lib/wasix/src/runners/wcgi/handler.rs index 1a90b68f79e..b7ec1c956b3 100644 --- a/lib/wasix/src/runners/wcgi/handler.rs +++ b/lib/wasix/src/runners/wcgi/handler.rs @@ -318,19 +318,16 @@ async fn consume_stderr( pub type SetupBuilder = Arc Result<(), anyhow::Error> + Send + Sync>; -#[derive(derivative::Derivative)] -#[derivative(Debug)] +#[derive(derive_more::Debug)] pub(crate) struct SharedState { pub(crate) module: Module, pub(crate) module_hash: ModuleHash, pub(crate) dialect: CgiDialect, pub(crate) program_name: String, pub(crate) propagate_stderr: bool, - #[derivative(Debug = "ignore")] + #[debug(ignore)] pub(crate) setup_builder: SetupBuilder, - #[derivative(Debug = "ignore")] pub(crate) callbacks: Arc, - #[derivative(Debug = "ignore")] pub(crate) runtime: Arc, } diff --git a/lib/wasix/src/runners/wcgi/runner.rs b/lib/wasix/src/runners/wcgi/runner.rs index e95b0685b4d..6779ad8febe 100644 --- a/lib/wasix/src/runners/wcgi/runner.rs +++ b/lib/wasix/src/runners/wcgi/runner.rs @@ -200,12 +200,10 @@ impl crate::runners::Runner for WcgiRunner { } } -#[derive(derivative::Derivative)] -#[derivative(Debug)] +#[derive(Debug)] pub struct Config { pub(crate) wasi: CommonWasiOptions, pub(crate) addr: SocketAddr, - #[derivative(Debug = "ignore")] pub(crate) callbacks: Arc, } diff --git a/lib/wasix/src/runtime/mod.rs b/lib/wasix/src/runtime/mod.rs index a5c4f66363a..3cf3457c98d 100644 --- a/lib/wasix/src/runtime/mod.rs +++ b/lib/wasix/src/runtime/mod.rs @@ -13,7 +13,6 @@ use std::{ sync::{Arc, Mutex}, }; -use derivative::Derivative; use futures::future::BoxFuture; use virtual_net::{DynVirtualNetworking, VirtualNetworking}; use wasmer::{Module, RuntimeError}; @@ -205,8 +204,7 @@ impl TtyBridge for DefaultTty { } } -#[derive(Clone, Derivative)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct PluggableRuntime { pub rt: Arc, pub networking: DynVirtualNetworking, @@ -215,10 +213,8 @@ pub struct PluggableRuntime { pub source: Arc, pub engine: Option, pub module_cache: Arc, - #[derivative(Debug = "ignore")] pub tty: Option>, #[cfg(feature = "journal")] - #[derivative(Debug = "ignore")] pub journals: Vec>, } @@ -366,8 +362,7 @@ impl Runtime for PluggableRuntime { /// Runtime that allows for certain things to be overridden /// such as the active journals -#[derive(Clone, Derivative)] -#[derivative(Debug)] +#[derive(Clone, Debug)] pub struct OverriddenRuntime { inner: Arc, task_manager: Option>, @@ -377,10 +372,8 @@ pub struct OverriddenRuntime { source: Option>, engine: Option, module_cache: Option>, - #[derivative(Debug = "ignore")] tty: Option>, #[cfg(feature = "journal")] - #[derivative(Debug = "ignore")] journals: Option>>, } diff --git a/lib/wasix/src/runtime/task_manager/mod.rs b/lib/wasix/src/runtime/task_manager/mod.rs index cf9c071c163..a5d86f234a0 100644 --- a/lib/wasix/src/runtime/task_manager/mod.rs +++ b/lib/wasix/src/runtime/task_manager/mod.rs @@ -7,7 +7,6 @@ use std::task::{Context, Poll}; use std::{pin::Pin, time::Duration}; use bytes::Bytes; -use derivative::Derivative; use futures::future::BoxFuture; use futures::{Future, TryFutureExt}; use wasmer::{AsStoreMut, AsStoreRef, Memory, MemoryType, Module, Store, StoreMut, StoreRef}; @@ -39,8 +38,7 @@ pub type WasmResumeTrigger = dyn FnOnce() -> Pin>, /// The instance will be recycled back to this function when the WASM run has finished - #[derivative(Debug = "ignore")] + #[debug(ignore)] pub recycle: Option>, } diff --git a/lib/wasix/src/state/env.rs b/lib/wasix/src/state/env.rs index fcd34a0e341..0f4f440e409 100644 --- a/lib/wasix/src/state/env.rs +++ b/lib/wasix/src/state/env.rs @@ -6,7 +6,6 @@ use std::{ time::Duration, }; -use derivative::Derivative; use futures::future::BoxFuture; use rand::Rng; use virtual_fs::{FileSystem, FsError, StaticFile, VirtualFile}; @@ -49,8 +48,7 @@ use super::{conv_env_vars, WasiState}; /// /// Used to access and modify runtime state. // TODO: make fields private -#[derive(Derivative, Clone)] -#[derivative(Debug)] +#[derive(Debug, Clone)] pub struct WasiInstanceHandles { // TODO: the two fields below are instance specific, while all others are module specific. // Should be split up. @@ -71,11 +69,9 @@ pub struct WasiInstanceHandles { pub(crate) stack_high: Option, /// Main function that will be invoked (name = "_start") - #[derivative(Debug = "ignore")] pub(crate) start: Option>, /// Function thats invoked to initialize the WASM module (name = "_initialize") - #[derivative(Debug = "ignore")] // TODO: review allow... #[allow(dead_code)] pub(crate) initialize: Option>, @@ -83,12 +79,10 @@ pub struct WasiInstanceHandles { /// Represents the callback for spawning a thread (name = "wasi_thread_start") /// (due to limitations with i64 in browsers the parameters are broken into i32 pairs) /// [this takes a user_data field] - #[derivative(Debug = "ignore")] pub(crate) thread_spawn: Option>, /// Represents the callback for signals (name = "__wasm_signal") /// Signals are triggered asynchronously at idle times of the process - #[derivative(Debug = "ignore")] pub(crate) signal: Option>, /// Flag that indicates if the signal callback has been set by the WASM @@ -103,7 +97,6 @@ pub struct WasiInstanceHandles { /// asyncify_start_unwind(data : i32): call this to start unwinding the /// stack from the current location. "data" must point to a data /// structure as described above (with fields containing valid data). - #[derivative(Debug = "ignore")] // TODO: review allow... #[allow(dead_code)] pub(crate) asyncify_start_unwind: Option>, @@ -115,7 +108,6 @@ pub struct WasiInstanceHandles { /// "sleep", then you must call this at the proper time. Otherwise, /// the code will think it is still unwinding when it should not be, /// which means it will keep unwinding in a meaningless way. - #[derivative(Debug = "ignore")] // TODO: review allow... #[allow(dead_code)] pub(crate) asyncify_stop_unwind: Option>, @@ -124,14 +116,12 @@ pub struct WasiInstanceHandles { /// stack vack up to the location stored in the provided data. This prepares /// for the rewind; to start it, you must call the first function in the /// call stack to be unwound. - #[derivative(Debug = "ignore")] // TODO: review allow... #[allow(dead_code)] pub(crate) asyncify_start_rewind: Option>, /// asyncify_stop_rewind(): call this to note that rewinding has /// concluded, and normal execution can resume. - #[derivative(Debug = "ignore")] // TODO: review allow... #[allow(dead_code)] pub(crate) asyncify_stop_rewind: Option>, @@ -142,7 +132,6 @@ pub struct WasiInstanceHandles { /// calls, so that you know when to start an asynchronous operation and /// when to propagate results back. #[allow(dead_code)] - #[derivative(Debug = "ignore")] pub(crate) asyncify_get_state: Option>, } diff --git a/lib/wasix/src/syscalls/wasix/epoll_ctl.rs b/lib/wasix/src/syscalls/wasix/epoll_ctl.rs index 19e9fa9835e..6f0e829b8c8 100644 --- a/lib/wasix/src/syscalls/wasix/epoll_ctl.rs +++ b/lib/wasix/src/syscalls/wasix/epoll_ctl.rs @@ -164,6 +164,8 @@ impl EpollJoinWaker { unsafe { Waker::from_raw(raw_waker) } } } + +#[derive(Debug)] pub struct EpollHandler { fd: WasiFd, tx: Arc>, diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml index afe19cff59f..6cc9e832d15 100644 --- a/tests/integration/cli/Cargo.toml +++ b/tests/integration/cli/Cargo.toml @@ -32,7 +32,6 @@ target-lexicon = "0.12.5" tar = "0.4.38" flate2 = "1.0.24" dirs = "4.0.0" -derivative = { version = "^2" } [features] default = ["webc_runner"] diff --git a/tests/integration/cli/tests/snapshot.rs b/tests/integration/cli/tests/snapshot.rs index 570c1b390a0..5f6c845254b 100644 --- a/tests/integration/cli/tests/snapshot.rs +++ b/tests/integration/cli/tests/snapshot.rs @@ -7,22 +7,25 @@ use std::{ }; use anyhow::Error; -use derivative::Derivative; use futures::TryFutureExt; use insta::assert_json_snapshot; use tempfile::NamedTempFile; use wasmer_integration_tests_cli::get_wasmer_path; -#[derive(Derivative, serde::Serialize, serde::Deserialize, Clone)] -#[derivative(Debug, PartialEq)] +#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)] pub struct TestIncludeWeb { pub name: String, - #[derivative(Debug = "ignore", PartialEq = "ignore")] #[serde(skip, default = "default_include_webc")] pub webc: Arc, } +impl PartialEq for TestIncludeWeb { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } +} + fn default_include_webc() -> Arc { Arc::new(NamedTempFile::new().unwrap()) }