public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8622] gccrs: Test: check implemented for lifetime handling
@ 2024-01-30 12:02 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 12:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b49afa9ba4ad94fc71a246bceca2fcc277cb0ada
commit r14-8622-gb49afa9ba4ad94fc71a246bceca2fcc277cb0ada
Author: Jakub Dupak <dev@jakubdupak.com>
Date: Thu Jan 18 14:37:58 2024 +0100
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>
Diff:
---
gcc/testsuite/rust/compile/for_lifetimes.rs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/gcc/testsuite/rust/compile/for_lifetimes.rs b/gcc/testsuite/rust/compile/for_lifetimes.rs
new file mode 100644
index 000000000000..26469624298a
--- /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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-30 12:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 12:02 [gcc r14-8622] gccrs: Test: check implemented for lifetime handling Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).