-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name conflict when a struct is called "Context" #1249
Comments
Thanks again for spinning this off! This is actually somewhat difficult to support now that I think about it. Right now all the exports from Rust are generated into a flat namespace in JS, so this is actually a legitimate namespace conflict. I'm not sure we can really support duplicate-ly named types in separate crates being linked together because we wouldn't know what to call the names in JS! What I do think, however, is that the test framework should be using less common names :) |
Do we have access to the source crate of a symbol? Maybe that could be integrated into the name? |
We do! All that would end up with though is a better error message here, which is certainly an improvement! I'm nto sure we could actually allow this still |
I've posted a rename for our own |
Thank you! Feel free to close this issue, unless it should stay open to discuss further namespacing / name mangling. |
Ok I think in that case I'll go ahead and close |
Thank you so much for this comment --- it got me unstuck. I found this issue when looking up "wasm_bindgen duplicate symbol". In my particular case, I have multiple crates in a cargo workspace that followed similar impl Consume {
// . . .
#[wasm_bindgen]
pub fn start(/* ... */) {}
} and the solution was to re-name the structs to be "crate specific", e.g.
As a complete noob: Is it possible for |
As discussed in #1242: I'm getting the following error when a struct is called
Context
when callingwasm-pack test --headless --firefox
:Probably a name mangling issue.
The text was updated successfully, but these errors were encountered: