Skip to content

Commit 9905b76

Browse files
committed
fix: remove duplicate macro exports in generated WIT bindings
Some WIT world definitions cause wit-bindgen to generate duplicate 'pub use __export_*_cabi' statements. This fix filters out these duplicates during wrapper generation to prevent compilation errors.
1 parent 2b57ba4 commit 9905b76

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rust/rust_wasm_component_bindgen.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +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
6364
ctx.actions.run_shell(
64-
command = 'echo \'{}\' > {} && echo "" >> {} && cat {} >> {}'.format(
65+
command = '''echo '{}' > {} && echo "" >> {} && cat {} | sed 's/^pub use __export_.*_cabi;$//' >> {}'''.format(
6566
wrapper_content.replace("'", "'\"'\"'"),
6667
out_file.path,
6768
out_file.path,

0 commit comments

Comments
 (0)