Skip to content

Commit 81572e4

Browse files
committed
fix: preserve interface-specific export macros in wrapper generation
The wrapper generation was incorrectly removing ALL export macros with a sed filter, including the interface-specific ones needed for multi-interface components. This caused build failures when wit-bindgen generates separate export macros for each interface in multi-interface worlds. Changes: - Remove sed filter that stripped all `pub use __export_.*_cabi` statements - Preserve interface-specific export macros like __export_*_interface_*_cabi - Allow main export macro to correctly reference interface-specific macros - Enable multi-interface component builds with fixed wit-bindgen This resolves build errors like: error[E0433]: failed to resolve: could not find `__export_*_interface_*_cabi` The fix works with both single-interface and multi-interface components, maintaining backward compatibility while enabling the export macro visibility fix from wit-bindgen.
1 parent 41a5a2e commit 81572e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust/rust_wasm_component_bindgen.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ pub mod wit_bindgen {
6060
"""
6161

6262
# Concatenate wrapper content with generated bindings
63-
# Also remove duplicate 'pub use' statements that wit-bindgen might generate
63+
# Keep interface-specific export macros but remove any duplicate top-level exports
6464
ctx.actions.run_shell(
65-
command = '''echo '{}' > {} && echo "" >> {} && cat {} | sed 's/^pub use __export_.*_cabi;$//' >> {}'''.format(
65+
command = '''echo '{}' > {} && echo "" >> {} && cat {} >> {}'''.format(
6666
wrapper_content.replace("'", "'\"'\"'"),
6767
out_file.path,
6868
out_file.path,

0 commit comments

Comments
 (0)