aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-07-20 12:37:47 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:56:00 +0100
commit1a02c452a6496c4f75296f0ee5669f0f9befaee6 (patch)
tree7d034e82d4010e97eb50eb5c71fe1c6177e0d81b
parente615b4fa5f3b2fda29f13db216c59d46837cfb85 (diff)
downloadgcc-1a02c452a6496c4f75296f0ee5669f0f9befaee6.zip
gcc-1a02c452a6496c4f75296f0ee5669f0f9befaee6.tar.gz
gcc-1a02c452a6496c4f75296f0ee5669f0f9befaee6.tar.bz2
gccrs: 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." }