about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/usefulness/issue-72476-associated-type.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/pattern/usefulness/issue-72476-associated-type.rs b/src/test/ui/pattern/usefulness/issue-72476-associated-type.rs
new file mode 100644
index 00000000000..21ad6c7d989
--- /dev/null
+++ b/src/test/ui/pattern/usefulness/issue-72476-associated-type.rs
@@ -0,0 +1,23 @@
+// check-pass
+
+// From https://github.com/rust-lang/rust/issues/72476
+
+trait A {
+    type Projection;
+}
+
+impl A for () {
+    type Projection = bool;
+    // using () instead of bool here does compile though
+}
+
+struct Next<T: A>(T::Projection);
+
+fn f(item: Next<()>) {
+    match item {
+        Next(true) => {}
+        Next(false) => {}
+    }
+}
+
+fn main() {}