]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: testsuite: Add tests for pub items in proc_macros
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thu, 20 Jul 2023 11:06:32 +0000 (13:06 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:56:01 +0000 (18:56 +0100)
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>
gcc/testsuite/rust/compile/proc_macro_pub_function.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/proc_macro_pub_module.rs [new file with mode: 0644]

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 (file)
index 0000000..52f5d38
--- /dev/null
@@ -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 (file)
index 0000000..a8bc0e8
--- /dev/null
@@ -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.." }