Skip to content

Commit

Permalink
fix: keep components send + sync
Browse files Browse the repository at this point in the history
  • Loading branch information
ccbrown committed Nov 1, 2024
1 parent 8b6d014 commit 2733616
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/iocraft-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl ToTokens for ParsedComponent {
tokens.extend(quote! {
#(#attrs)*
#vis struct #name #impl_generics {
_marker: std::marker::PhantomData<*const (#(#ty_generic_names),*)>,
_marker: std::marker::PhantomData<fn(#(#ty_generic_names),*)>,
}

impl #impl_generics #name #ty_generics #where_clause {
Expand Down
6 changes: 6 additions & 0 deletions packages/iocraft-macros/tests/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ fn MyComponentWithGenericProps<T: 'static, const U: usize>(
element!(Box)
}

fn check_component_traits<T: Sync + Send>() {}

fn check_component_traits_with_generic<T: 'static, const U: usize>() {
check_component_traits::<MyComponentWithGenericProps<T, U>>();
}

#[component]
fn MyComponentWithGenericPropsWhereClause<T, const U: usize>(
_props: &mut MyGenericProps<T, U>,
Expand Down

0 comments on commit 2733616

Please sign in to comment.