summaryrefslogtreecommitdiffstats
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.rs8
1 files changed, 8 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 000000000..dcaaff671
--- /dev/null
+++ b/src/test/ui/iterators/iter-count-overflow-ndebug.rs
@@ -0,0 +1,8 @@
+// run-pass
+// only-32bit too impatient for 2⁶⁴ items
+// compile-flags: -C debug_assertions=no -C opt-level=3
+
+fn main() {
+ assert_eq!((0..usize::MAX).by_ref().count(), usize::MAX);
+ assert_eq!((0..=usize::MAX).by_ref().count(), 0);
+}