Skip to content

wit-bindgen 0.45#1359

Merged
rvolosatovs merged 18 commits into
mainfrom
merge/wit-bindgen-0.45
Jun 23, 2026
Merged

wit-bindgen 0.45#1359
rvolosatovs merged 18 commits into
mainfrom
merge/wit-bindgen-0.45

Conversation

@rvolosatovs

@rvolosatovs rvolosatovs commented Jun 23, 2026

Copy link
Copy Markdown
Member

Merge upstream wit-bindgen 0.45.1 into the vendored bindgen subtree (subsumes
0.45.0 and the 0.45.1 patch).

Non-carries (not applicable to wRPC, dropped from the merge):

  • another wit-bindgen test subcommand backend and an upstream-only
    crates/rust/tests/wit/path3 fixture (wRPC's path test uses path1/path2).
  • Support fallible constructors wit-bindgen#1360 (fallible resource constructors) is upstream canonical-ABI guest
    constructor-signature handling (-> Self / -> Result<Self, err>,
    FnSig/print_results); wRPC's constructor model differs (a Handler::new
    returning anyhow::Result<ResourceOwn<_>>). The new
    tests/codegen/resource-fallible-constructor.wit input is carried and
    generates cleanly (the result type is handled generically), so no skip-arm.

rust codegen (243) and go codegen (81) tests pass; cargo clippy --workspace
(and --features serde) and cargo doc --workspace are clean; wasmtime and all
examples build.

Assisted-by: claude:claude-opus-4-8
Upstream diff: bytecodealliance/wit-bindgen@v0.44.0...v0.45.1

peter-jerry-ye and others added 18 commits August 14, 2025 14:23
* fix: adapt Moonbit struct tuple & suberror features

* fix: update keyword handling in to_moonbit_ident function

* style: cargo fmt

* test: add new test

---------

Co-authored-by: BigOrangeQWQ <2284086963@qq.com>
* fix(core): result check for async function

This commit fixes a check that was incorrectly looking at the CM level
function in the case of an async guest import when determining whether
it had the right results.

The problem with the existing logic is that it was trying to check for
a constraint on the wrong function -- the guest import being lowered
rather than the core function underneath that.

The case that makes this obvious was something like an `run: async
func()` where the CM level function clearly has no result, but the
underlying core function being async lifted must of course have a i32
status code as a result.

* fix(core): remove check on guests avoiding lowering
* Parse `wit` folder in `generate!` with `inline`

This commit updates handling of the `inline` attribute in the
`generate!` macro of the Rust bindings generator. Previously if `inline`
was specified it would by default lookup nothing on the filesystem
unless `path` was specified. This contradicts the documentation though
that `./wit` is the default lookup path. To resolve this this commit
adds a check to see if `./wit` exists, and if so parses it. This keeps
the default search path behavior without requiring its existence when
using `inline`.

* Fix compile
It's causing failures on CI, so temporarily remove it while those are
sorted out.
When multiple `path`s are used the `generate!` macro will fail if they
all contain a `world` and no world is otherwise specified. This then
additionally affected when using `inline` plus loading auxiliary WIT
from a `paths` directory (either explicitly or the default `wit`). This
commit switches the logic to prioritizing worlds in the `inline` block
because if that's being specified it's pretty likely the exact one that
wants to be used.
use of `iter::repeat_n` and `Cargo.lock` version 4 cause this
package to depend on Rust 1.82.0 at minimum
And C support came along for free.
See: WebAssembly/component-model#550

C++, C# & Moonbit are not supported yet.
This commit avoids looking at `--with` for exports, for example, to fix
situations where an interface is imported and exported and only the
import types should be reused from elsewhere. I'm not aware of any cases
where exports want to be reused, so there's effectively no more support
for that.
Accept multiple WIT paths in the wit-bindgen CLI, using the same logic
as the multiple WIT paths accepted by the `path` parameter in the
Rust bindgen macro.

