Stream: git-wasmtime

Topic: wasmtime / PR #14150 c-api: fix the component-model build...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:33):

Lstarsky0 opened PR #14150 from Lstarsky0:fix/c-api-declare-vecs-cfg to bytecodealliance:main:

cargo check -p wasmtime-c-api --no-default-features --features component-model fails on main with 23 diagnostics, starting with:

error[E0433]: cannot find `declare_vecs` in `crate`
error[E0425]: cannot find type `wasmtime_component_vallist_t` in this scope
...

What is broken

crates/c-api/src/component/val.rs:11 calls crate::declare_vecs!. declare_vecs is a plain macro_rules!, so that path only resolves because of the re-export at the bottom of vec.rs — and the re-export is gated on the wrong feature:

#[cfg(feature = "async")]
pub(crate) use declare_vecs;

component/val.rs is behind #[cfg(feature = "component-model")] (lib.rs:104), and component-model does not imply async. Enable one without the other and the macro is not in scope, taking every vec type it declares with it.

crate::declare_vecs! has exactly one caller, component/val.rs. Nothing under async uses the path form.

How it got here

#10697 added the re-export for this consumer with no cfg at all:

+pub(crate) use declare_vecs;

4f2fa1541 ("Update nightly Rust used in CI") later added the #[cfg(feature = "async")] line — the shape of a fix for an unused-import warning from a newer lint, with the feature picked incorrectly.

CI did not catch it because the wasmtime-c-api matrix entry covers --no-default-features and then wat, wasi and gc. component-model alone was never built.

The change

One line: the re-export is gated on component-model, matching its only consumer.

Testing

Feature matrix for wasmtime-c-api-impl, before and after:

features main with this PR
component-model 24 errors ok
component-model,async ok ok
async ok ok
component-model,cranelift 24 errors ok
none, wat, wasi, gc ok ok

-p wasmtime-c-api --no-default-features --features component-model is added to the wasmtime-c-api checks. It fails on unpatched main with 23 diagnostics and passes here.

Also clean, run twice: the four existing wasmtime-c-api checks, -p wasmtime-c-api-impl --all-features, cargo clippy -p wasmtime-c-api-impl --no-default-features --features component-model, cargo test -p wasmtime-c-api-impl, cargo fmt --all -- --check.

One warning remains under component-modelunused import: wasm_byte_vec_t in component/component.rs. It is already there on main under component-model,async, so it is not from this change and I have left it alone.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:33):

Lstarsky0 requested wasmtime-core-reviewers for a review on PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:33):

Lstarsky0 requested pchickey for a review on PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:33):

Lstarsky0 requested fitzgen for a review on PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:33):

Lstarsky0 requested wasmtime-default-reviewers for a review on PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:47):

Lstarsky0 updated PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 11:51):

Lstarsky0 edited PR #14150:

cargo check -p wasmtime-c-api --no-default-features --features component-model fails on main with 23 diagnostics, starting with:

error[E0433]: cannot find `declare_vecs` in `crate`
error[E0425]: cannot find type `wasmtime_component_vallist_t` in this scope
...

What is broken

crates/c-api/src/component/val.rs:11 calls crate::declare_vecs!. declare_vecs is a plain macro_rules!, so that path only resolves because of the re-export at the bottom of vec.rs — and the re-export is gated on the wrong feature:

#[cfg(feature = "async")]
pub(crate) use declare_vecs;

component/val.rs is behind #[cfg(feature = "component-model")] (lib.rs:104), and component-model does not imply async. Enable one without the other and the macro is not in scope, taking every vec type it declares with it.

crate::declare_vecs! has exactly one caller, component/val.rs. Nothing under async uses the path form.

How it got here

#10697 added the re-export for this consumer with no cfg at all:

+pub(crate) use declare_vecs;

4f2fa1541 ("Update nightly Rust used in CI") later added the #[cfg(feature = "async")] line — the shape of a fix for an unused-import warning from a newer lint, with the feature picked incorrectly.

CI did not catch it because the wasmtime-c-api matrix entry covers --no-default-features and then wat, wasi and gc. component-model alone was never built.

The change

One line: the re-export is gated on component-model, matching its only consumer.

Testing

Feature matrix for wasmtime-c-api-impl, before and after:

features main with this PR
component-model 24 errors ok
component-model,async ok ok
async ok ok
component-model,cranelift 24 errors ok
none, wat, wasi, gc ok ok

-p wasmtime-c-api --no-default-features --features component-model is added to the wasmtime-c-api checks. It fails on unpatched main with 23 diagnostics and passes here.

Also clean, run twice: the four existing wasmtime-c-api checks, -p wasmtime-c-api-impl --all-features, cargo clippy -p wasmtime-c-api-impl --no-default-features --features component-model, cargo test -p wasmtime-c-api-impl, cargo fmt --all -- --check.

One more thing had to come with it. component/component.rs imports wasm_byte_vec_t unconditionally, but the only use is in wasmtime_component_serialize, which is gated on cranelift or winch. Under component-model alone the import is unused, and CI runs with RUSTFLAGS=-D warnings, so the new check fails on it. The import is now gated the same way as its use.

The warning is not from this change — it is on main today under component-model,async as well. Nothing built either configuration, which is why it had never surfaced. I first pushed this without the import fix and CI caught it, which is the check doing its job.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:13):

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:13):

:speech_balloon: alexcrichton created PR review comment:

No need for comments here, the #[cfg] explains things.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:13):

:speech_balloon: alexcrichton created PR review comment:

Should this be any(feature = "async", feature = "component-model")?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:14):

alexcrichton unassigned pchickey from PR #14150 c-api: fix the component-model build without async.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:14):

alexcrichton requested alexcrichton for a review on PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:14):

alexcrichton unassigned fitzgen from PR #14150 c-api: fix the component-model build without async.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 14:14):

alexcrichton commented on PR #14150:

Also, please be sure to review our AI tool usage policy

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 15:18):

Lstarsky0 updated PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 15:28):

:memo: Lstarsky0 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 15:28):

:speech_balloon: Lstarsky0 created PR review comment:

Dropped. The import order moves in the same commit: the comment was what kept rustfmt from sorting those two use lines, so cargo fmt --check fails once it is gone

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 15:28):

:memo: Lstarsky0 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 15:28):

:speech_balloon: Lstarsky0 created PR review comment:

No, that breaks async on its own. crate::declare_vecs! has one caller, component/val.rs:11, and mod component is gated on component-model at lib.rs:104, so under --features async with no component-model nothing uses the path form and the re-export is unused. With -D warnings that is error: unused import: declare_vecs at vec.rs:152. That is the same warning the original #[cfg(feature = "async")] was silencing. It named the wrong feature, which is what let component-model alone break

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 17:22):

:thumbs_up: alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 17:22):

alexcrichton added PR #14150 c-api: fix the component-model build without async to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 17:48):

:check: alexcrichton merged PR #14150.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 18 2026 at 17:48):

alexcrichton removed PR #14150 c-api: fix the component-model build without async from the merge queue.


Last updated: Aug 30 2026 at 09:07 UTC