aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 4d09847..652be48 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -152,3 +152,28 @@ trait AsyncWithCallback: Sync {
async fn test1(&self) -> Self::A;
async fn fun_with_callback<F: Fn(Self::A) + Sync + Send + 'static>(&self, a: F);
}
+
+#[dynamize::dynamize]
+trait TypeTraitBound {
+ type A: std::error::Error;
+
+ fn foobar(&self, text: &str) -> Result<i32, Self::A>;
+}
+
+fn type_trait_bound_test<T: TypeTraitBound>(t: T) {
+ let dyn_trait: &dyn DynTypeTraitBound = &t;
+ let _: Result<i32, Box<dyn std::error::Error>> = dyn_trait.foobar("test");
+}
+
+#[dynamize::dynamize]
+trait TypeTraitBoundStatic {
+ type A: std::error::Error + 'static;
+
+ fn foobar(&self, text: &str) -> Result<i32, Self::A>;
+}
+
+fn type_trait_bound_static_test(
+ t: Box<dyn DynTypeTraitBoundStatic>,
+) -> Option<Box<dyn std::error::Error>> {
+ t.foobar("test").err()
+}