aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Dupak <dev@jakubdupak.com>2024-01-18 14:37:58 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 12:36:52 +0100
commitb49afa9ba4ad94fc71a246bceca2fcc277cb0ada (patch)
tree6a454005c7075d4d2331f93a6c9693297ec50b91
parent4b13ec24b1abcaa735583a55b8fa564446aa57eb (diff)
downloadgcc-b49afa9ba4ad94fc71a246bceca2fcc277cb0ada.zip
gcc-b49afa9ba4ad94fc71a246bceca2fcc277cb0ada.tar.gz
gcc-b49afa9ba4ad94fc71a246bceca2fcc277cb0ada.tar.bz2
gccrs: Test: check implemented for lifetime handling
gcc/testsuite/ChangeLog: * rust/compile/for_lifetimes.rs: New test. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
-rw-r--r--gcc/testsuite/rust/compile/for_lifetimes.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/for_lifetimes.rs b/gcc/testsuite/rust/compile/for_lifetimes.rs
new file mode 100644
index 0000000..2646962
--- /dev/null
+++ b/gcc/testsuite/rust/compile/for_lifetimes.rs
@@ -0,0 +1,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 {} \ No newline at end of file