Document #[contractimpl] export name behaviour#1809
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds clarifying documentation to #[contractimpl] explaining how Wasm export names are derived and why that can lead to surprising export collisions, including via dependencies.
Changes:
- Document that Wasm export names are derived from the method name only (no type prefix/namespace).
- Document the requirement that method names be unique across all
#[contractimpl]blocks within a crate to avoid export collisions. - Document that linking a dependency that contains
#[contractimpl]can bring its exports into the final Wasm binary, potentially causing unexpected exports/collisions.
mootz12
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Add a Notes section to the
#[contractimpl]macro documentation explaining that export names are derived from function names alone (no type prefix), that function names must be unique across all#[contractimpl]blocks in a crate to avoid Wasm export collisions, and that importing a crate containing#[contractimpl]blocks pulls its exported functions into the importing binary.Why
Both behaviors — duplicate names across impl blocks and transitive re-export from dependencies — are non-obvious and were not documented on the contractimpl macro.
Close #1808