Skip to content

Document #[contractimpl] export name behaviour#1809

Merged
mootz12 merged 1 commit intomainfrom
add-contractimpl-docs
Apr 1, 2026
Merged

Document #[contractimpl] export name behaviour#1809
mootz12 merged 1 commit intomainfrom
add-contractimpl-docs

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch commented Apr 1, 2026

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

@leighmcculloch leighmcculloch requested a review from mootz12 April 1, 2026 01:27
@leighmcculloch leighmcculloch marked this pull request as ready for review April 1, 2026 05:59
Copilot AI review requested due to automatic review settings April 1, 2026 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mootz12 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit c32bb7e Apr 1, 2026
202 of 204 checks passed
@mootz12 mootz12 deleted the add-contractimpl-docs branch April 1, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document that #[contractimpl] exports use method name only

3 participants