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

Replace all Self identifiers in method argument and return types #4155

Merged
merged 9 commits into from
Oct 10, 2024

Conversation

RunDevelopment
Copy link
Contributor

@RunDevelopment RunDevelopment commented Oct 9, 2024

fixes #3105
closes #3631

This PR is based on #3631 by @snOm3ad. I looked at it to see what needed to be changed and that I stole tests from there. I tagged @snOm3ad as the co-author in one commit, but (speaking to the maintainer) please also tag them in the merge commit of this PR in case GH doesn't.

The main approach of this PR is different from #3631. I used syn's mut visitor to replace all Self identifiers with the identifier for the type. This makes the code very simple and guarantees that no occurrences of Self are left.

Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

I would appreciate if you could leave some code comments here, I always have to spend non-trivial time digging into this when it comes up.

@daxpedda daxpedda added the waiting for author Waiting for author to respond label Oct 9, 2024
@RunDevelopment
Copy link
Contributor Author

I would appreciate if you could leave some code comments here, I always have to spend non-trivial time digging into this when it comes up.

Gladly. I assume that this is a general remark about my PRs and I will add some more code comments from now on.

Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Thank you!
(needs a rebase again)

@daxpedda daxpedda merged commit 0e89a29 into rustwasm:main Oct 10, 2024
41 checks passed
@RunDevelopment RunDevelopment deleted the self-methods branch October 10, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for author Waiting for author to respond
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Returning Option<Self> in #[wasm_bindgen] impl block gives error
2 participants