rust/src/test/run-pass/regions-infer-call-2.rs

13 lines
217 B
Rust
Raw Normal View History

fn takes_two(x: &int, y: &int) -> int { *x + *y }
fn with<T>(f: fn(x: &int) -> T) -> T {
f(&20)
}
fn has_one(x: &a/int) -> int {
do with |y| { takes_two(x, y) }
}
fn main() {
assert has_one(&2) == 22;
}