leonm1 opened issue #12783:
In the c-api crate, the c-api specifies wasmtime as a dependency and explicitly enumerates its default features. Cargo permits overriding the features in a subdependency by explicitly passing the subdependency and a set of features, such as this:
[dependencies] wasmtime = {version = "42.0.1", default-features = false, features = ['std', 'runtime']} wasmtime-c-api-impl = {version = "42.0.1", features = ['cranelift']}However, this is not able to _disable_ explicitly selected features of subdependencies (as
default-features = falseonly applies to the features in the wasmtime crate's own Cargo.toml).wasmtime's c-api crate already includes a feature to toggle
gc, so the explicit inclusion ofgcin the wasmtime's features is unnecessary. The fix would be to avoid specifying features for thewasmtimedependency in the c-api crate's Cargo.toml.This change could be made backwards compatible by enabling the wasmtime c-api crate's
gcfeature by default, which would transitively enable wasmtime's gc feature in a way that could be disabled by consumers.Related: https://github.com/proxy-wasm/proxy-wasm-cpp-host/pull/502#discussion_r2873328850
alexcrichton commented on issue #12783:
Thanks for the report! This is indeed currently the case, and it should be fine to change this whenever. It's ok to break back-compat, that's why Wasmtime has major version releases every month.
The fix for this is, in theory:
- Remove
gcfrom this dependency directive- Everywhere there's
WASMTIME_FEATURE_LISTthegcfeature is already listed, so nothing to do there (but maybe double check)- Add a CI job which builds the C API without default features and with the
gcfeature to double-check it works.Happy to review/help with a PR if anyone's interested!
alexcrichton added the wasmtime:c-api label to Issue #12783.
alexcrichton added the wasm-proposal:gc label to Issue #12783.
tolumide-ng commented on issue #12783:
Happy to pick this up, thank you :smile:
tolumide-ng commented on issue #12783:
Thank you @alexcrichton! I’m still getting familiar with the codebase, but I’ve opened a PR:https://github.com/bytecodealliance/wasmtime/pull/12805.
It seemswasmtime'sgcenables properties that would otherwise have to be implemented manually whengcis disabled (e.g.,RootScope). At the moment, I have enabled thegcfeature by default while allowing downstream users to disable it, preserving backward compatibility. What do you think?
Last updated: Mar 23 2026 at 16:19 UTC