Skip to content

Conversation

@dsgallups
Copy link

This PR fixes an issue with trait implementation where you have

use tsify::Tsify;

pub trait Constraint {}

#[derive(Tsify)]
#[tsify(into_wasm_abi, from_wasm_abi)]
pub struct GenericStruct<T: Constraint> {
    x: T,
}
error[E0229]: associated item constraints are not allowed here
  |
  | pub struct GenericStruct<T: Constraint> {
  |                          ^^^^^^^^^^^^^ associated item constraint not allowed here

This is because the implementation of traits would have an invalidate generic constraint in the where clause:

    #[automatically_derived]
    impl<T: Constraint> IntoWasmAbi for &GenericStruct<T>
    where
        GenericStruct<T: Constraint>: _serde::Serialize,

This has been fixed:

    #[automatically_derived]
    impl<T: Constraint> IntoWasmAbi for &GenericStruct<T>
    where
        GenericStruct<T>: _serde::Serialize,

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.

1 participant