]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/unboxed-closures-all-traits.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / test / run-pass / unboxed-closures-all-traits.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
5bcae85e 11#![feature(lang_items)]
1a4d82fc 12
c34b1796 13fn a<F:Fn(isize, isize) -> isize>(f: F) -> isize {
1a4d82fc
JJ
14 f(1, 2)
15}
16
c34b1796 17fn b<F:FnMut(isize, isize) -> isize>(mut f: F) -> isize {
1a4d82fc
JJ
18 f(3, 4)
19}
20
c34b1796 21fn c<F:FnOnce(isize, isize) -> isize>(f: F) -> isize {
1a4d82fc
JJ
22 f(5, 6)
23}
24
25fn main() {
c34b1796
AL
26 let z: isize = 7;
27 assert_eq!(a(move |x: isize, y| x + y + z), 10);
28 assert_eq!(b(move |x: isize, y| x + y + z), 14);
29 assert_eq!(c(move |x: isize, y| x + y + z), 18);
1a4d82fc 30}