2011-09-09 18:20:11 -05:00
|
|
|
// error-pattern:fail
|
|
|
|
|
|
|
|
use std;
|
|
|
|
import std::map;
|
2012-03-07 18:48:57 -06:00
|
|
|
import std::map::hashmap;
|
2011-12-13 18:25:51 -06:00
|
|
|
import uint;
|
2011-09-09 18:20:11 -05:00
|
|
|
|
|
|
|
fn main() {
|
2012-03-26 20:35:18 -05:00
|
|
|
let count = @mut 0u;
|
2012-07-12 01:42:26 -05:00
|
|
|
fn hash(&&s: ~[@str/~]) -> uint {
|
2011-12-13 18:25:51 -06:00
|
|
|
if (vec::len(s) > 0u && str::eq(*s[0], "boom")) { fail; }
|
2011-10-25 10:57:26 -05:00
|
|
|
ret 10u;
|
|
|
|
}
|
2012-07-12 01:42:26 -05:00
|
|
|
fn eq(&&s: ~[@str/~], &&t: ~[@str/~]) -> bool {
|
2011-09-09 18:20:11 -05:00
|
|
|
ret s == t;
|
|
|
|
}
|
|
|
|
|
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-12 17:03:33 -05:00
|
|
|
arr += ~[@"key stuff"/~];
|
|
|
|
map.insert(arr, arr + ~[@"value stuff"/~]);
|
2011-10-21 07:12:12 -05:00
|
|
|
}
|
2012-07-12 17:03:33 -05:00
|
|
|
map.insert(~[@"boom"/~], ~[]);
|
2012-03-07 18:48:57 -06:00
|
|
|
}
|