about summary refs log tree commit diff
path: root/src/test/ui/hashmap/hashmap-capacity-overflow.rs
blob: 5f88683f4adfcbdb242e705d5fb007c251c6b859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-fail
// error-pattern:capacity overflow
// ignore-emscripten no processes

use std::collections::hash_map::HashMap;
use std::usize;
use std::mem::size_of;

fn main() {
    let threshold = usize::MAX / size_of::<(u64, u64, u64)>();
    let mut h = HashMap::<u64, u64>::with_capacity(threshold + 100);
    h.insert(0, 0);
}