Skip to content

Commit 8d18537

Browse files
committed
add enough implementation to make wasmtime compile
1 parent 561697e commit 8d18537

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

crates/c-api/src/component/types/val.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub enum wasmtime_component_valtype_t {
3131
Future(Box<wasmtime_component_future_type_t>),
3232
Stream(Box<wasmtime_component_stream_type_t>),
3333
ErrorContext,
34+
FixedSizeList(Box<wasmtime_component_list_type_t>),
3435
}
3536

3637
impl From<Type> for wasmtime_component_valtype_t {
@@ -61,6 +62,7 @@ impl From<Type> for wasmtime_component_valtype_t {
6162
Type::Borrow(ty) => Self::Borrow(Box::new(ty.into())),
6263
Type::Future(ty) => Self::Future(Box::new(ty.into())),
6364
Type::Stream(ty) => Self::Stream(Box::new(ty.into())),
65+
Type::FixedSizeList(ty) => Self::FixedSizeList(Box::new(ty.into())),
6466
Type::ErrorContext => Self::ErrorContext,
6567
}
6668
}

crates/c-api/src/component/val.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ pub enum wasmtime_component_val_t {
234234
Result(wasmtime_component_valresult_t),
235235
Flags(wasmtime_component_valflags_t),
236236
Resource(Box<wasmtime_component_resource_any_t>),
237+
FixedSizeList(wasmtime_component_vallist_t),
237238
}
238239

239240
impl Default for wasmtime_component_val_t {
@@ -276,6 +277,7 @@ impl From<&wasmtime_component_val_t> for Val {
276277
wasmtime_component_val_t::Result(x) => Val::Result(x.into()),
277278
wasmtime_component_val_t::Flags(x) => Val::Flags(x.into()),
278279
wasmtime_component_val_t::Resource(x) => Val::Resource(x.resource),
280+
wasmtime_component_val_t::FixedSizeList(x) => Val::FixedSizeList(x.into()),
279281
}
280282
}
281283
}
@@ -317,6 +319,9 @@ impl From<&Val> for wasmtime_component_val_t {
317319
Val::Future(_) => todo!(),
318320
Val::Stream(_) => todo!(),
319321
Val::ErrorContext(_) => todo!(),
322+
Val::FixedSizeList(ty) => wasmtime_component_val_t::FixedSizeList(
323+
wasmtime_component_vallist_t::from(ty.as_ref()),
324+
),
320325
}
321326
}
322327
}

crates/fuzzing/src/oracles/component_api.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ fn arbitrary_val(ty: &component::Type, input: &mut Unstructured) -> arbitrary::R
117117
})
118118
.collect::<arbitrary::Result<_>>()?,
119119
),
120+
Type::FixedSizeList(list) => Val::FixedSizeList(
121+
(0..list.size())
122+
.map(|_| arbitrary_val(&list.ty(), input))
123+
.collect::<arbitrary::Result<_>>()?,
124+
),
120125

121126
// Resources, futures, streams, and error contexts aren't fuzzed at this time.
122127
Type::Own(_) | Type::Borrow(_) | Type::Future(_) | Type::Stream(_) | Type::ErrorContext => {

crates/wast/src/component.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ fn mismatch(expected: &ComponentConst<'_>, actual: &Val) -> Result<()> {
290290
Val::Future(..) => "future",
291291
Val::Stream(..) => "stream",
292292
Val::ErrorContext(..) => "error-context",
293+
Val::FixedSizeList(..) => "list<_, N>",
293294
};
294295
bail!("expected `{expected}` got `{actual}`")
295296
}

0 commit comments

Comments
 (0)