about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/issue-76342.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/pattern/issue-76342.rs b/tests/ui/pattern/issue-76342.rs
new file mode 100644
index 00000000000..2b3d3e522f2
--- /dev/null
+++ b/tests/ui/pattern/issue-76342.rs
@@ -0,0 +1,16 @@
+// check-pass
+#![allow(unused_variables)]
+struct Zeroes;
+impl Into<[usize; 2]> for Zeroes {
+    fn into(self) -> [usize; 2] { [0; 2] }
+}
+impl Into<[usize; 3]> for Zeroes {
+    fn into(self) -> [usize; 3] { [0; 3] }
+}
+impl Into<[usize; 4]> for Zeroes {
+    fn into(self) -> [usize; 4] { [0; 4] }
+}
+fn main() {
+    let [a, b, c] = Zeroes.into(); // ERROR: type annotations needed
+    let [d, e, f]: [_; 3] = Zeroes.into(); // Works great
+}