aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-19 12:14:01 +0100
committerMartin Fischer <martin@push-f.com>2021-11-19 12:14:05 +0100
commit79ff6d3cd0602399f3bdc6ac8d52f4c6983e5cb8 (patch)
tree1ab66a7e3ae3719255f7a01ab793669c6b1e1465 /src
parent323762d238ebb9d9b8fa65bd1290aaa39648615c (diff)
better error for assoc types in trait generic bounds
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 99abfdb..abeab4c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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"
+ );
+ }
+ }
}
}