From 890f8db3d1350d71b915268ab1771810b9aa47eb Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Thu, 20 Jul 2023 12:37:47 +0200 Subject: privacy: Add tests for private proc macro error Add some tests to prevent regression on private procedural macros error messages. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_private.rs: New test. * rust/compile/proc_macro_derive_private.rs: New test. * rust/compile/proc_macro_private.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- gcc/testsuite/rust/compile/proc_macro_attribute_private.rs | 4 ++++ gcc/testsuite/rust/compile/proc_macro_derive_private.rs | 6 ++++++ gcc/testsuite/rust/compile/proc_macro_private.rs | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 gcc/testsuite/rust/compile/proc_macro_attribute_private.rs create mode 100644 gcc/testsuite/rust/compile/proc_macro_derive_private.rs create mode 100644 gcc/testsuite/rust/compile/proc_macro_private.rs (limited to 'gcc') diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs new file mode 100644 index 0000000..00b5ac6 --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_attribute_private.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +#[proc_macro_attribute] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_attribute.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_private.rs b/gcc/testsuite/rust/compile/proc_macro_derive_private.rs new file mode 100644 index 0000000..69922be --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_derive_private.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +trait Chesapeake {} + +#[proc_macro_derive(Chesapeake)] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro_derive.. must be .pub." } diff --git a/gcc/testsuite/rust/compile/proc_macro_private.rs b/gcc/testsuite/rust/compile/proc_macro_private.rs new file mode 100644 index 0000000..17e85f4 --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_private.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=proc-macro" } + +#[proc_macro] +fn my_macro() {} // { dg-error "functions tagged with .#.proc_macro.. must be .pub." } -- cgit v1.1