about summary refs log tree commit diff
path: root/tests/ui/inference/iterator-sum-array-15673.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/inference/iterator-sum-array-15673.rs')
-rw-r--r--tests/ui/inference/iterator-sum-array-15673.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/inference/iterator-sum-array-15673.rs b/tests/ui/inference/iterator-sum-array-15673.rs
new file mode 100644
index 00000000000..c3d94415aff
--- /dev/null
+++ b/tests/ui/inference/iterator-sum-array-15673.rs
@@ -0,0 +1,11 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/15673
+
+//@ run-pass
+#![allow(stable_features)]
+
+#![feature(iter_arith)]
+
+fn main() {
+    let x: [u64; 3] = [1, 2, 3];
+    assert_eq!(6, (0..3).map(|i| x[i]).sum::<u64>());
+}