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

Handle raw identifiers in wasm_bindgen_test macro #3541

Merged
merged 4 commits into from Aug 5, 2023

Conversation

snOm3ad
Copy link
Contributor

@snOm3ad snOm3ad commented Aug 2, 2023

Currently the use of raw identifiers in test names produces an invalid function name. Ident::new panics whenever it encounters the r# prefix, instead Ident::new_raw should be used.

However, the __wbgt prefix we append forms a valid identifier already. So removing the raw ident prefix ("r#") is the only thing required to create a valid function name.

Fixes #3288

Currently the use of raw identifiers in test names produces an invalid
function name. `Ident::new` panics whenever it encounters the `r#`
prefix, instead `Ident::new_raw` should be used.

However, the `__wbgt` prefix we append helps form a valid identifier
already. So removing the "r#" prefix is the only thing required.

Fixes rustwasm#3288

Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
crates/test-macro/src/lib.rs Outdated Show resolved Hide resolved
@daxpedda
Copy link
Collaborator

daxpedda commented Aug 4, 2023

A note in the changelog would be appreciated as well.

@snOm3ad snOm3ad requested a review from daxpedda August 5, 2023 12:27
Signed-off-by: Oliver T <geronimooliver00@gmail.com>
Copy link
Collaborator

@hamza1311 hamza1311 left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Thanks!

@daxpedda daxpedda merged commit f0d1009 into rustwasm:main Aug 5, 2023
25 checks passed
@snOm3ad snOm3ad deleted the fix-raw-idents-tests branch August 17, 2023 13:48
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.

wasm-bindgen-test macro panics when a function name uses raw ident
3 participants