]> git.proxmox.com Git - rustc.git/blob - src/test/ui/iterators/iter-count-overflow-debug.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / iterators / iter-count-overflow-debug.rs
1 // run-pass
2 // only-32bit too impatient for 2⁶⁴ items
3 // needs-unwind
4 // compile-flags: -C debug_assertions=yes -C opt-level=3
5
6 use std::panic;
7
8 fn main() {
9 assert_eq!((0..usize::MAX).by_ref().count(), usize::MAX);
10
11 let r = panic::catch_unwind(|| {
12 (0..=usize::MAX).by_ref().count()
13 });
14 assert!(r.is_err());
15 }