aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-07-20 12:37:47 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-07-27 12:24:54 +0000
commit890f8db3d1350d71b915268ab1771810b9aa47eb (patch)
tree7785cc7f3070df4d610c08f0df9c1b9f9d7970d3
parentac850d186ac945df00eda97555d273109250554c (diff)
downloadgcc-890f8db3d1350d71b915268ab1771810b9aa47eb.zip
gcc-890f8db3d1350d71b915268ab1771810b9aa47eb.tar.gz
gcc-890f8db3d1350d71b915268ab1771810b9aa47eb.tar.bz2
privacy: Add tests for private proc macro error
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>
-rw-r--r--gcc/testsuite/rust/compile/proc_macro_attribute_private.rs4
-rw-r--r--gcc/testsuite/rust/compile/proc_macro_derive_private.rs6
-rw-r--r--gcc/testsuite/rust/compile/proc_macro_private.rs4
3 files changed, 14 insertions, 0 deletions
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
index 0000000..00b5ac6
--- /dev/null
+++ b/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs
@@ -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
index 0000000..69922be
--- /dev/null
+++ b/gcc/testsuite/rust/compile/proc_macro_derive_private.rs
@@ -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
index 0000000..17e85f4
--- /dev/null
+++ b/gcc/testsuite/rust/compile/proc_macro_private.rs
@@ -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." }