Skip to content
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

rust: Generated resource bindings can conflict with resource methods #1059

Open
lann opened this issue Sep 28, 2024 · 4 comments
Open

rust: Generated resource bindings can conflict with resource methods #1059

lann opened this issue Sep 28, 2024 · 4 comments

Comments

@lann
Copy link
Contributor

lann commented Sep 28, 2024

package repro:pkg;
world example {
  resource repro {
    constructor();
    handle: func();
  }
}

generates two conflicting Repro::handle methods; one #[doc(hidden)] internal method and the actual resource method. Same would presumably be true for take_handle and (static) from_handle.

@alexcrichton
Copy link
Member

Oops, thanks! For purely internal functions we should probably rename them to _foo or similar, but otherwise we'll probably need to "mangle" WIT-based names that conflict.

@lann
Copy link
Contributor Author

lann commented Sep 30, 2024

Do they need to be methods? Could they just be regular (associated) functions?

@alexcrichton
Copy link
Member

Good point yeah, doc(hidden) items can also be associated functions. Using _ as a prefix for those I think would also be reasonable

@lann
Copy link
Contributor Author

lann commented Sep 30, 2024

I guess bindgen will never generate a _ prefix so it doesn't really matter 🤷

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

No branches or pull requests

2 participants