Skip to content

Remove HeapType::ConcreteExn from the public API - #15099

Open
alexcrichton wants to merge 2 commits into
bytecodealliance:mainfrom
alexcrichton:remove-concrete-exn-in-api
Open

alexcrichton wants to merge 2 commits into
bytecodealliance:mainfrom
alexcrichton:remove-concrete-exn-in-api

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit removes the ConcreteExn variant from the public API of Wasmtime and its HeapType enum. I brought this up earlier in #14011 which was closed, but I'd like to push on this again at least from the angle of the public API of Wasmtime. Specifically this fixes a possible unusual situation where:

  • A host function is created with HeapType::ConcreteExn as one of its arguments.
  • This function is called with a different kind of concrete exception.
  • Due to a missing type check which in theory shouldn't actually be necessary, this actually passes at runtime.

There's no panic/etc here and this is just a weird situation, but this exposes a part of exposing ConcreteExn in the public API which is that it affects not just what's read from WebAssembly but what's also passed back in from the host. For example creating a GC struct type with concrete exception types doesn't really make sense, but it's possible with today's embedder API.

This change is not as invasive as #14011 and only limits the public API surface area of Wasmtime. The goal is to have the public API faithfully reflect wasm's type system to avoid introducing our own abstractions and having to reconcile that.

This commit removes the `ConcreteExn` variant from the public API of
Wasmtime and its `HeapType` `enum`. I brought this up earlier in bytecodealliance#14011
which was closed, but I'd like to push on this again at least from the
angle of the public API of Wasmtime. Specifically this fixes a possible
unusual situation where:

* A host function is created with `HeapType::ConcreteExn` as one of its
  arguments.
* This function is called with a different kind of concrete exception.
* Due to a missing type check which in theory shouldn't actually be
  necessary, this actually passes at runtime.

There's no panic/etc here and this is just a weird situation, but this
exposes a part of exposing `ConcreteExn` in the public API which is that
it affects not just what's read from WebAssembly but what's also passed
back in from the host. For example creating a GC `struct` type with
concrete exception types doesn't really make sense, but it's possible
with today's embedder API.

This change is not as invasive as bytecodealliance#14011 and only limits the public API
surface area of Wasmtime. The goal is to have the public API faithfully
reflect wasm's type system to avoid introducing our own abstractions and
having to reconcile that.
@alexcrichton
alexcrichton requested a review from a team as a code owner October 30, 2026 21:42
@alexcrichton
alexcrichton requested review from cfallin and removed request for a team October 30, 2026 21:42
@github-actions github-actions Bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API. wasmtime:ref-types Issues related to reference types and GC in Wasmtime labels Oct 31, 2026
@github-actions

Copy link
Copy Markdown

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "wasmtime:api", "wasmtime:c-api", "wasmtime:ref-types"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: wasmtime:ref-types

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API. wasmtime:ref-types Issues related to reference types and GC in Wasmtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant