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

20 lines
483 B
Rust
Raw Normal View History

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