rust/src/test/run-pass/infer-with-expected.rs
2012-07-01 19:19:32 -07:00

13 lines
416 B
Rust

// Tests the passing down of expected types through boxing and
// wrapping in a record or tuple. (The a.x would complain about 'this
// type must be known in this context' if the passing down doesn't
// happen.)
fn eat_tup(_r: ~@(int, fn@({x: int, y: int}) -> int)) {}
fn eat_rec(_r: @~{a: int, b: fn@({x: int, y: int}) -> int}) {}
fn main() {
eat_tup(~@(10, |a| a.x ));
eat_rec(@~{a: 10, b: |a| a.x });
}