Skip to content

Unwrap argument types in macro#3625

Merged
daxpedda merged 7 commits intowasm-bindgen:mainfrom
snOm3ad:fix-nested-macros
Sep 20, 2023
Merged

Unwrap argument types in macro#3625
daxpedda merged 7 commits intowasm-bindgen:mainfrom
snOm3ad:fix-nested-macros

Conversation

@snOm3ad
Copy link
Copy Markdown
Contributor

@snOm3ad snOm3ad commented Sep 19, 2023

syn wraps argument types in a syn::TypeGroup for free functions/methods generated from macro_rules! this means that references end up generating wrong code during proc macro expansion.

This PR unwraps argument types in syn::TypeGroup and matches against the inner element for such cases.

Fixes #3078

`syn` wraps argument types in a `syn::TypeGroup` for free
functions/methods generated from `macro_rules!` this means that
references end up generating wrong code during proc macro expansion.

This PR unwraps argument types in `syn::TypeGroup` and matches against
the inner element for such cases.

Fixes wasm-bindgen#3078

Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Comment thread crates/backend/src/codegen.rs Outdated
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Copy link
Copy Markdown
Member

@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.

Could you add a test for this?

Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Comment thread crates/cli/tests/wasm-bindgen/main.rs
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Copy link
Copy Markdown
Member

@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.

Thanks!

Signed-off-by: Oliver T <geronimooliver00@gmail.com>
@daxpedda daxpedda merged commit 4bafdbe into wasm-bindgen:main Sep 20, 2023
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.

Macro expansion code, export function parameter is &T

3 participants