aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a190cb9..85718d0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -308,12 +308,18 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
let blanket_impl = generate_blanket_impl(&dyn_trait, &original_trait, &method_impls);
+ let dyn_trait_name = &dyn_trait.ident;
+ let (impl_generics, ty_generics, where_clause) = dyn_trait.generics.split_for_impl();
+
let expanded = quote! {
#original_trait
#(#dyn_trait_attrs)*
#dyn_trait
+ // assert that dyn_trait can actually be made into an object
+ impl #impl_generics dyn #dyn_trait_name #ty_generics #where_clause {}
+
#(#blanket_impl_attrs)*
#blanket_impl
};
@@ -432,3 +438,7 @@ fn path_segment_for_trait(sometrait: &ItemTrait) -> PathSegment {
},
}
}
+
+#[doc = include_str!("../tests/doctests.md")]
+#[cfg(doctest)]
+struct Doctests;