History log of /wasmtime-44.0.1/crates/wit-bindgen/src/types.rs (Results 1 – 22 of 22)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7, v43.0.0
# 1b59b579 09-Mar-2026 Yordis Prieto <[email protected]>

Add support for map type (#12216)

* Add support for map type

Signed-off-by: Yordis Prieto <[email protected]>

* Add Map and MapEntry classes to support key/value pairs in component model

Th

Add support for map type (#12216)

* Add support for map type

Signed-off-by: Yordis Prieto <[email protected]>

* Add Map and MapEntry classes to support key/value pairs in component model

This commit introduces the Map and MapEntry classes, enabling the representation of map values in the component model. The Map class allows for the creation and iteration of key/value pairs, enhancing the functionality of the wasmtime component API. Additionally, the .gitignore file is updated to exclude build artifacts from the crates/c-api directory.

* Add wasm_component_model_map configuration support

* Format code

* Format C code

* Enhance component model to support HashMap<K, V> type

This commit introduces support for HashMap<K, V> in the component model, allowing maps to be represented as list<tuple<K, V>> in the canonical ABI. It includes implementations for the ComponentType, Lower, and Lift traits for HashMap, enabling type checking, lowering to flat representations, and lifting from memory. Additionally, the maximum depth for type generation in the fuzzing utility is updated to accommodate the new map type.

* Refactor component configuration to introduce map support

This commit removes the previous wasm features configuration and adds new functions for creating a map-configured engine. The `map_config` and `map_engine` functions are introduced to facilitate the use of the component model with maps in tests, ensuring that the engine is properly configured for map types in the component model.

* Add new WAST test for map types and remove map type definitions from existing tests

This commit introduces a new WAST test file specifically for testing various map types in the component model. Additionally, it removes the redundant map type definitions from the existing types.wast file to streamline the test suite.

* Update component fuzzing and dynamic tests to replace call_and_post_return with call

* Format code

* Refactor HashMap usage in typed.rs to use wasmtime_environ collections

* Fix HashMap initialization and insertion to handle potential errors in typed.rs

* Refactor HashMap handling in typed.rs to use lower_map_iter for improved iteration and memory management. Introduce new implementations for ComponentType, Lower, and Lift traits for std::collections::HashMap, enhancing support for map types in the component model.

* Fix map adapter trampoline compilation and alignment bugs

The translate_map function had two categories of bugs preventing map
adapter trampolines from working:

1. Wasm stack discipline: local_set_new_tmp emits LocalSet which pops
from the stack, but was called when the stack was empty (to
"pre-allocate" locals). Fixed by computing values first, then
calling local_set_new_tmp to consume them—matching translate_list's
pattern. Also removed an erroneous LocalTee that left an orphan
value on the stack. Affected: src_byte_len, dst_byte_len,
cur_src_ptr, cur_dst_ptr.

2. Pointer advancement: after value translation, the pointer still
points at the value start. The code only advanced by trailing
padding instead of value_size + trailing_padding, causing every
loop iteration to re-read the same memory.

Also fixes entry layout to use proper record alignment rules (entry
align = max(key_align, value_align), value at aligned offset).

* Refactor map entry layout calculations to use canonical ABI

* Remove unnecessary clone of map pairs during lowering

Val::Map already holds Vec<(Val, Val)> which derefs to &[(Val, Val)],
matching lower_map's signature directly. The intermediate Vec allocation
and deep clone of every key/value pair was redundant.

* Deduplicate map lift logic between HashMap implementations

* Deduplicate list and map sequence translation scaffolding

* Fix cargo fmt formatting issues

* Deduplicate map typecheck logic

* Deduplicate map lowering with linear_lower_map_to_flat and linear_lower_map_to_memory helpers

* Clean up lift_try_map: use drop, move TryHashMap import to module scope

* Fix CI: arbtest overflow and no-std HashMap lift_map

- component_fuzz: use saturating_sub in generate_hashable_key to prevent
underflow when fuel is 0 and Enum variant is chosen
- typed: remove incorrect ? operators in lift_map for hashbrown::HashMap
(with_capacity and insert don't return Result)

* Store map tuple layout in TypeMap

Compute map entry ABI and value offsets once during type building, and reuse that metadata in runtime map lift/lower paths instead of recalculating tuple layout at each call site.

* Refactor map ABI argument passing

Bundle map lift/lower layout and type metadata into a small MapAbi32 helper so map helper calls stay concise without changing behavior.

* Fix CI: enable component_model_map in fuzzing and handle map in arbitrary_val

The fuzzer's component_api oracle was generating map types but the engine
didn't have the map feature enabled, and arbitrary_val had no arm for
Type::Map. Enable component_model_map in the store helper (matching how
component_model_async is forced on) and implement arbitrary value generation
for map types.

---------

Signed-off-by: Yordis Prieto <[email protected]>

show more ...


Revision tags: v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6
# ce09e2ac 13-Feb-2026 Roman Volosatovs <[email protected]>

fix(bindgen): futures and stream are not `Clone` (#12155)

Signed-off-by: Roman Volosatovs <[email protected]>


# d2fbd2de 12-Feb-2026 Alex Crichton <[email protected]>

Update to wasm-tools 245 (#12571)

* Intrinsics updates

* Remove ds_store

* Update to wasm-tools 245

* Add vets

* Fixup tests

* Add missing feature for `indexmap`

---------

Co-authored-by: Sy

Update to wasm-tools 245 (#12571)

* Intrinsics updates

* Remove ds_store

* Update to wasm-tools 245

* Add vets

* Fixup tests

* Add missing feature for `indexmap`

---------

Co-authored-by: Sy Brand <[email protected]>

show more ...


Revision tags: v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2, v40.0.1
# e63dd69f 07-Jan-2026 Alex Crichton <[email protected]>

Update wasm-tools dependencies (#12254)

* Update wasm-tools dependencies

Brings in binary-parsing support for the WIT `map` type as well as the
wasm compact-imports proposal. Neither of these are e

Update wasm-tools dependencies (#12254)

* Update wasm-tools dependencies

Brings in binary-parsing support for the WIT `map` type as well as the
wasm compact-imports proposal. Neither of these are enabled by default
and will continue to be rejected, but it'll now be possible to support
them without needing to update dependencies.

* Add vets

* Update test expectations, add tests

Closes #12166

show more ...


Revision tags: v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5, v38.0.3, v38.0.2, v38.0.1, v37.0.2, v37.0.1, v37.0.0, v36.0.2, v36.0.1, v36.0.0, v35.0.0, v24.0.4, v33.0.2, v34.0.2, v34.0.1, v33.0.1, v24.0.3, v32.0.1, v34.0.0, v33.0.0
# e682be4e 05-May-2025 Alex Crichton <[email protected]>

Update wasm-tools crates (#10731)

* Update wasm-tools crates

Minor API changes, mostly just stubbing out support for
fixed-size-lists.

* Update vets

* Update some test expectations


Revision tags: v32.0.0, v31.0.0
# b8e3fbe9 05-Mar-2025 Alex Crichton <[email protected]>

Update wasm-tools to the latest revision (#10314)

* Update wasm-tools to the latest revision

* Update component async bits for new intrinsics

* Ignore options for now

* I truly, and fundamentally

Update wasm-tools to the latest revision (#10314)

* Update wasm-tools to the latest revision

* Update component async bits for new intrinsics

* Ignore options for now

* I truly, and fundamentally, do not understand `cargo vet`

* Fix a test

show more ...


Revision tags: v30.0.2, v30.0.1, v30.0.0
# 287e8fb5 19-Feb-2025 Alex Crichton <[email protected]>

Update wasm-tools crates to 226 (#10235)

* Update wasm-tools crates to 226

This commit updates the wasm-tools crates to the 226 track of versions.
The most notable change here is the removal and re

Update wasm-tools crates to 226 (#10235)

* Update wasm-tools crates to 226

This commit updates the wasm-tools crates to the 226 track of versions.
The most notable change here is the removal and refactoring within
wasm-tools of support for multiple and named returns in the component
model along with the support for 33+ flags in the `flags` type. This has
been gated for some time now and it's just now being removed now that
it's been awhile an no issues have been raised.

prtest:full

* Fix some issues from CI

* Fix benchmarks

* Switch to crates.io-based crates

show more ...


# 636435f1 22-Jan-2025 Joel Dice <[email protected]>

async/stream/future support for wasmtime-wit-bindgen (#10044)

* async/stream/future support for wasmtime-wit-bindgen

I've split this out of #9582 to make review easier.

This patch adds async/strea

async/stream/future support for wasmtime-wit-bindgen (#10044)

* async/stream/future support for wasmtime-wit-bindgen

I've split this out of #9582 to make review easier.

This patch adds async/stream/future/error-context support to the host binding
generator, along with placeholder type and function definitions in the
`wasmtime` crate which the generated bindings can refer to. See
https://github.com/dicej/rfcs/blob/component-async/accepted/component-model-async.md#componentbindgen-updates
for the design and rationale.

Note that I've added temporary `[patch.crates-io]` overrides in Cargo.toml until
https://github.com/bytecodealliance/wit-bindgen/pull/1130 and
https://github.com/bytecodealliance/wasm-tools/pull/1978 have been released.

Also note that we emit a `T: 'static` bound for `AsContextMut<Data = T>` when
generating bindings with `concurrent_imports: true`. This is only because
`rustc` insists that the closure we're passing to
`LinkerInstance::func_wrap_concurrent` captures the lifetime of `T` despite my
best efforts to convince it otherwise. Alex and I suspect this is a limitation
in the compiler, and I asked about it on the rust-lang Zulip, but we haven't
been able to determine a workaround so far.

Signed-off-by: Joel Dice <[email protected]>

remove obsolete TODO comment

Signed-off-by: Joel Dice <[email protected]>

make `futures` dep optional

Signed-off-by: Joel Dice <[email protected]>

update `wasm-tools` and `wit-bindgen`

Signed-off-by: Joel Dice <[email protected]>

* run cargo vet

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v29.0.1, v29.0.0, v28.0.1
# 4c5f250f 08-Jan-2025 Alex Crichton <[email protected]>

Update wasm-tools crates (#9952)

* Update wasm-tools crates

Pull in recent updates and denying memory64 support in components during
validation.

* Fix renamings in wave

* Fix some bindgen tests


Revision tags: v28.0.0, v27.0.0, v26.0.1, v25.0.3, v24.0.2, v26.0.0, v21.0.2, v22.0.1, v23.0.3, v25.0.2, v24.0.1, v25.0.1, v25.0.0, v24.0.0, v23.0.2, v23.0.1, v23.0.0, v22.0.0
# 38bc9151 29-May-2024 Nick Fitzgerald <[email protected]>

Update the wasm-tools family of crates to 0.209.1 (#8709)

Fixes https://github.com/bytecodealliance/wasmtime/issues/8704


Revision tags: v21.0.1, v21.0.0, v20.0.2, v20.0.1, v20.0.0, v17.0.3, v19.0.2, v18.0.4, v19.0.1, v19.0.0
# b96a9f4f 14-Mar-2024 Alex Crichton <[email protected]>

Fix generating bindings for dead code (#8065)

This commit fixes a bindgen problem where dead types, which had no
generated bindings, could be referred to from other dead types, which
did have genera

Fix generating bindings for dead code (#8065)

This commit fixes a bindgen problem where dead types, which had no
generated bindings, could be referred to from other dead types, which
did have generated bindings. The fix is to not generate code for dead
types at all by fixing how type information is analyzed.

show more ...


Revision tags: v18.0.3, v18.0.2, v17.0.2, v18.0.1, v18.0.0, v17.0.1, v17.0.0, v16.0.0, v15.0.1, v15.0.0, v14.0.4, v14.0.3, v14.0.2, v13.0.1, v14.0.1, v14.0.0, minimum-viable-wasi-proxy-serve, v13.0.0, v12.0.2, v11.0.2, v10.0.2
# 878a243a 30-Aug-2023 Timmy Silesmo <[email protected]>

Host resources wit-bindgen code generation (#6886)

* added trap to resource dtor

* basic resources

* fixed signature and trait bounds

* fixed static function

* fixed trait signature

* basic res

Host resources wit-bindgen code generation (#6886)

* added trap to resource dtor

* basic resources

* fixed signature and trait bounds

* fixed static function

* fixed trait signature

* basic resources

* added result to resource drop

* reverted formatting

* added doc comment to resource `dtor`

* fixed merge issue

* fixed another merge issue

* added resource import codegen test

* Revert changes to `Cargo.lock`

* Update `Cargo.lock` with the wit-bindgen update

* Add `cargo vet` entries for new crates

* Restore old-style of printing types in bindgen

Avoid collecting resources-as-we-go in favor of doing that more
declaratively elsewhere. Additionally handle imported-vs-exported
resource via the order that interfaces are visited.

* Update the shape of resource traits:

* Use `&mut self` instead of `StoreContextMut`
* Make resource traits as supertraits of the `Host` trait generated for
each resource.
* More uniformly handle types/returns with resource methods.
* Fix derivations of `Clone` and `Copy` for where handles are contained.

* Fix generation of handle typedefs

* Support resources-in-worlds

* Remove now-duplicate function

This is now the same as the preexisting `generate_function_trait_sig`

* Fix classifying handles as imported or exported

This determination happens by looking up the origin definition of a
resource, not the leaf possibly-aliased type.

* Fix chains-of-use of resources

Resources don't have their representation asserted since the bare type
itself doesn't implement `ComponentType`, but otherwise generate type
aliases the same way as other type aliases.

* Revert `Cargo.lock` changes

No need to update `wit-bindgen` to 0.10.0 just yet, that'll happen in a
future update if necessary.

* Add basic runtime tests for resources

* fixed merge issue

---------

Co-authored-by: Alex Crichton <[email protected]>

show more ...


# 35902366 26-Aug-2023 Lann <[email protected]>

Remove component union types (#6913)

- Bump wasm-tools deps
- Use new TypeSectionReader::into_iter_err_on_gc_types method


Revision tags: v12.0.1, v12.0.0, v11.0.1, v11.0.0
# 80e68c33 11-Jul-2023 Alex Crichton <[email protected]>

Update the wasm-tools family of crates (#6710)

* Update wasm-tools dependencies

* Get tests passing after wasm-tools update

Mostly dealing with updates to `wasmparser`'s API.

* Update `cargo vet`

Update the wasm-tools family of crates (#6710)

* Update wasm-tools dependencies

* Get tests passing after wasm-tools update

Mostly dealing with updates to `wasmparser`'s API.

* Update `cargo vet` for new crates

* Add `equivalent`, `hashbrown`, and `quote` to the list of trusted
authors. We already trust these authors for other crates.
* Pull in some upstream audits for various deps.
* I've audited the `pulldown-cmark` dependency upgrade myself.

show more ...


# 537214fd 27-Jun-2023 Joel Dice <[email protected]>

[wit-bindgen] provide more control over type ownership (#6648)

* [wit-bindgen] provide more control over type ownership

This replaces the `duplicate_if_necessary` parameter to
`wasmtime::component:

[wit-bindgen] provide more control over type ownership (#6648)

* [wit-bindgen] provide more control over type ownership

This replaces the `duplicate_if_necessary` parameter to
`wasmtime::component::bindgen` with a new `ownership` parameter which provides
finer-grained control over whether and how generated types own their fields.

The default is `Ownership::Owning`, which means types own their fields
regardless of how they are used in functions. These types passed by reference
when used as parameters to guest-exported functions. Note that this also
affects how unnamed types (e.g. `list<list<string>>`) are passed: using a
reference only at the top level (e.g. `&[Vec<String>]` instead of `&[&[&str]]`,
which is more difficult to construct when using non-`'static` data).

The other option is `Ownership::Borrowing`, which includes a
`duplicate_if_necessary` field, providing the same code generation strategy as
was used prior to this change.

If we're happy with this approach, I'll open another PR in the `wit-bindgen`
repo to match.

This also fixes a bug that caused named types to be considered owned and/or
borrowed when they shouldn't have been due to having fields with unnamed types
which were owned and/or borrowed in unrelated interfaces.

Signed-off-by: Joel Dice <[email protected]>

* fix test breakage

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>

show more ...


Revision tags: v10.0.1, v10.0.0, v9.0.4, v9.0.3, v9.0.2, v9.0.1, v9.0.0
# a729a2a6 12-May-2023 Pat Hickey <[email protected]>

error types: resolve type definition id by chasing alias ids (#6373)


Revision tags: v6.0.2, v7.0.1, v8.0.1, v8.0.0
# 85118c8c 17-Apr-2023 kevaundray <[email protected]>

Add clippy suggestions (#6203)

* add clippy suggestions

* revert &/ref change

* Update cranelift/isle/isle/src/parser.rs

Co-authored-by: Jamey Sharp <[email protected]>

---------

Co-authored-by

Add clippy suggestions (#6203)

* add clippy suggestions

* revert &/ref change

* Update cranelift/isle/isle/src/parser.rs

Co-authored-by: Jamey Sharp <[email protected]>

---------

Co-authored-by: Jamey Sharp <[email protected]>

show more ...


Revision tags: v7.0.0, v6.0.1, v5.0.1, v4.0.1, v6.0.0
# a2a0a9ef 02-Feb-2023 Alex Crichton <[email protected]>

Update to the latest `wit-parser` (#5694)

This notably pulls in support in WIT for types-in-worlds.


# 545749b2 02-Feb-2023 Alex Crichton <[email protected]>

Fix some wit-bindgen-related issues with generated bindings (#5692)

* Prefix component-bindgen-generated-functions with `call_`

This fixes clashes between Rust-native methods and the methods
the

Fix some wit-bindgen-related issues with generated bindings (#5692)

* Prefix component-bindgen-generated-functions with `call_`

This fixes clashes between Rust-native methods and the methods
themselves. For example right now `new` is a Rust-generated function for
constructing the wrapper but this can conflict with a world-exported
function called `new`.

Closes #5585

* Fix types being both shared and owned

This refactors some inherited cruft from the original `wit-bindgen`
repository to be more Wasmtime-specific and fixes a codegen case where
a type was used in both a shared and an owned context.

Closes #5688

show more ...


# 293005bd 23-Jan-2023 Alex Crichton <[email protected]>

Fix calculation of param/result types in wit-bindgen (#5622)

This commit fixes a bug in the `bindgen!` macro for components where
previously the `param` and `result` properties weren't properly
ca

Fix calculation of param/result types in wit-bindgen (#5622)

This commit fixes a bug in the `bindgen!` macro for components where
previously the `param` and `result` properties weren't properly
calculated depending on the structure of the type and which types were
visited in which order. This is simplified to use a `LiveTypes`
structure from the `wit-parser` crate and relies on that to do necessary
recursion.

show more ...


Revision tags: v5.0.0
# 24785123 18-Jan-2023 Alex Crichton <[email protected]>

Update WIT tooling used by Wasmtime (#5565)

* Update WIT tooling used by Wasmtime

This commit updates the WIT tooling, namely the wasm-tools family of
crates, with recent updates. Notably:

*

Update WIT tooling used by Wasmtime (#5565)

* Update WIT tooling used by Wasmtime

This commit updates the WIT tooling, namely the wasm-tools family of
crates, with recent updates. Notably:

* bytecodealliance/wasm-tools#867
* bytecodealliance/wasm-tools#871

This updates index spaces in components and additionally bumps the
minimum required version of the component binary format to be consumed
by Wasmtime (because of the index space changes). Additionally WIT
tooling now fully supports `use`.

Note that WIT tooling doesn't, at this time, fully support packages and
depending on remotely defined WIT packages. Currently WIT still needs to
be vendored in the project. It's hoped that future work with `cargo
component` and possible integration here could make the story about
depending on remotely-defined WIT more ergonomic and streamlined.

* Fix `bindgen!` codegen tests

* Add a test for `use` paths an implement support

* Update to crates.io versions of wasm-tools

* Uncomment codegen tests

show more ...


Revision tags: v4.0.0
# 2329ecc3 06-Dec-2022 Alex Crichton <[email protected]>

Add a `wasmtime::component::bindgen!` macro (#5317)

* Import Wasmtime support from the `wit-bindgen` repo

This commit imports the `wit-bindgen-gen-host-wasmtime-rust` crate from
the `wit-bindgen

Add a `wasmtime::component::bindgen!` macro (#5317)

* Import Wasmtime support from the `wit-bindgen` repo

This commit imports the `wit-bindgen-gen-host-wasmtime-rust` crate from
the `wit-bindgen` repository into the upstream Wasmtime repository. I've
chosen to not import the full history here since the crate is relatively
small and doesn't have a ton of complexity. While the history of the
crate is quite long the current iteration of the crate's history is
relatively short so there's not a ton of import there anyway. The
thinking is that this can now continue to evolve in-tree.

* Refactor `wasmtime-component-macro` a bit

Make room for a `wit_bindgen` macro to slot in.

* Add initial support for a `bindgen` macro

* Add tests for `wasmtime::component::bindgen!`

* Improve error forgetting `async` feature

* Add end-to-end tests for bindgen

* Add an audit of `unicase`

* Add a license to the test-helpers crate

* Add vet entry for `pulldown-cmark`

* Update publish script with new crate

* Try to fix publish script

* Update audits

* Update lock file

show more ...