summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-types/missing-associated-types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/associated-types/missing-associated-types.rs')
-rw-r--r--src/test/ui/associated-types/missing-associated-types.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/associated-types/missing-associated-types.rs b/src/test/ui/associated-types/missing-associated-types.rs
new file mode 100644
index 000000000..3c8410e39
--- /dev/null
+++ b/src/test/ui/associated-types/missing-associated-types.rs
@@ -0,0 +1,27 @@
+use std::ops::{Add, Sub, Mul, Div};
+trait X<Rhs>: Mul<Rhs> + Div<Rhs> {}
+trait Y<Rhs>: Div<Rhs, Output = Rhs> {
+ type A;
+}
+trait Z<Rhs>: Div<Rhs> {
+ type A;
+ type B;
+}
+trait Fine<Rhs>: Div<Rhs, Output = Rhs> {}
+
+type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
+//~^ ERROR only auto traits can be used as additional traits in a trait object
+//~| ERROR the value of the associated types
+type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
+//~^ ERROR only auto traits can be used as additional traits in a trait object
+//~| ERROR the value of the associated types
+type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
+//~^ ERROR only auto traits can be used as additional traits in a trait object
+//~| ERROR the value of the associated types
+type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
+//~^ ERROR only auto traits can be used as additional traits in a trait object
+//~| ERROR the value of the associated types
+type Bal<Rhs> = dyn X<Rhs>;
+//~^ ERROR the value of the associated types
+
+fn main() {}