Stream: git-wasmtime

Topic: wasmtime / issue #14852 Export type ascription is ignored...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 20:46):

jrandolf opened issue #14852:

Wasmtime ignores the type ascription on component exports. For example:

(component
  (core module $m
    (func (export "f") (result i32) i32.const 1)
    (func (export "g") (result i32) i32.const 2))
  (core instance $i (instantiate $m))
  (func $f (result u32) (canon lift (core func $i "f")))
  (func $g (result u32) (canon lift (core func $i "g")))
  (instance $inst (export "f" (func $f)) (export "g" (func $g)))
  (export "hidden" (instance $inst) (instance (export "f" (func (result u32)))))
)

The ascription hides g, but component_type() still lists g under hidden, and the host can look it up with Instance::get_export_index(Some(&hidden), "g") and call it (it returns 2). Attributes that come from the ascription, such as (implements "..") or (external-id "..") on a nested export, are lost as well, and the same item can report different attributes depending on which path it's exported through.

It looks like translate.rs records (item, name) for exports and drops export.ty, and the root export types are then built from the definition rather than the ascribed type. Guests aren't affected; this is about what the embedder API exposes.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 19 2026 at 20:54):

alexcrichton added the wasm-proposal:component-model label to Issue #14852.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2026 at 20:18):

alexcrichton closed issue #14852:

Wasmtime ignores the type ascription on component exports. For example:

(component
  (core module $m
    (func (export "f") (result i32) i32.const 1)
    (func (export "g") (result i32) i32.const 2))
  (core instance $i (instantiate $m))
  (func $f (result u32) (canon lift (core func $i "f")))
  (func $g (result u32) (canon lift (core func $i "g")))
  (instance $inst (export "f" (func $f)) (export "g" (func $g)))
  (export "hidden" (instance $inst) (instance (export "f" (func (result u32)))))
)

The ascription hides g, but component_type() still lists g under hidden, and the host can look it up with Instance::get_export_index(Some(&hidden), "g") and call it (it returns 2). Attributes that come from the ascription, such as (implements "..") or (external-id "..") on a nested export, are lost as well, and the same item can report different attributes depending on which path it's exported through.

It looks like translate.rs records (item, name) for exports and drops export.ty, and the root export types are then built from the definition rather than the ascribed type. Guests aren't affected; this is about what the embedder API exposes.


Last updated: Oct 31 2026 at 23:03 UTC