[gcc r14-7840] gccrs: testsuite: Add tests for pub items in proc_macros

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:03:05 GMT 2024


https://gcc.gnu.org/g:6ad3f1fa575a1debdaa6a41f698d71c73f6600fa

commit r14-7840-g6ad3f1fa575a1debdaa6a41f698d71c73f6600fa
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Thu Jul 20 13:06:32 2023 +0200

    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>

Diff:
---
 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(+)

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 00000000000..52f5d38710e
--- /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 00000000000..a8bc0e8ee2e
--- /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.." }


More information about the Gcc-cvs mailing list