]> git.proxmox.com Git - rustc.git/blob - tests/ui/hashmap/hashmap-capacity-overflow.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / hashmap / hashmap-capacity-overflow.rs
1 // run-fail
2 // error-pattern:capacity overflow
3 // ignore-emscripten no processes
4
5 use std::collections::hash_map::HashMap;
6 use std::mem::size_of;
7
8 fn main() {
9 let threshold = usize::MAX / size_of::<(u64, u64, u64)>();
10 let mut h = HashMap::<u64, u64>::with_capacity(threshold + 100);
11 h.insert(0, 0);
12 }