diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-20 18:46:10 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-20 18:46:20 +0100 |
commit | 3170127a4ef79c43018775934c7e0444dc828b2d (patch) | |
tree | 02d32485116a708ad4cfd68a450d9bdfdf330340 /src | |
parent | 91ca29ade1ab6b90dda972c2a42a5dc529ddfb44 (diff) |
make dyn trait take over super traits except Sized
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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(), }; |