aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/for_lifetimes.rs
blob: 26469624298ada20f87cab6f39af2a9208abf721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// { dg-additional-options "-frust-compile-until=typecheck" }

fn function_pointer_as_argument(f: for<'a> fn(&'a i32) -> &'a i32) -> i32 {
    0
}

fn function_pointer_as_return() -> for<'a> fn(&'a i32) -> &'a i32 {
}

// https://doc.rust-lang.org/reference/trait-bounds.html

trait Fn<T> {}
fn call_on_ref_zero<F>(f: F) where for<'a> F: Fn(&'a i32) {}

fn call_on_ref_zero2<F>(f: F) where F: for<'a> Fn(&'a i32) {}

trait Trait<'a, T: 'a> {}

impl<'a, T> Trait<'a, T> for &'a T {}