2011-09-09 18:20:11 -05:00
|
|
|
// error-pattern:fail
|
|
|
|
|
|
|
|
use std;
|
|
|
|
import std::map;
|
|
|
|
import std::uint;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let count = @mutable 0u;
|
2011-10-10 06:54:03 -05:00
|
|
|
let hash = bind fn (&&_s: [@str], count: @mutable uint) -> uint {
|
2011-09-09 18:20:11 -05:00
|
|
|
*count += 1u;
|
|
|
|
if *count == 10u {
|
|
|
|
fail;
|
|
|
|
} else {
|
|
|
|
ret *count;
|
|
|
|
}
|
|
|
|
} (_, count);
|
|
|
|
|
2011-10-10 06:54:03 -05:00
|
|
|
fn eq(&&s: [@str], &&t: [@str]) -> bool {
|
2011-09-09 18:20:11 -05:00
|
|
|
ret s == t;
|
|
|
|
}
|
|
|
|
|
|
|
|
let map = map::mk_hashmap(hash, eq);
|
|
|
|
let arr = [];
|
2011-10-21 06:14:28 -05:00
|
|
|
uint::range(0u, 10u) {|i|
|
2011-09-09 18:20:11 -05:00
|
|
|
arr += [@"key stuff"];
|
|
|
|
map.insert(arr, arr + [@"value stuff"]);
|
2011-10-21 06:14:28 -05:00
|
|
|
};
|
2011-09-09 18:20:11 -05:00
|
|
|
}
|