wit-bindgen 0.45#1359
Merged
Merged
Conversation
* 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>
The previous devcontainer has been broken since: bytecodealliance/wit-bindgen#1192
* 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
c304bfb to
0950dd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge upstream wit-bindgen 0.45.1 into the vendored bindgen subtree (subsumes
0.45.0 and the 0.45.1 patch).
Resolve::select_worldnow takes aslice of package ids (
&[PackageId]) instead of a single id. Updated thecallers in
test-helpers, thewit-bindgen-wrpcCLI (which also gains supportfor multiple WIT path arguments, merged from upstream), and the macro's
select_worldwrapper.within the Rust generator to only apply to imports wit-bindgen#1367 (withapplies only to imports): exportedinterfaces/types are always generated (their definitions come from the
implementation), so
name_interfaceno longer requires awithentry forexports, the package-local auto-generate loop iterates imports only, and the
export type-definition loop always emits. Type references are still remapped
by
print_tyidwhen awithentry exists (matching upstream's feature:withindividual type remapping support for Rust wit-bindgen#1173 + Redefinewithin the Rust generator to only apply to imports wit-bindgen#1367interaction).
__with_name*aliases. wit-bindgen#1372: emit#[allow(unfulfilled_lint_expectations, unused_imports)]before theuse <remapped> as __with_name*;alias to silence unused-import warnings.Non-carries (not applicable to wRPC, dropped from the merge):
wit-bindgen testsubcommand backend and an upstream-onlycrates/rust/tests/wit/path3fixture (wRPC's path test uses path1/path2).constructor-signature handling (
-> Self/-> Result<Self, err>,FnSig/print_results); wRPC's constructor model differs (aHandler::newreturning
anyhow::Result<ResourceOwn<_>>). The newtests/codegen/resource-fallible-constructor.witinput is carried andgenerates 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) andcargo doc --workspaceare clean; wasmtime and allexamples build.
Assisted-by: claude:claude-opus-4-8
Upstream diff: bytecodealliance/wit-bindgen@v0.44.0...v0.45.1