summaryrefslogtreecommitdiffstats
path: root/tests/ui/generic-associated-types/impl_bounds.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/generic-associated-types/impl_bounds.rs')
-rw-r--r--tests/ui/generic-associated-types/impl_bounds.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/generic-associated-types/impl_bounds.rs b/tests/ui/generic-associated-types/impl_bounds.rs
new file mode 100644
index 000000000..e45bdcf92
--- /dev/null
+++ b/tests/ui/generic-associated-types/impl_bounds.rs
@@ -0,0 +1,24 @@
+#![feature(associated_type_defaults)]
+
+trait Foo {
+ type A<'a> where Self: 'a;
+ type B<'a, 'b> where 'a: 'b;
+ type C where Self: Clone;
+ fn d() where Self: Clone;
+}
+
+#[derive(Copy, Clone)]
+struct Fooy<T>(T);
+
+impl<T> Foo for Fooy<T> {
+ type A<'a> = (&'a ()) where Self: 'static;
+ //~^ ERROR impl has stricter requirements than trait
+ type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
+ //~^ ERROR impl has stricter requirements than trait
+ type C = String where Self: Copy;
+ //~^ ERROR the trait bound `T: Copy` is not satisfied
+ fn d() where Self: Copy {}
+ //~^ ERROR the trait bound `T: Copy` is not satisfied
+}
+
+fn main() {}