fix: more accurate derive Clone, PartialEq for generic components (#3968)

* convert to manual clone implements
* add test for generics
This commit is contained in:
Clouds authored and GitHub committed 2025-04-09 11:03:14 -07:00
1 parent 82534d389f
commit e0ecf0eb49
2 files changed
+105 -5

No files matched your search

+28
View File
@@ -30,6 +30,34 @@ fn generic_props_compile() {
rsx! {}
}
#[component]
fn TakesCloneArc<T: PartialEq + 'static>(value: std::sync::Arc<T>) -> Element {
rsx! {}
}
struct MyBox<T>(std::marker::PhantomData<T>);
impl<T: Display> Clone for MyBox<T> {
fn clone(&self) -> Self {
MyBox(std::marker::PhantomData)
}
}
impl<T: Display> PartialEq for MyBox<T> {
fn eq(&self, _: &Self) -> bool {
true
}
}
#[component]
#[allow(clippy::multiple_bound_locations)]
fn TakesCloneMyBox<T: 'static>(value: MyBox<T>) -> Element
where
T: Display,
{
rsx! {}
}
#[derive(Props, Clone, PartialEq)]
struct TakesCloneManualProps<T: Clone + PartialEq + 'static> {
value: T,