Also, document that list-of-WIT interfaces, in the Rust macro and now
the wit-bindgen CLI, have a topological ordering requirement which may
be lifted in the future.
…with the Rust standard library (#1369)

* Remove old wit-bindgen compat module

This has long since become unnecessary, so delete it.

* Merge `wit-bindgen-rt` back into `wit-bindgen`

This was originally done a long time ago at this point to split out the
"abi stable bits" from `wit-bindgen` for the purpose of `cargo
component` where one version of the macro was used in the binary itself
and a different version might be linked at runtime. Over time though
this has proven effectively intractable and isn't really serving much
purpose any more. This commit instead merges everything into the
`wit-bindgen` crate. This should make it easier to integrate elsewhere
and additionally integrate into Rust's standard library.

* Get `wit-bindgen` working without `bitflags` dep.

Generate a bare-bones `bitflags!` macro.

* Update rebuild script

* Fix CI issues

* More CI fixes
[automatically-tag-and-release-this-commit]

Co-authored-by: Auto Release Process <auto-release-process@users.noreply.github.com>
* Disable unused-import warnings on `__with_name*` aliases.

These don't always get used, so disable unused-import warnings for them.

* Disable unused_lint_expectations warnings too; sometimes the aliases are used.

* rustfmt

* Fix more warnings.
This commit fixes the parameter generation when emitting the
`AsyncTaskReturn` instruction -- in the past the "default" was expeted
to be a single I32, but this was a misreading of the spec, it is
possible for an task.return to return nothing if there are no results
to return.
Just a typo from when this was originally scaffolded.
[automatically-tag-and-release-this-commit]

Co-authored-by: Auto Release Process <auto-release-process@users.noreply.github.com>
Merge upstream wit-bindgen 0.45.1 into the vendored bindgen subtree (subsumes
0.45.0 and the 0.45.1 patch).

- Bump wit-bindgen-core 0.44 -> 0.45 and wit-parser 0.236 -> 0.238.
- Adapt to the wit-parser 0.238 API break: `Resolve::select_world` now takes a
  slice of package ids (`&[PackageId]`) instead of a single id. Updated the
  callers in `test-helpers`, the `wit-bindgen-wrpc` CLI (which also gains support
  for multiple WIT path arguments, merged from upstream), and the macro's
  `select_world` wrapper.
- Port upstream feature bytecodealliance/wit-bindgen#1367 (`with` applies only to imports): exported
  interfaces/types are always generated (their definitions come from the
  implementation), so `name_interface` no longer requires a `with` entry for
  exports, the package-local auto-generate loop iterates imports only, and the
  export type-definition loop always emits. Type *references* are still remapped
  by `print_tyid` when a `with` entry exists (matching upstream's bytecodealliance/wit-bindgen#1173 + bytecodealliance/wit-bindgen#1367
  interaction).
- Port upstream feature bytecodealliance/wit-bindgen#1372: emit
  `#[allow(unfulfilled_lint_expectations, unused_imports)]` before the
  `use <remapped> as __with_name*;` alias to silence unused-import warnings.

Non-carries (not applicable to wRPC, dropped from the merge):
- another `wit-bindgen test` subcommand backend and an upstream-only
  `crates/rust/tests/wit/path3` fixture (wRPC's path test uses path1/path2).
- bytecodealliance/wit-bindgen#1360 (fallible resource constructors) is upstream canonical-ABI guest
  constructor-signature handling (`-> Self` / `-> Result<Self, err>`,
  `FnSig`/`print_results`); wRPC's constructor model differs (a `Handler::new`
  returning `anyhow::Result<ResourceOwn<_>>`). The new
  `tests/codegen/resource-fallible-constructor.wit` input is carried and
  generates cleanly (the result type is handled generically), so no skip-arm.

rust codegen (243) and go codegen (81) tests pass; `cargo clippy --workspace`
(and `--features serde`) and `cargo doc --workspace` are clean; wasmtime and all
examples build.

Assisted-by: claude:claude-opus-4-8
Upstream diff: bytecodealliance/wit-bindgen@v0.44.0...v0.45.1
@rvolosatovs rvolosatovs changed the title Merge/wit bindgen 0.45 wit-bindgen 0.45 Jun 23, 2026
@rvolosatovs rvolosatovs force-pushed the merge/wit-bindgen-0.45 branch 2 times, most recently from c304bfb to 0950dd9 Compare June 23, 2026 13:02
@rvolosatovs rvolosatovs marked this pull request as ready for review June 23, 2026 13:03
@rvolosatovs rvolosatovs merged commit 0950dd9 into main Jun 23, 2026
37 checks passed
@rvolosatovs rvolosatovs deleted the merge/wit-bindgen-0.45 branch June 23, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants