rust/src/test/run-pass/infer-with-expected.rs

13 lines
416 B
Rust
Raw Normal View History

// 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() {
2012-06-30 18:19:07 -05:00
eat_tup(~@(10, |a| a.x ));
eat_rec(@~{a: 10, b: |a| a.x });
}