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

20 lines
457 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 14:19:39 +02:00
type var_info = {a: uint, b: uint};
fn bitv_to_str(enclosing: fn_info, v: ~bitv::bitv) -> str {
2011-07-27 14:19:39 +02:00
let s = "";
2011-07-27 14:19:39 +02:00
// error is that the value type in the hash map is var_info, not a box
2012-06-30 16:19:07 -07:00
for enclosing.vars.each_value |val| {
if v.get(val) { s += "foo"; }
}
2012-08-01 17:30:05 -07:00
return s;
}
2012-08-22 17:24:52 -07:00
fn main() { debug!("OK"); }