aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs13
-rw-r--r--ui-tests/src/bin/supertrait.rs6
-rw-r--r--ui-tests/src/bin/supertrait.stderr5
3 files changed, 24 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() {
diff --git a/ui-tests/src/bin/supertrait.rs b/ui-tests/src/bin/supertrait.rs
new file mode 100644
index 0000000..1dc4127
--- /dev/null
+++ b/ui-tests/src/bin/supertrait.rs
@@ -0,0 +1,6 @@
+#[dynamize::dynamize]
+trait Foo: Into<Self::X> {
+ type X;
+}
+
+fn main() {}
diff --git a/ui-tests/src/bin/supertrait.stderr b/ui-tests/src/bin/supertrait.stderr
new file mode 100644
index 0000000..ebb1561
--- /dev/null
+++ b/ui-tests/src/bin/supertrait.stderr
@@ -0,0 +1,5 @@
+error: dynamize does not support associated types in supertraits
+ --> src/bin/supertrait.rs:2:17
+ |
+2 | trait Foo: Into<Self::X> {
+ | ^^^^