about summary refs log tree commit diff
path: root/src/test/ui/iterators/iter-count-overflow-ndebug.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/iterators/iter-count-overflow-ndebug.rs')
-rw-r--r--src/test/ui/iterators/iter-count-overflow-ndebug.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/iterators/iter-count-overflow-ndebug.rs b/src/test/ui/iterators/iter-count-overflow-ndebug.rs
new file mode 100644
index 00000000000..b755bb554f4
--- /dev/null
+++ b/src/test/ui/iterators/iter-count-overflow-ndebug.rs
@@ -0,0 +1,11 @@
+// run-pass
+// only-32bit too impatient for 2⁶⁴ items
+// compile-flags: -C debug_assertions=no -C opt-level=3
+
+use std::panic;
+use std::usize::MAX;
+
+fn main() {
+    assert_eq!((0..MAX).by_ref().count(), MAX);
+    assert_eq!((0..=MAX).by_ref().count(), 0);
+}