aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-07-20 13:06:32 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-07-27 12:24:54 +0000
commit72e6a1e85d7930825cfd370104ea5adee4d082ce (patch)
tree34945eb2ba048f9af3cd8046939523b812f42793
parent5e48542f93de0dd4b74c74924ed90f3cd37f6738 (diff)
downloadgcc-72e6a1e85d7930825cfd370104ea5adee4d082ce.zip
gcc-72e6a1e85d7930825cfd370104ea5adee4d082ce.tar.gz
gcc-72e6a1e85d7930825cfd370104ea5adee4d082ce.tar.bz2
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>
-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.." }