Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version.workspace = true
anyhow = { workspace = true, optional = true }
hashbrown = { workspace = true, features = ["default-hasher"] }
libm = { workspace = true }
serde = { workspace = true }
serde = { workspace = true, optional = true }

[lints]
workspace = true
Expand All @@ -26,3 +26,4 @@ backtrace = ["std"]
# Enable the `From<Error> for anyhow::Error` implementation and
# `Error::from_anyhow` constructor.
anyhow = ["dep:anyhow"]
serde = ["dep:serde"]
2 changes: 2 additions & 0 deletions crates/core/src/alloc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl From<inner::String> for TryString {
}
}

#[cfg(feature = "serde")]
impl serde::ser::Serialize for TryString {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand All @@ -76,6 +77,7 @@ impl serde::ser::Serialize for TryString {
}
}

#[cfg(feature = "serde")]
impl<'de> serde::de::Deserialize<'de> for TryString {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
9 changes: 6 additions & 3 deletions crates/core/src/alloc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ use crate::error::OutOfMemory;
use core::borrow::Borrow;
use core::{
cmp::Ordering,
fmt,
marker::PhantomData,
mem,
fmt, mem,
num::NonZeroUsize,
ops::{Deref, DerefMut, Index, IndexMut},
slice::SliceIndex,
};
#[cfg(feature = "serde")]
use serde::ser::SerializeSeq;
use std_alloc::alloc::Layout;
use std_alloc::boxed::Box;
Expand Down Expand Up @@ -389,6 +388,7 @@ impl<T> From<Box<[T]>> for TryVec<T> {
}
}

#[cfg(feature = "serde")]
impl<T> serde::ser::Serialize for TryVec<T>
where
T: serde::ser::Serialize,
Expand All @@ -405,6 +405,7 @@ where
}
}

#[cfg(feature = "serde")]
impl<'de, T> serde::de::Deserialize<'de> for TryVec<T>
where
T: serde::de::Deserialize<'de>,
Expand All @@ -413,6 +414,8 @@ where
where
D: serde::Deserializer<'de>,
{
use core::marker::PhantomData;

struct Visitor<T>(PhantomData<fn() -> TryVec<T>>);

impl<'de, T> serde::de::Visitor<'de> for Visitor<T>
Expand Down
2 changes: 1 addition & 1 deletion crates/environ/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ target-lexicon = { workspace = true }
wasm-encoder = { workspace = true, optional = true }
wasmprinter = { workspace = true, optional = true }
wasmtime-component-util = { workspace = true, optional = true }
wasmtime-core = { workspace = true }
wasmtime-core = { workspace = true, features = ['serde'] }
semver = { workspace = true, optional = true, features = ['serde'] }
smallvec = { workspace = true, features = ['serde'] }
sha2 = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/fuzzing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ wasmparser = { workspace = true }
wasmprinter = { workspace = true }
wasmtime-wast = { workspace = true, features = ['component-model'] }
wasmtime = { workspace = true, features = ['default', 'winch'] }
wasmtime-core = { workspace = true, features = ['backtrace'] }
wasmtime-core = { workspace = true, features = ['backtrace', 'serde'] }
wasm-encoder = { workspace = true }
wasm-smith = { workspace = true, features = ['serde'] }
wasm-mutate = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ wasmtime-component-macro = { workspace = true, optional = true }
wasmtime-component-util = { workspace = true, optional = true }
wasmtime-versioned-export-macros = { workspace = true }
wasmtime-wmemcheck = { workspace = true, optional = true }
wasmtime-core = { workspace = true }
wasmtime-core = { workspace = true, features = ['serde'] }
pulley-interpreter = { workspace = true }
target-lexicon = { workspace = true }
wasmparser = { workspace = true }
Expand Down