]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: privacy: Add tests for private proc macro error
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thu, 20 Jul 2023 10:37:47 +0000 (12:37 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:56:00 +0000 (18:56 +0100)
Add some tests to prevent regression on private procedural macros error
messages.

gcc/testsuite/ChangeLog:

* rust/compile/proc_macro_attribute_private.rs: New test.
* rust/compile/proc_macro_derive_private.rs: New test.
* rust/compile/proc_macro_private.rs: New test.

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

diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs
new file mode 100644 (file)
index 0000000..00b5ac6
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-frust-crate-type=proc-macro" }
+
+#[proc_macro_attribute]
+fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must be .pub." }
diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_private.rs b/gcc/testsuite/rust/compile/proc_macro_derive_private.rs
new file mode 100644 (file)
index 0000000..69922be
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-additional-options "-frust-crate-type=proc-macro" }
+
+trait Chesapeake {}
+
+#[proc_macro_derive(Chesapeake)]
+fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must be .pub." }
diff --git a/gcc/testsuite/rust/compile/proc_macro_private.rs b/gcc/testsuite/rust/compile/proc_macro_private.rs
new file mode 100644 (file)
index 0000000..17e85f4
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-additional-options "-frust-crate-type=proc-macro" }
+
+#[proc_macro]
+fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro.. must be .pub." }