blob: b80a17597deadb7ecb6da7339a4310f0b4e60765 [file]
// { dg-output "3\r*\n" }
#![feature(no_core)]
#![no_core]
#![feature(lang_items)]
extern "C" {
fn printf(s: *const i8, ...);
}
#[lang = "sized"]
pub trait Sized {}
#[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 f<F: FnOnce(i32) -> i32>(g: F) {
let call = g(1);
unsafe {
let a = "%i\n\0";
let b = a as *const str;
let c = b as *const i8;
printf(c, call);
}
}
pub fn main() -> i32 {
let a = |i: i32| {
let b = i + 2;
b
};
f(a);
0
}