aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/closure1.rs
blob: e9564133b5561b5b51bb3a8721cb6befd15a51fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#[lang = "sized"]
pub trait Sized {}

extern "C" {
    fn printf(s: *const i8, ...);
}

#[lang = "fn_once"]
pub trait FnOnce<Args> {
    #[lang = "fn_once_output"]
    type Output;

    extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}

fn main() -> i32 {
    let closure_annotated = |i: i32| -> i32 { i + 1 };

    let i = 1;
    closure_annotated(i) - 2
}