]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add regression test for lifetime name validation
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 7 Nov 2023 18:13:57 +0000 (19:13 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:13:13 +0000 (19:13 +0100)
Lifetime name are restricted and cannot be keyword, this commit add a
test failing the ast validation pass due to some keyword name.

gcc/testsuite/ChangeLog:

* rust/compile/lifetime_name_validation.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/lifetime_name_validation.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/lifetime_name_validation.rs b/gcc/testsuite/rust/compile/lifetime_name_validation.rs
new file mode 100644 (file)
index 0000000..2d67bd6
--- /dev/null
@@ -0,0 +1,6 @@
+pub fn one<'continue>() {} // { dg-error "lifetimes cannot use keyword names" }
+pub fn two<'_>() {}
+
+pub fn three<'static>() {}
+
+pub fn four<'loop>() {} // { dg-error "lifetimes cannot use keyword names" }