Skip to content

Commit 881a535

Browse files
committed
Remove paste dependency from Wasmtime
Looks like this is no longer maintained (bytecodealliance#10356) and with some rejiggering this isn't actually necessary too.
1 parent e8d5e3a commit 881a535

File tree

4 files changed

+54
-17
lines changed

4 files changed

+54
-17
lines changed

Cargo.lock

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

crates/wasmtime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ serde_json = { workspace = true, optional = true }
4747
sptr = { workspace = true }
4848
postcard = { workspace = true }
4949
indexmap = { workspace = true }
50-
paste = "1.0.3"
5150
once_cell = { version = "1.12.0", optional = true }
5251
rayon = { version = "1.0", optional = true }
5352
object = { workspace = true }

crates/wasmtime/src/runtime/component/func/typed.rs

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ unsafe impl<T> ComponentType for Option<T>
19081908
where
19091909
T: ComponentType,
19101910
{
1911-
type Lower = TupleLower2<<u32 as ComponentType>::Lower, T::Lower>;
1911+
type Lower = TupleLower<<u32 as ComponentType>::Lower, T::Lower>;
19121912

19131913
const ABI: CanonicalAbiInfo = CanonicalAbiInfo::variant_static(&[None, Some(T::ABI)]);
19141914

@@ -2330,22 +2330,61 @@ where
23302330
unsafe { MaybeUninit::uninit().assume_init() }
23312331
}
23322332

2333-
macro_rules! impl_component_ty_for_tuples {
2334-
($n:tt $($t:ident)*) => {paste::paste!{
2335-
#[allow(non_snake_case)]
2336-
#[doc(hidden)]
2337-
#[derive(Clone, Copy)]
2338-
#[repr(C)]
2339-
pub struct [<TupleLower$n>]<$($t),*> {
2340-
$($t: $t,)*
2341-
_align_tuple_lower0_correctly: [ValRaw; 0],
2342-
}
2333+
/// Helper structure to define `Lower` for tuples below.
2334+
///
2335+
/// Uses default type parameters to have fields be zero-sized and not present
2336+
/// in memory for smaller tuple values.
2337+
#[allow(non_snake_case)]
2338+
#[doc(hidden)]
2339+
#[derive(Clone, Copy)]
2340+
#[repr(C)]
2341+
pub struct TupleLower<
2342+
T1 = (),
2343+
T2 = (),
2344+
T3 = (),
2345+
T4 = (),
2346+
T5 = (),
2347+
T6 = (),
2348+
T7 = (),
2349+
T8 = (),
2350+
T9 = (),
2351+
T10 = (),
2352+
T11 = (),
2353+
T12 = (),
2354+
T13 = (),
2355+
T14 = (),
2356+
T15 = (),
2357+
T16 = (),
2358+
T17 = (),
2359+
> {
2360+
// NB: these names match the names in `for_each_function_signature!`
2361+
A1: T1,
2362+
A2: T2,
2363+
A3: T3,
2364+
A4: T4,
2365+
A5: T5,
2366+
A6: T6,
2367+
A7: T7,
2368+
A8: T8,
2369+
A9: T9,
2370+
A10: T10,
2371+
A11: T11,
2372+
A12: T12,
2373+
A13: T13,
2374+
A14: T14,
2375+
A15: T15,
2376+
A16: T16,
2377+
A17: T17,
2378+
_align_tuple_lower0_correctly: [ValRaw; 0],
2379+
}
23432380

2381+
macro_rules! impl_component_ty_for_tuples {
2382+
($n:tt $($t:ident)*) => {
23442383
#[allow(non_snake_case)]
23452384
unsafe impl<$($t,)*> ComponentType for ($($t,)*)
23462385
where $($t: ComponentType),*
23472386
{
2348-
type Lower = [<TupleLower$n>]<$($t::Lower),*>;
2387+
type Lower = TupleLower<$($t::Lower),*>;
23492388

23502389
const ABI: CanonicalAbiInfo = CanonicalAbiInfo::record_static(&[
23512390
$($t::ABI),*
@@ -2453,7 +2492,7 @@ macro_rules! impl_component_ty_for_tuples {
24532492
unsafe impl<$($t,)*> ComponentNamedList for ($($t,)*)
24542493
where $($t: ComponentType),*
24552494
{}
2456-
}};
2495+
};
24572496
}
24582497

24592498
for_each_function_signature!(impl_component_ty_for_tuples);

crates/wasmtime/src/runtime/func.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ pub unsafe trait WasmTyList {
19831983
}
19841984

19851985
macro_rules! impl_wasm_ty_list {
1986-
($num:tt $($args:ident)*) => (paste::paste!{
1986+
($num:tt $($args:ident)*) => (
19871987
#[allow(non_snake_case)]
19881988
unsafe impl<$($args),*> WasmTyList for ($($args,)*)
19891989
where
@@ -2007,7 +2007,7 @@ macro_rules! impl_wasm_ty_list {
20072007
$( $args::may_gc() || )* false
20082008
}
20092009
}
2010-
});
2010+
);
20112011
}
20122012

20132013
for_each_function_signature!(impl_wasm_ty_list);

0 commit comments

Comments
 (0)