about summary refs log tree commit diff
path: root/tests/ui/resolve/resolve-self-in-impl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/resolve/resolve-self-in-impl.rs')
-rw-r--r--tests/ui/resolve/resolve-self-in-impl.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/resolve/resolve-self-in-impl.rs b/tests/ui/resolve/resolve-self-in-impl.rs
new file mode 100644
index 00000000000..d0872d1b76f
--- /dev/null
+++ b/tests/ui/resolve/resolve-self-in-impl.rs
@@ -0,0 +1,21 @@
+#![feature(associated_type_defaults)]
+
+struct S<T = u8>(T);
+trait Tr<T = u8> {
+    type A = ();
+}
+
+impl Tr<Self> for S {} // OK
+impl<T: Tr<Self>> Tr<T> for S {} // OK
+impl Tr for S where Self: Copy {} // OK
+impl Tr for S where S<Self>: Copy {} // OK
+impl Tr for S where Self::A: Copy {} // OK
+
+impl Tr for Self {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl Tr for S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl Self {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl S<Self> {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl (Self, Self) {} //~ ERROR `Self` is not valid in the self type of an impl block
+impl Tr<Self::A> for S {} //~ ERROR cycle detected
+
+fn main() {}