diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0fb18e..dbd87a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Added +- Initial support for Component Model [async](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Async.md) types `stream`, `future`, and `error-context`. - [`wasm-tools`](https://crates.io/crates/wasm-tools) is now vendored as a WebAssembly module, executed using [Wazero](https://wazero.io/). This allows package `wit` and `wit-bindgen-go` to run on any supported platform without needing to separately install `wasm-tools`. ### Changed -- Initial support for Component Model [async](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Async.md) types `stream`, `future`, and `error-context`. - Breaking: generated `*.wasm.go` files will now have correct WIT kebab-case base name. Interfaces or worlds with `-` in their name will require removal of the previous `*.wasm.go` files. - Dropped support for TinyGo v0.32.0. diff --git a/cm/error.go b/cm/error.go index 77b5bfd6..857d5ce7 100644 --- a/cm/error.go +++ b/cm/error.go @@ -28,21 +28,13 @@ func (err errorContext) String() string { // [error-context.debug-message]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdebug-message func (err errorContext) DebugMessage() string { var s string - errorContextDebugMessage(err, unsafe.Pointer(&s)) + wasmimport_errorContextDebugMessage(err, unsafe.Pointer(&s)) return s } -//go:wasmimport canon error-context.debug-message -//go:noescape -func errorContextDebugMessage(err errorContext, msg unsafe.Pointer) - // Drop represents the Canonical ABI [error-context.drop] function. // // [error-context.drop]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdrop func (err errorContext) Drop() { - errorContextDrop(err) + wasmimport_errorContextDrop(err) } - -//go:wasmimport canon error-context.drop -//go:noescape -func errorContextDrop(err errorContext) diff --git a/cm/error.wasm.go b/cm/error.wasm.go new file mode 100644 index 00000000..112eb6d8 --- /dev/null +++ b/cm/error.wasm.go @@ -0,0 +1,13 @@ +package cm + +import "unsafe" + +// msg uses unsafe.Pointer for compatibility with go1.23 and lower. +// +//go:wasmimport canon error-context.debug-message +//go:noescape +func wasmimport_errorContextDebugMessage(err errorContext, msg unsafe.Pointer) + +//go:wasmimport canon error-context.drop +//go:noescape +func wasmimport_errorContextDrop(err errorContext)