2011-09-09 16:20:11 -07:00
|
|
|
// error-pattern:fail
|
|
|
|
|
|
|
|
use std;
|
|
|
|
import std::map;
|
|
|
|
import std::uint;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let count = @mutable 0u;
|
2011-09-12 09:36:51 -07:00
|
|
|
let hash = bind fn (_s: [@str], count: @mutable uint) -> uint {
|
2011-09-09 16:20:11 -07:00
|
|
|
*count += 1u;
|
|
|
|
if *count == 10u {
|
|
|
|
fail;
|
|
|
|
} else {
|
|
|
|
ret *count;
|
|
|
|
}
|
|
|
|
} (_, count);
|
|
|
|
|
2011-09-12 09:36:51 -07:00
|
|
|
fn eq(s: [@str], t: [@str]) -> bool {
|
2011-09-09 16:20:11 -07:00
|
|
|
ret s == t;
|
|
|
|
}
|
|
|
|
|
|
|
|
let map = map::mk_hashmap(hash, eq);
|
|
|
|
let arr = [];
|
|
|
|
for each i in uint::range(0u, 10u) {
|
|
|
|
arr += [@"key stuff"];
|
|
|
|
map.insert(arr, arr + [@"value stuff"]);
|
|
|
|
}
|
|
|
|
}
|