Skip to content

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Nov 14, 2025

Summary

Adds bitflags module to the embedded wit_bindgen runtime to support WASI filesystem interfaces.

Changes

  • Added pub mod bitflags with pub(crate) use bitflags; to both guest and native-guest wrapper modes
  • Added bitflags dependency to both bindings libraries (bindings_lib_host and bindings_lib_wasm_base)
  • Added bitflags crate (v2.6) to tools/checksum_updater Cargo.toml

Technical Details

The bitflags macro is now accessible as crate::wit_bindgen::rt::bitflags::bitflags! as expected by generated code from wit-bindgen when using WASI filesystem interfaces.

WASI filesystem types like wasi:filesystem/types generate bitflags for:

  • DescriptorFlags
  • PathFlags
  • OpenFlags

Without this fix, builds would fail with "could not find bitflags in rt" errors.

Testing

✅ Tested with:

  • //examples/basic:hello_component_bindings_host - builds successfully
  • //tools/checksum_updater_wasm:checksum_updater_wasm_component - builds successfully (uses wasi:filesystem/[email protected])

Both targets compile without bitflags-related errors.

Add bitflags module to the embedded runtime in rust_wasm_component_bindgen.bzl
to support WASI filesystem interfaces that generate bitflags for DescriptorFlags,
PathFlags, and OpenFlags.

Changes:
- Add pub mod bitflags with pub(crate) use bitflags in both guest and native-guest wrappers
- Add bitflags dependency to both bindings libraries
- Add bitflags crate to tools/checksum_updater Cargo.toml

The bitflags macro is now accessible as crate::wit_bindgen::rt::bitflags::bitflags!
as expected by generated code.

Tested with:
- //examples/basic:hello_component_bindings_host
- //tools/checksum_updater_wasm:checksum_updater_wasm_component (uses wasi:filesystem/types)
@avrabe avrabe merged commit 3c83680 into main Nov 14, 2025
20 checks passed
@avrabe avrabe deleted the fix/add-bitflags-to-embedded-runtime branch November 14, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants