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