]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/regions/regions-infer-call-2.rs
New upstream version 1.33.0+dfsg1
[rustc.git] / src / test / run-pass / regions / regions-infer-call-2.rs
CommitLineData
b7449926 1// run-pass
223e47cc 2
c34b1796
AL
3fn takes_two(x: &isize, y: &isize) -> isize { *x + *y }
4
5fn with<T, F>(f: F) -> T where F: FnOnce(&isize) -> T {
223e47cc
LB
6 f(&20)
7}
8
c34b1796 9fn has_one<'a>(x: &'a isize) -> isize {
1a4d82fc 10 with(|y| takes_two(x, y))
223e47cc
LB
11}
12
13pub fn main() {
970d7e83 14 assert_eq!(has_one(&2), 22);
223e47cc 15}