summaryrefslogtreecommitdiffstats
path: root/src/test/ui/self/self-impl.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/self/self-impl.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/self/self-impl.rs b/src/test/ui/self/self-impl.rs
new file mode 100644
index 000000000..ed250ce52
--- /dev/null
+++ b/src/test/ui/self/self-impl.rs
@@ -0,0 +1,30 @@
+// Test that unsupported uses of `Self` in impls don't crash
+
+struct Bar;
+
+trait Foo {
+ type Baz;
+}
+
+trait SuperFoo {
+ type SuperBaz;
+}
+
+impl Foo for Bar {
+ type Baz = bool;
+}
+
+impl SuperFoo for Bar {
+ type SuperBaz = bool;
+}
+
+impl Bar {
+ fn f() {
+ let _: <Self>::Baz = true;
+ //~^ ERROR ambiguous associated type
+ let _: Self::Baz = true;
+ //~^ ERROR ambiguous associated type
+ }
+}
+
+fn main() {}