Skip to content

Enable gc feature by default#12805

Open
tolumide-ng wants to merge 2 commits intobytecodealliance:mainfrom
tolumide-ng:fix/wasmtime-c-api-gc-update
Open

Enable gc feature by default#12805
tolumide-ng wants to merge 2 commits intobytecodealliance:mainfrom
tolumide-ng:fix/wasmtime-c-api-gc-update

Conversation

@tolumide-ng
Copy link

The c-api crate currently enables the gc feature on its wasmtime dependency, even though it exposes a gc feature to control this behaviour. This prevents downstream users from disabling gc, since Cargo.toml doesn't allow overriding it. However, structs like RootScope are only available when gc is enabled. Removing it from default features, without other options, would break internal implementations.

Changes

  1. Enable the gc feature via the wasmtime-c-api crate by default.
  2. Removes the explicitly set gc feature for the wasmtime dependency in c-api, thus enabling downstream users to specify this behaviour.

Closes #12783

@tolumide-ng tolumide-ng requested a review from a team as a code owner March 19, 2026 22:51
@tolumide-ng tolumide-ng requested review from cfallin and removed request for a team March 19, 2026 22:51
@github-actions github-actions bot added the wasmtime:c-api Issues pertaining to the C API. label Mar 20, 2026

[features]
# WASMTIME_FEATURE_LIST
default = ["gc"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh for this the default feature lives here instead which includes gc, so I think it's reasonable to just from [dependencies]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your response @alexcrichton, I am missing part of your suggestion here. Do you mean removing gc as a default feature in' wasmtime/Cargo. toml' and adding #[cfg(feature = "gc")] to the affected parts?

@tolumide-ng tolumide-ng requested a review from a team as a code owner March 21, 2026 00:13
@tolumide-ng tolumide-ng force-pushed the fix/wasmtime-c-api-gc-update branch from 0fb765b to 2569780 Compare March 21, 2026 01:31
- Remove gc from default on c-api
- Adds fallback implementation for when gc is not enabled
@tolumide-ng tolumide-ng force-pushed the fix/wasmtime-c-api-gc-update branch from 2569780 to ba53a43 Compare March 21, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:c-api Issues pertaining to the C API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

c-api: gc feature unconditionally enabled in wasmtime crate

2 participants