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

Regression: into_wasm_abi requiring unnecessary trait bound #25

Closed
nappa85 opened this issue Apr 12, 2024 · 9 comments · Fixed by #26 or #31
Closed

Regression: into_wasm_abi requiring unnecessary trait bound #25

nappa85 opened this issue Apr 12, 2024 · 9 comments · Fixed by #26 or #31

Comments

@nappa85
Copy link

nappa85 commented Apr 12, 2024

This works with tsify, upgrading to tsify-next it starts giving an error about Id and Value not having a bound on serde::Serialize

#[derive(serde::Serialize, tsify_next::Tsify)]
#[tsify(into_wasm_abi)]
pub struct Identified<Id, Value> {
    pub id: Id,
    pub value: Value,
}
@Pantamis
Copy link

I suspect my PR #22 may have done it 😅

I will take a look at this.

@Pantamis Pantamis mentioned this issue Apr 12, 2024
@Pantamis
Copy link

It should be fixed by #26 can you test it ?

I have an annoying warning about an unused field when compiling, do you have it too ?

@nappa85
Copy link
Author

nappa85 commented Apr 12, 2024

Now it works, the only negative detail is the warning

Function `__wbg_instanceof_JsType_d5b10ea09f1d9e1c` should have snake_case name, e.g. `__wbg_instanceof_js_type_d5b10ea09f1d9e1c`rust-analyzer[non_snake_case](https://doc.rust-lang.org/rustc/?search%3Dnon_snake_case)

But it isn't related to this issue

@Pantamis
Copy link

Nice ! Thanks for testing the fix 👍

Yeah I may usually get such warning in rust analyser too, I think it comes from wasm_bindgen

@nappa85
Copy link
Author

nappa85 commented Apr 12, 2024

Not sure about that, I remember someone pointed it out on tsify (and maybe proposed a fix), I'll search it out as soon I have time

siefkenj pushed a commit that referenced this issue Apr 12, 2024
Fix: where clause for From conversion trait (Fixes #25)
@siefkenj
Copy link
Owner

Should be fixed in v0.5.2

@nappa85
Copy link
Author

nappa85 commented Apr 12, 2024

Sorry to reopen, but I've just found another problem:

#[derive(serde::Serialize, tsify_next::Tsify)]
#[tsify(into_wasm_abi)]
pub struct Identified<Id, Value>
where
    Id: Send,
{
    pub id: Id,
    pub value: Value,
}

Any trait bound, in this example Send, causes the macro to generate an error about the bound not being satisfied

@Pantamis
Copy link

@nappa85 I made another fix and improve our test to cover such cases. If you have other edge case where it does not work, let us know !

@nappa85
Copy link
Author

nappa85 commented Apr 15, 2024

I really hope the edge cases are terminated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants