rust/src/test/compile-fail/for-loop-decl.rs

24 lines
498 B
Rust
Raw Normal View History

// error-pattern: mismatched types
use std;
import std::map::hashmap;
import std::bitv;
type fn_info = rec(hashmap[uint, var_info] vars);
type var_info = rec(uint a, uint b);
fn bitv_to_str(fn_info enclosing, bitv::t v) -> str {
auto s = "";
// error is that the value type in the hash map is var_info, not a box
for each (@rec(uint key, @uint val) p
in enclosing.vars.items()) {
if (bitv::get(v, *p.val)) {
2011-06-14 15:11:35 -07:00
s += "foo";
}
}
ret s;
}
fn main() {
log "OK";
}