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

20 lines
448 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
enclosing.vars.values {|val|
if bitv::get(v, val) { s += "foo"; }
}
2011-07-27 07:19:39 -05:00
ret s;
}
fn main() { #debug("OK"); }