Stream: git-wasmtime

Topic: wasmtime / issue #11813 Create `Rooted<EqRef>` directly f...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2025 at 09:07):

Wybxc opened issue #11813:

Feature

eqref includes structref, arrayref, and i31ref, but currently only the first two can be directly cast to eqref in the host language. Methods should be provided to create eqref from i31ref in the host language.

Implementation

This should only require transmuting the internal value.

Alternatives

The current workaround is to convert to AnyRef and then to EqRef.

let value = 1i32;
let i31 = I31::new_i32(value).unwrap();
let any_ref = AnyRef::from_i31(&mut store, i31);
let eq_ref = value.unwrap_eqref(&mut store);

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2025 at 14:31):

alexcrichton added the wasmtime:api label to Issue #11813.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2025 at 14:31):

alexcrichton added the wasm-proposal:gc label to Issue #11813.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 17 2025 at 21:47):

fitzgen commented on issue #11813:

We can't transmute an I31 into a Rooted<EqRef>, as they have different representations, but we could certainly create a EqRef::from_i31(&mut store, my_i31) constructor. It should be pretty much identical to AnyRef::from_i31.

@Wybxc would you be up for sending a PR to implement this?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2025 at 05:06):

alexcrichton closed issue #11813:

Feature

eqref includes structref, arrayref, and i31ref, but currently only the first two can be directly cast to eqref in the host language. Methods should be provided to create eqref from i31ref in the host language.

Implementation

This should only require transmuting the internal value.

Alternatives

The current workaround is to convert to AnyRef and then to EqRef.

let value = 1i32;
let i31 = I31::new_i32(value).unwrap();
let any_ref = AnyRef::from_i31(&mut store, i31);
let eq_ref = value.unwrap_eqref(&mut store);

Last updated: Dec 06 2025 at 06:05 UTC