rust/src/test/run-fail/unwind-misc-1.rs

26 lines
536 B
Rust
Raw Normal View History

// error-pattern:fail
use std;
import std::map;
import std::map::hashmap;
import uint;
fn main() {
let count = @mutable 0u;
fn hash(&&s: [@str]) -> uint {
if (vec::len(s) > 0u && str::eq(*s[0], "boom")) { fail; }
ret 10u;
}
fn eq(&&s: [@str], &&t: [@str]) -> bool {
ret s == t;
}
let map = map::hashmap(hash, eq);
let mut arr = [];
uint::range(0u, 10u) {|i|
arr += [@"key stuff"];
map.insert(arr, arr + [@"value stuff"]);
}
map.insert([@"boom"], []);
}