diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-19 12:14:01 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-19 12:14:05 +0100 |
commit | 79ff6d3cd0602399f3bdc6ac8d52f4c6983e5cb8 (patch) | |
tree | 1ab66a7e3ae3719255f7a01ab793669c6b1e1465 /src | |
parent | 323762d238ebb9d9b8fa65bd1290aaa39648615c (diff) |
better error for assoc types in trait generic bounds
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -43,6 +43,8 @@ use crate::parse_trait_sig::parse_trait_signature; use crate::parse_trait_sig::MethodParseError; use crate::parse_trait_sig::SignatureChanges; use crate::parse_trait_sig::TypeTransform; +use crate::syn_utils::find_in_path; +use crate::syn_utils::trait_bounds; use crate::transform::AssocTypeConversions; mod parse_assoc_type; @@ -179,6 +181,14 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream { for generic in &dyn_trait.generics.params { if let GenericParam::Type(type_param) = generic { generic_map.insert(type_param.ident.clone(), type_param.bounds.clone()); + for trait_bound in trait_bounds(&type_param.bounds) { + if let Some(assoc_type) = find_in_path(&trait_bound.path, &AssocTypeMatcher) { + return abort!( + assoc_type.span(), + "dynamize does not support associated types in trait generic bounds" + ); + } + } } } |