Debian Codegraph @

gcc/testsuite/rust/compile/for_lifetimes.rs

raw
1 // { dg-additional-options "-frust-compile-until=typecheck" }
2
3 fn function_pointer_as_argument(f: for<'a> fn(&'a i32) -> &'a i32) -> i32 {
4 0
5 }
6
7 fn function_pointer_as_return() -> for<'a> fn(&'a i32) -> &'a i32 {
8 }
9
10 // https://doc.rust-lang.org/reference/trait-bounds.html
11
12 trait Fn<T> {}
13 fn call_on_ref_zero<F>(f: F) where for<'a> F: Fn(&'a i32) {}
14
15 fn call_on_ref_zero2<F>(f: F) where F: for<'a> Fn(&'a i32) {}
16
17 trait Trait<'a, T: 'a> {}
18
19 impl<'a, T> Trait<'a, T> for &'a T {}