2011-09-09 18:20:11 -05:00
|
|
|
// error-pattern:fail
|
|
|
|
|
|
|
|
use std;
|
2012-09-05 14:32:05 -05:00
|
|
|
use std::map;
|
|
|
|
use std::map::hashmap;
|
2011-09-09 18:20:11 -05:00
|
|
|
|
|
|
|
fn main() {
|
2012-03-26 20:35:18 -05:00
|
|
|
let count = @mut 0u;
|
2012-08-02 17:42:56 -05:00
|
|
|
pure fn hash(s: &~[@~str]) -> uint {
|
|
|
|
if vec::len(*s) > 0u && *s[0] == ~"boom" { fail; }
|
2012-08-01 19:30:05 -05:00
|
|
|
return 10u;
|
2011-10-25 10:57:26 -05:00
|
|
|
}
|
2012-08-02 17:42:56 -05:00
|
|
|
pure fn eq(s: &~[@~str], t: &~[@~str]) -> bool {
|
|
|
|
return *s == *t;
|
2011-09-09 18:20:11 -05:00
|
|
|
}
|
|
|
|
|
2012-03-14 14:07:23 -05:00
|
|
|
let map = map::hashmap(hash, eq);
|
2012-06-29 18:26:56 -05:00
|
|
|
let mut arr = ~[];
|
2012-06-30 18:19:07 -05:00
|
|
|
for uint::range(0u, 10u) |i| {
|
2012-07-14 00:57:48 -05:00
|
|
|
arr += ~[@~"key stuff"];
|
|
|
|
map.insert(arr, arr + ~[@~"value stuff"]);
|
2011-10-21 07:12:12 -05:00
|
|
|
}
|
2012-07-14 00:57:48 -05:00
|
|
|
map.insert(~[@~"boom"], ~[]);
|
2012-03-07 18:48:57 -06:00
|
|
|
}
|