aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-24 17:57:31 +0100
committerMartin Fischer <martin@push-f.com>2021-11-24 17:57:32 +0100
commit8179dfab311b5e9555e34e6f42e58b1d3a3a4e08 (patch)
treec924bd0035b5b4c1cb2cba9c08376706e33db877 /src/lib.rs
parent010d91946605b03db5975fa39c5c9b46ef4c985a (diff)
better error for associated types in supertraits
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3656bf7..277720e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,6 +104,19 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
let mut blanket_impl_attrs = Vec::new();
let mut dyn_trait_attrs = Vec::new();
+ // just to provide a better error message
+ for bound in trait_bounds(&original_trait.supertraits) {
+ if let Some(assoc_type) = iter_path(&bound.path)
+ .filter_map(filter_map_assoc_paths)
+ .next()
+ {
+ return abort!(
+ assoc_type.span(),
+ "dynamize does not support associated types in supertraits"
+ );
+ }
+ }
+
// FUTURE: use Vec::drain_filter once it's stable
let mut i = 0;
while i < original_trait.attrs.len() {