aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-07-20 13:06:32 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:56:01 +0100
commit6ad3f1fa575a1debdaa6a41f698d71c73f6600fa (patch)
treea2a79ad23a92b22a624f62f66b8872b3959e1243 /gcc
parentde83e69bb6ea300206eaf5a0cd2d365f2444f4b5 (diff)
downloadgcc-6ad3f1fa575a1debdaa6a41f698d71c73f6600fa.zip
gcc-6ad3f1fa575a1debdaa6a41f698d71c73f6600fa.tar.gz
gcc-6ad3f1fa575a1debdaa6a41f698d71c73f6600fa.tar.bz2
gccrs: testsuite: Add tests for pub items in proc_macros
Crates of type 'proc-macro' should not have any other pub member than procedural macros. These new test will avoid regression on error messages in such sitation. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_pub_function.rs: New test. * rust/compile/proc_macro_pub_module.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/proc_macro_pub_function.rs3
-rw-r--r--gcc/testsuite/rust/compile/proc_macro_pub_module.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/proc_macro_pub_function.rs b/gcc/testsuite/rust/compile/proc_macro_pub_function.rs
new file mode 100644
index 0000000..52f5d38
--- /dev/null
+++ b/gcc/testsuite/rust/compile/proc_macro_pub_function.rs
@@ -0,0 +1,3 @@
+// { dg-additional-options "-frust-crate-type=proc-macro" }
+
+pub fn wild_pub_function() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." }
diff --git a/gcc/testsuite/rust/compile/proc_macro_pub_module.rs b/gcc/testsuite/rust/compile/proc_macro_pub_module.rs
new file mode 100644
index 0000000..a8bc0e8
--- /dev/null
+++ b/gcc/testsuite/rust/compile/proc_macro_pub_module.rs
@@ -0,0 +1,3 @@
+// { dg-additional-options "-frust-crate-type=proc-macro" }
+
+pub fn wild_pub_module() {} // { dg-error ".proc-macro. crate types currently cannot export any items other than functions tagged with .#.proc_macro.., .#.proc_macro_derive.. or .#.proc_macro_attribute.." }