Skip to content

Commit 1586de8

Browse files
jdupakCohenArthur
authored andcommitted
Test: check implemented for lifetime handling
gcc/testsuite/ChangeLog: * rust/compile/for_lifetimes.rs: New test. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
1 parent 83b8634 commit 1586de8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 {}

0 commit comments

Comments
 (0)