aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-20 18:46:10 +0100
committerMartin Fischer <martin@push-f.com>2021-11-20 18:46:20 +0100
commit3170127a4ef79c43018775934c7e0444dc828b2d (patch)
tree02d32485116a708ad4cfd68a450d9bdfdf330340 /src
parent91ca29ade1ab6b90dda972c2a42a5dc529ddfb44 (diff)
make dyn trait take over super traits except Sized
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2e0129e..a190cb9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,7 +9,6 @@ use quote::quote;
use quote::quote_spanned;
use quote::ToTokens;
use syn::parse_macro_input;
-use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::token::Brace;
use syn::token::Gt;
@@ -171,7 +170,15 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
trait_token: Trait::default(),
generics: original_trait.generics.clone(),
colon_token: None,
- supertraits: Punctuated::new(),
+ supertraits: original_trait
+ .supertraits
+ .iter()
+ .filter(|t| match t {
+ TypeParamBound::Trait(t) => !t.path.is_ident("Sized"),
+ TypeParamBound::Lifetime(_) => true,
+ })
+ .cloned()
+ .collect(),
brace_token: Brace::default(),
items: Vec::new(),
};