]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hashmap/hashmap-capacity-overflow.rs
5f88683f4adfcbdb242e705d5fb007c251c6b859
[rust.git] / src / test / 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::usize;
7 use std::mem::size_of;
8
9 fn main() {
10     let threshold = usize::MAX / size_of::<(u64, u64, u64)>();
11     let mut h = HashMap::<u64, u64>::with_capacity(threshold + 100);
12     h.insert(0, 0);
13 }