rust/src/test/run-fail/unwind-misc-1.rs
2012-09-05 12:32:05 -07:00

25 lines
540 B
Rust

// error-pattern:fail
use std;
use std::map;
use std::map::hashmap;
fn main() {
let count = @mut 0u;
pure fn hash(s: &~[@~str]) -> uint {
if vec::len(*s) > 0u && *s[0] == ~"boom" { fail; }
return 10u;
}
pure fn eq(s: &~[@~str], t: &~[@~str]) -> bool {
return *s == *t;
}
let map = map::hashmap(hash, eq);
let mut arr = ~[];
for uint::range(0u, 10u) |i| {
arr += ~[@~"key stuff"];
map.insert(arr, arr + ~[@~"value stuff"]);
}
map.insert(~[@~"boom"], ~[]);
}