From 6ad3f1fa575a1debdaa6a41f698d71c73f6600fa Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Thu, 20 Jul 2023 13:06:32 +0200 Subject: [PATCH] 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 --- gcc/testsuite/rust/compile/proc_macro_pub_function.rs | 3 +++ gcc/testsuite/rust/compile/proc_macro_pub_module.rs | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 gcc/testsuite/rust/compile/proc_macro_pub_function.rs create mode 100644 gcc/testsuite/rust/compile/proc_macro_pub_module.rs 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 000000000000..52f5d38710e5 --- /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 000000000000..a8bc0e8ee2e4 --- /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.." } -- 2.47.2