blob: 34d08570be43b51f2fa6ae4e533fcd657da57977 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// error-pattern:fail
use std;
import std::map;
import std::map::hashmap;
import uint;
fn main() {
let count = @mut 0u;
fn hash(&&s: [@str]) -> uint {
if (vec::len(s) > 0u && str::eq(*s[0], "boom")) { fail; }
ret 10u;
}
fn eq(&&s: [@str], &&t: [@str]) -> bool {
ret s == t;
}
let map = map::hashmap(hash, eq);
let mut arr = [];
uint::range(0u, 10u) {|i|
arr += [@"key stuff"];
map.insert(arr, arr + [@"value stuff"]);
}
map.insert([@"boom"], []);
}
|