Debian Codegraph @

gcc/testsuite/rust/compile/issue-1483.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 #[lang = "fn_once"]
5 pub trait FnOnce<Args> {
6 #[lang = "fn_once_output"]
7 type Output;
8
9 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
10 }
11
12 pub fn takes_fn_generic<F: FnOnce(i32) -> i32>(a: i32, f: F) -> i32 {
13 f(a)
14 }
15
16 pub fn takes_fn_generic_where<F>(a: i32, f: F) -> i32
17 where
18 F: FnOnce(i32) -> i32,
19 {
20 f(a)
21 }
22
23 pub fn test() {
24 let foo = |x: i32| -> i32 { x + 1 };
25
26 takes_fn_generic(1, foo);
27 takes_fn_generic_where(2, foo);
28 }