aboutsummaryrefslogtreecommitdiff
path: root/src/transform.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-21 08:33:52 +0100
committerMartin Fischer <martin@push-f.com>2021-11-21 08:36:10 +0100
commit34dc166a9bc003bad36c28aeb29b625195d20a74 (patch)
tree1a4b7fbcd673f8094b019263cbe954ef38abb97c /src/transform.rs
parentbd6f84036426c43e08078cf11e4ee70b7714ba2f (diff)
better errors for assoc types in where clauses
Diffstat (limited to 'src/transform.rs')
-rw-r--r--src/transform.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/transform.rs b/src/transform.rs
index 676cfd8..b13b7cf 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -141,11 +141,27 @@ pub fn dynamize_function_bounds(
}
}
- // TODO: return error if predicate_type.bounded_ty contains associated type
+ // just to provide better error messages
+ if let Some(assoc_type) =
+ iter_type(&predicate_type.bounded_ty).find_map(filter_map_assoc_paths)
+ {
+ return Err((
+ assoc_type.span(),
+ MethodParseError::UnconvertibleAssocTypeInWhereClause,
+ ));
+ }
+ // just to provide better error messages
for bound in &mut predicate_type.bounds {
- if let TypeParamBound::Trait(_bound) = bound {
- // TODO: return error if bound.path contains associated type
+ if let TypeParamBound::Trait(bound) = bound {
+ if let Some(assoc_type) =
+ iter_path(&bound.path).find_map(filter_map_assoc_paths)
+ {
+ return Err((
+ assoc_type.span(),
+ MethodParseError::UnconvertibleAssocTypeInWhereClause,
+ ));
+ }
}
}
}