Skip to content

bug: clear_* registry functions duplicated in bridge modules, causing compile error #100

Description

@kh3rld

Description

clear_fn functions (e.g. clear_ocr_backends) have no dyn Trait parameter, so find_bridge_param returns None and they fall through to the regular top-level emitter in each backend. The bridge layer emits them independently. In backends with a flat or glob-re-exported namespace this produces duplicate symbols.

Root cause

The is_trait_bridge_managed_fn guard was applied to magnus, rustler, napi, php, go, dart, swift, and zig on 2026-05-20 but was never applied to wasm, extendr, ffi, or java.

Steps to reproduce

Add any clear_*() function to a crate's public API and run alef generate for the wasm target.

Expected behavior: clear_* functions appear only as top-level wasm exports. Bridge modules (__alef_wasm_bridge_*) should contain only bridge-specific items: the Wasm*Bridge struct, register*, and unregister*.

Workaround: Manually remove the clear_* blocks from each bridge module in the generated lib.rs.

Relevant files and configuration

 **wasm** -  bridge modules are glob-re-exported (`pub use __alef_wasm_bridge_*::*`), so wasm-bindgen sees two `#[wasm_bindgen(js_name = "clearXxx")]` for each configured `clear_fn` and errors with `"symbol already defined"`. Manifests immediately on any crate that configures `clear_fn`.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions