fix: make bitflags macro publicly accessible from generated bindings #207
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The bitflags macro in the embedded wit_bindgen runtime was using
pub(crate)visibility, which made it only accessible within the generated bindings crate itself. This prevented external crates that depend on the generated bindings from accessing the macro when they use WASI filesystem interfaces.Solution
Changed
pub(crate) use bitflags;topub use bitflags::bitflags;in both wrapper modes:This properly exports the bitflags macro so downstream crates can access it through the expected path:
crate::wit_bindgen::rt::bitflags::bitflags!Testing
Verified builds succeed for:
//examples/basic:hello_component_bindings_host- native-guest mode bindings//tools/checksum_updater_wasm:checksum_updater_wasm_component- WASM component using WASI filesystem interfaces (wasi:filesystem/[email protected])Both targets compile without "could not find bitflags in rt" errors.
Impact
This fixes the visibility issue for any external crate that:
rust_wasm_component_bindgen